maplibre-rs icon indicating copy to clipboard operation
maplibre-rs copied to clipboard

Limiting Zoom by style values

Open DerKarlos opened this issue 3 years ago • 5 comments

To solve the issue, I added a clamp to Zoom and used it in ViewState.update_zoom. I had to add maxzoom/minzoom as parameter/members to ViewState Not yet changed: style-spec-v8.json Todo: Error messages (And it is my first Pull Request ever)

💻 Examples

Set the max/minzoom in the map style to the values, you want to test

🚨 Test instructions

Just zoom in/out to level 0/20. Zooming ends. But the map sliding not! To be investigated

✔️ PR Todo

  • [ ] Included links to related issues #161 (not #73)

DerKarlos avatar Oct 02 '22 16:10 DerKarlos

style-spec-v8.json

That file should be removed soon. It is not used.

(And it is my first Pull Request ever)

Awensome! Please more! :D

maxammann avatar Oct 08 '22 15:10 maxammann

@DerKarlos I pushed a fix for the jumping. Basically the issue was that with every zoom there is also a translation of the map (such that the exact coordinates where the mouse points to, stays where the mouse pointer is)

maxammann avatar Oct 08 '22 18:10 maxammann

Two editing the same thing may make trouble. I could merge it but can't build: maplibre-winit/src/input/zoom_handler.rs:22:56 | 22 | let zoom_changed = actual_next_zoom != current_zoom; | ^^^^^^^^^^^^ expected (), found struct Zoom

Uh! I can't merge, can't pul, just lost between all the tools.

Bordbuch nachtrag:

Your Zoom.ne needs an epsilon. So this causes the error?: let zoom_changed = actual_next_zoom != current_zoom; update_zoom has no return but used like it does May be I made a mistake while merging. I added the -> Zoom to update_zoom and now it builds runs and zoom limit works without sliding the map. It is merged and should be visible. May be the draft state could be removed

DerKarlos avatar Oct 08 '22 20:10 DerKarlos

@DerKarlos merged in main to fix builds

maxammann avatar Oct 23 '22 16:10 maxammann

@DerKarlos Hi! Are you still interested in pushing this forward? I may be able to help resolving conflicts.

maxammann avatar Oct 20 '23 20:10 maxammann