Skip to content

Commit

Permalink
Keep map scale by adopting field of view on view port resize.
Browse files Browse the repository at this point in the history
  • Loading branch information
ComBatVision committed May 29, 2022
1 parent 29d100d commit 9c56c0e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion worldwind/src/main/java/gov/nasa/worldwind/WorldWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ public boolean handleMessage(Message msg) {
} else if (msg.what == MSG_ID_REQUEST_REDRAW) {
requestRedraw();
} else if (msg.what == MSG_ID_SET_VIEWPORT) {
viewport.set((Viewport) msg.obj);
Viewport newViewport = (Viewport) msg.obj;
// Keep map scale by adopting field of view on view port resize
if (viewport.height != 0) {
camera.setFieldOfView(camera.getFieldOfView() * newViewport.height / viewport.height);
}
viewport.set(newViewport);
} else if (msg.what == MSG_ID_SET_DEPTH_BITS) {
depthBits = (Integer) msg.obj;
}
Expand Down

0 comments on commit 9c56c0e

Please sign in to comment.