File tree 1 file changed +12
-1
lines changed
worldwind/src/main/java/gov/nasa/worldwind
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
92
92
93
93
protected Viewport viewport = new Viewport ();
94
94
95
+ protected boolean keepScale = true ;
96
+
95
97
protected int depthBits ;
96
98
97
99
protected Pool <Frame > framePool = new SynchronizedPool <>();
@@ -116,7 +118,7 @@ public boolean handleMessage(Message msg) {
116
118
} else if (msg .what == MSG_ID_SET_VIEWPORT ) {
117
119
Viewport newViewport = (Viewport ) msg .obj ;
118
120
// Keep map scale by adopting field of view on view port resize
119
- if (viewport .height != 0 ) {
121
+ if (keepScale && viewport .height != 0 ) {
120
122
try {
121
123
camera .setFieldOfView (camera .getFieldOfView () * newViewport .height / viewport .height );
122
124
} catch (IllegalArgumentException ignore ) {
@@ -306,6 +308,15 @@ public Navigator getNavigator() {
306
308
return this .navigator ;
307
309
}
308
310
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
+
309
320
public void addNavigatorListener (NavigatorListener listener ) {
310
321
if (listener == null ) {
311
322
throw new IllegalArgumentException (
You can’t perform that action at this time.
0 commit comments