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

Restricting MapView's zoom to a range & navigation to a (mutable) border. #62

Closed
JulianBroudy opened this issue Sep 4, 2019 · 12 comments
Labels
Projects

Comments

@JulianBroudy
Copy link

@JulianBroudy JulianBroudy commented Sep 4, 2019

Setting the Configuration option interactive to false locks the map. Or what do you mean with lock? As for the restriction, this could be implemented by setting a bounding extent but there are open questions: what if let's say the map is zoomed out to the maximum allowed extend, and then the window size is enlarged. At the moment enlarging the window increases the visible area, for a bounded extent would this mean to zoom in? Can you please create a new issue for this where this can be discussed?

Originally posted by @sothawo in #58 (comment)

@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Sep 4, 2019

Or what do you mean with lock?

By lock I mean:

  • User should be able to zoom-in, zoom-out as long as the next zoom-out level won't expose (show) any parts of the map that are not inside the borders.

  • User should be able (if not zoomed-out to maximum) to move the map around. When it is moved in a way that (if unrestricted) would show any parts of the map that are not inside the borders, the map won't show it. I'm visualizing it as a "bounce" effect between the map's imaginary border and the actual bounding box of the mapView (GUI wise).

what if let's say the map is zoomed out to the maximum allowed extent, and then the window size is enlarged. At the moment enlarging the window increases the visible area, for a bounded extent would this mean to zoom in?

Currently, my program doesn't have the option to maximize. So this didn't initially occur to me. But that's a very valid point. I would say, ideally, it should do exactly what you said.

@sothawo sothawo added the enhancement label Sep 6, 2019
@sothawo sothawo added this to To do in mapjfx Sep 7, 2019
@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Sep 12, 2019

fyi: I played around with this a little bit, it's more complicated than I though it would be. Especially because at the moment, the zoom values are restricted to integers, to adjust the visible area to a bounding box, it might be necessary to change that. But I'm not sure how fine zoom changes might be.
I read on SO that in version 6 OpenLayers will have a constrainExtent, I can try this, but I don't know when verison 6 will be release, currently 6.0.0-beta.15 is available (and it might break other things).
So this is not forgotten, I try to find a solution.

@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Sep 17, 2019

I'll stay tuned.
Thank you.

@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Sep 27, 2019

OL 6 is released (https://github.com/openlayers/openlayers/releases/tag/v6.0.0) I will try this out , might have time this weekend

@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Oct 9, 2019

Hey there, is there an option to "bring to front" a Marker instead of removing the one I want in front and re-adding it?

@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Oct 9, 2019

No. Markers are added as <img> to a <div> in the order they are added, and an overlay is added to the OpenLayers map. A bring to front would have to remove the overlay and the <img> tag and readd it, there's no other way to change this internally.

So that's basically the same that you would achieve with a remove/add call from your program.

@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Oct 10, 2019

No. Markers are added as <img> to a <div> in the order they are added, and an overlay is added to the OpenLayers map. A bring to front would have to remove the overlay and the <img> tag and readd it, there's no other way to change this internally.

So that's basically the same that you would achieve with a remove/add call from your program.

Understood, thank you.

@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Oct 11, 2019

good news: OpenLayers 6.0.1 can constrain the extent, so that it is not possible anymore to scroll or pan outside a given extent.
I will implement this this weekend in mapjfx

@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Oct 11, 2019

That's awesome, looking forward to it.

Side question:
Can you think of a way to easily control when MapView's animations are executed?
For instance:

  • clicking map twice (to move marker) before the first click's animation is done OR
  • programmatically changing the MapView's extent twice without providing enough time for the first animation to finish results in this:
    giphy

A status getter (RUNNING, NOT RUNNING) for MapView's animation would be nice if possible.

@sothawo sothawo moved this from To do to In progress in mapjfx Oct 11, 2019
@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Oct 12, 2019

Implemented in the current version.

about the animation: No easy solution I can think of.

And I don't have much time in the next week(s); got quite some work to do as Spring Data Elasticsearch project lead (besides my normal job)

@sothawo sothawo closed this Oct 12, 2019
mapjfx automation moved this from In progress to Done Oct 12, 2019
@JulianBroudy

This comment has been minimized.

Copy link
Author

@JulianBroudy JulianBroudy commented Oct 31, 2019

Implemented in the current version.

I'm sorry to bother you yet again.
Is this available in version 1.27.1?
As you can recall I opted to use this version with Java 8 since others didn't work as expected.

Thanx again.

@sothawo

This comment has been minimized.

Copy link
Owner

@sothawo sothawo commented Oct 31, 2019

that was implemented in 1.29.0 (1.29.1 is the latest Java 8 version now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
mapjfx
  
Done
2 participants
You can’t perform that action at this time.