Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how zoom on a clamped map works. #605

Merged
merged 2 commits into from
Aug 10, 2016
Merged

Change how zoom on a clamped map works. #605

merged 2 commits into from
Aug 10, 2016

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Aug 8, 2016

Before, if you have a clamped map or image and zoom in via the mouse wheel near an edge with adjacent empty space, the location of the map slides back and forth, rather than the point where you are zooming remaining under the mouse cursor.

Now, the coordinates under the mouse cursor remain the same, which means the map may not be clamped as fully as it could. You can drag the map to reduce the empty space that clamp would have removed in the past, but not to increase it. If you zoom in on an area off of the map, the clamping will still apply to prevent more than half of the viewport from having empty space. This also affects how rotation clamping works.

There was an oddness where the reported map center was not the visible map center if clamping had occurred. This has been fixed.

Also, noticed some needless code in the vgl renderer, so removed it.

Before, if you have a clamped map or image and zoom in via the mouse wheel near an edge with adjacent empty space, the location of the map slides back and forth, rather than the point where you are zooming remaining under the mouse cursor.

Now, the coordinates under the mouse cursor remain the same, which means the map may not be clamped as fully as it could.  You can drag the map to reduce the empty space that clamp would have removed in the past, but not to increase it.  If you zoom in on an area off of the map, the clamping will still apply to prevent more than half of the viewport from having empty space.  This also affects how rotation clamping works.

There was an oddness where the reported map center was not the visible map center if clamping had occurred.  This has been fixed.

Also, noticed some needless code in the vgl renderer, so removed it.
@codecov-io
Copy link

codecov-io commented Aug 8, 2016

Current coverage is 81.70% (diff: 90.47%)

Merging #605 into master will increase coverage by <.01%

@@             master       #605   diff @@
==========================================
  Files            82         82          
  Lines          7482       7490     +8   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6113       6120     +7   
- Misses         1369       1370     +1   
  Partials          0          0          

Powered by Codecov. Last update f525f1e...9656b4d

* Return the nearest valid bounds maintaining the
* width and height. Does nothing if m_clampBounds* is
* false.
* Return the nearest valid bounds maintaining the width and height. Does
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entire sure about these options and will need some discussion to understand it completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is easiest to show the issues that had existed and show what the new behavior allows.

For example of the current behavior, go here: http://opengeoscience.github.io/geojs/examples/tiles/?clampBoundsX=true&wrapX=false&zoom=0 using a browser with a window wider than it is tall. This is our tile example with wrapping turned off and clamping turned on. Hover your mouse over New Zealand, and use the mouse wheel to scroll in. New Zealand will shift from underneath the cursor, so you zoom in on a different location.

This can be corrected by not clamping the bounds on zoom, but since clamping is a desired feature, there is code to clamp eventually (don't let the map get more than half off the screen), and to allow panning the map back to where the delta. If you run the same example on this PR's code, New Zealand will stay under the mouse cursor. You'll see white background to the right of New Zealand. You can pan the map right (reducing that white space), but not left (since that increases the clamping violation).

@manthey manthey merged commit f8e819f into master Aug 10, 2016
@manthey manthey deleted the fix-zoom-shift branch August 10, 2016 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants