Go to Settings Tap Accessibility?Magnification gestures Turn the switch at the top of the screen to ?On? Now you can zoom the entire display by triple-tapping the screen with one finger Another triple-tap will turn zoom off You can pan with two fingers held down You can change the magnification with a two-finger spread or pinch
I didn't know that feature existed. However, it doesn't really help as I don't know why your phone doesn't take into account the navbar. I've found some code on the internet which calculates the screen size a different way to the way I currently do it, so I'll give that a go and check it doesn't break, and hopefully that might work on yours.