MapStore2
MapStore2 copied to clipboard
#9018: Dashboard - Zoom in/out on maps connected to a 3D map
Description
This PR includes fixing the inconsistently issue of zoom in/out that happens in 3d map sync with another map [2d or 3d].
The issue in 3D maps was that dependenciesToMapProp.js
file updates center
and zoom
for map object into widgets state for the synced maps, and due that update _updateMapPositionFromNewProps
method into Map.js of cesium is called to update the map view.
The issue was in these lines:
https://github.com/geosolutions-it/MapStore2/blob/2d097ff74844d96abc02b2434ff49da210d6eb3f/web/client/components/map/cesium/Map.jsx#L504-L511
It does not take the new props of center that was updated within dependenciesToMapProp
as mentioned above.
I have added 2 enhancements:
- absolute the substitute value here: https://github.com/geosolutions-it/MapStore2/blob/2d097ff74844d96abc02b2434ff49da210d6eb3f/web/client/components/map/cesium/Map.jsx#L489
as during test I tried to move from a point with negative coordinates to a point with positive coordinates and vice versa so if the result with negative value, the logic of
isNearlyEqual
will not be accurate as expected. - adding round to zoom values as in some cases the calculated zoom level from height adds a very small tolerance to the zoom level like: zoom = 6, the calculated zoom level = 6.0000008 which will update the view unnecessarily and actually this was my first try to fix the issue mentioned into the demo issue.
Please check if the PR fulfills these requirements
- [x] The commit message follows our guidelines: https://github.com/geosolutions-it/MapStore2/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (check one with "x", remove the others)
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
Issue
#9018
What is the current behavior? #9018
What is the new behavior? Now the zoom restriction that seems in the issue is fixed
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
- [ ] Yes, and I documented them in migration notes
- [x] No