digidem / leaflet-side-by-side

A Leaflet control to add a split screen to compare two map overlays
http://lab.digital-democracy.org/leaflet-side-by-side/
MIT License
343 stars 107 forks source link

Dragging button isn't in the middle of the map #44

Open hejustbrave opened 2 years ago

hejustbrave commented 2 years ago

1653299024(1)

1653299041(1) and my code is:

zhenyu-123 commented 2 years ago

text-align: center;

hejustbrave commented 2 years ago

您好,您的邮件本人已经收到,谢谢!

claudiobogossian commented 1 year ago

i had the same problem, make sure map dimensions are updated using map.invalidateSize() before enable sideBySide control.

hejustbrave commented 1 year ago

您好,您的邮件本人已经收到,谢谢!

Aqulia commented 1 year ago

I have the same problem,please tell me the solution about it ,thank you!!!!

hejustbrave commented 1 year ago

您好,您的邮件本人已经收到,谢谢!

claudiobogossian commented 1 year ago

I have the same problem,please tell me the solution about it ,thank you!!!!

After page load, make sure to invoke map.invalidateSize() before enabling sideBySide control.

Aqulia commented 1 year ago

I have the same problem,please tell me the solution about it ,thank you!!!!

After page load, make sure to invoke map.invalidateSize() before enabling sideBySide control.

I tried, but it didn't work. I control the opening and closing of the roller shutter function through a button. But adding the above code is completely useless 屏幕截图 2023-04-13 140407

claudiobogossian commented 1 year ago

We invalidate only after page load... Not when the tool is activated.

https://user-images.githubusercontent.com/3015977/231895100-dff76e18-9a26-498b-b2cc-ff4d1e5c089f.mp4

Aqulia commented 1 year ago

We invalidate only after page load... Not when the tool is activated.

Sorry,I still don't understand when I should call this method, meaning after initializing the map object? Or before loading each layer?I tried both separately, but both failed

hejustbrave commented 1 year ago

image now coding with vue,the control seems work normal,my code as the layers added before setting to the control image

iamtekson commented 2 months ago

I solved the issue by overwriting the default CSS as below,

.leaflet-sbs-divider {
  margin-left: 10px !important;
}
hejustbrave commented 2 months ago

您好,您的邮件本人已经收到,谢谢!