File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
worldwind/src/main/java/gov/nasa/worldwind Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ public class WorldWindow extends GLSurfaceView implements Choreographer.FrameCal
9292
9393 protected Viewport viewport = new Viewport ();
9494
95+ protected boolean keepScale = true ;
96+
9597 protected int depthBits ;
9698
9799 protected Pool <Frame > framePool = new SynchronizedPool <>();
@@ -116,7 +118,7 @@ public boolean handleMessage(Message msg) {
116118 } else if (msg .what == MSG_ID_SET_VIEWPORT ) {
117119 Viewport newViewport = (Viewport ) msg .obj ;
118120 // Keep map scale by adopting field of view on view port resize
119- if (viewport .height != 0 ) {
121+ if (keepScale && viewport .height != 0 ) {
120122 try {
121123 camera .setFieldOfView (camera .getFieldOfView () * newViewport .height / viewport .height );
122124 } catch (IllegalArgumentException ignore ) {
@@ -306,6 +308,15 @@ public Navigator getNavigator() {
306308 return this .navigator ;
307309 }
308310
311+ /**
312+ * Keep pixel scale when changing the height of viewport by adapting field of view
313+ *
314+ * @param keepScale if true, then field of view will be changed on viewport height change to keep pixel scale
315+ */
316+ public void setKeepScale (boolean keepScale ) {
317+ this .keepScale = keepScale ;
318+ }
319+
309320 public void addNavigatorListener (NavigatorListener listener ) {
310321 if (listener == null ) {
311322 throw new IllegalArgumentException (
You can’t perform that action at this time.
0 commit comments