I want to be able to adapt to the function when you click on it, but when it approaches, I would like it to take into account the level of control that will be displayed after zooming and scaling, but only 150 pixels to the left. I can currently do this with the following code, but unfortunately it is not a smooth scale, because my current method will be incremented using fitBounds, and then when it is enlarged, it uses panBy to pan 150 pixels to the left. This would not be so bad if the panning was smooth, perhaps after waiting for 250 ms. Ideally, I would like to do some math at the boundaries passed to the fitBounds method, just to allow for a shift of 150 pixels to the left.
Here is an example of what I am currently working on.
Here is a simplified version of the code I'm using: (you can click here for a fully working version with all source code)
when you click
function clickFeature(e) { var layer = e.target; map.fitBounds(layer.getBounds()); }
map on zoomEnd:
map.on({ zoomend: function() { map.panBy([150, 0]); } });
So, I have achieved the desired function, but it is just not smooth.
Is there a way to do some math at the borders that we get for the click function, so when we zoom in, we zoom in the already changed coordinate, thereby eliminating the two-stage animation process?
source share