Replies: 6 comments 4 replies
-
Fit bounds can behave differently depending on the screen resolution (or more correctly the screen aspect ratio). |
Beta Was this translation helpful? Give feedback.
-
@HarelM yes, I understand and figured that. But how could I enforce exact bounds when aspect ratio does not change? |
Beta Was this translation helpful? Give feedback.
-
How do you decide which bounds to set? I guess you can use some projection from screen pixels to lat lng... |
Beta Was this translation helpful? Give feedback.
-
I'm not sure this is an issue though. Feels more like a discussion. |
Beta Was this translation helpful? Give feedback.
-
I suppose it can be a discussion depending on how you look at it. I feel that setting a map's bounds, getting those bounds, saving them in a DB and initializing that same map with those bounds that creates different bounds in the same exact container with set aspect ratio can potentially be an issue. (Sorry for the run on sentence). We attempted react state and kept getting re-renders because props didn't match but I couldn't spend too much time on it. |
Beta Was this translation helpful? Give feedback.
-
@HarelM To me, this appears to be a bug/issue: const map1 = new Map({
container,
bounds,
style
});
const map2 = new Map({
container,
bounds: map1.getBounds(),
style
});
// map1.getBounds() != map2.getBounds(). Both maps have different bounds. I confirmed that the container width/height & the map transformer width/height match and that it's not some weird issue from resizing. |
Beta Was this translation helpful? Give feedback.
-
We're trying to save state of a map via user input and have come across an issue where when we save
map.getBounds
and re-create it,map.getBounds
changes:Beta Was this translation helpful? Give feedback.
All reactions