File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
worldwind/src/main/java/gov/nasa/worldwind Expand file tree Collapse file tree 1 file changed +16
-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,19 @@ public Navigator getNavigator() {
306308 return this .navigator ;
307309 }
308310
311+ public boolean isKeepScale () {
312+ return keepScale ;
313+ }
314+
315+ /**
316+ * Keep pixel scale when changing the height of viewport by adapting field of view
317+ *
318+ * @param keepScale if true, then field of view will be changed on viewport height change to keep pixel scale
319+ */
320+ public void setKeepScale (boolean keepScale ) {
321+ this .keepScale = keepScale ;
322+ }
323+
309324 public void addNavigatorListener (NavigatorListener listener ) {
310325 if (listener == null ) {
311326 throw new IllegalArgumentException (
You can’t perform that action at this time.
0 commit comments