-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG overlay using on("move") and project() out of sync in IE/Edge/Safari #5390
Comments
Hi @joedjc, thanks for the report. I believe this is a different issue from #4681. It's interesting that, in the GIF above, it looks like it's the map lagging behind the SVG, not the other way around. @joedjc how does the map's framerate look for you in Edge if you disable the |
Hi @anandthakker thanks for looking into it. I think you might be onto something there...the SVG does indeed move before the map as though it fires the move event without checking that the map has caught up...or assumes the map can update at the same speed? I'm sure you're right but the behaviour does look suspiciously similar with markers (e.g. #5360). I tried testing a few things:
Not sure what to conclude from that...but i'd be interested to know if the If having SVG elements on the page just isn't feasible I guess I could try a canvas overlay instead...might be more efficient although i'm seeing similar behaviour in this example: http://bl.ocks.org/enjalot/cef62e519f94916f62e851d378cee043 Something else I noticed is that, even in Chrome, if you use the zoom controls you can see some similar sync problems as it zooms in/out. |
We might have found the (or an) underlying issue here: the |
@anandthakker Ok...I noticed this also affects zooming, rotating and tilting the map not just panning. Things like double clicking the map to zoom or pressing the compass to reset the map bearing also display this behaviour. |
The zooming/rotating/panning are consistent with the above diagnosis, but not the double-click zoom or compass reset -- @joedjc any chance you could post a quick video / live example that exhibits this behavior in those cases? |
@anandthakker I checked on the master and this is looking good for me in all browsers - thank you very much! Only small thing is I find zooming using the trackpad on a mac in Safari still displays a bit of a lag. Doesn't appear using the zoom controls or zooming using a mouse wheel. |
The underlying cause of the desynchronization here is that Safari and IE/Edge are non-spec compliant in running |
@joedj: "I've tried to capture it here - the red boxes are an svg overlay" Thanks |
I'm trying to use an SVG overlay like this https://bl.ocks.org/shimizu/5f4cee0fddc7a64b55a9 or this http://bl.ocks.org/enjalot/0d87f32a1ccb9a720d29ba74142ba365.
I use a map.on("move") event to call a function which updates the location of the SVG elements, together with map.project() to get the on screen co-ordinates (similar to the first example - except without hiding the SVG graphics when moving).
In Chrome and Firefox this works well with the SVG graphics appearing seamlessly with mapbox, but in IE11, Edge and to some extent Safari there is a significant lag between the mouse move and the SVG features being updated.
Possibly this is related to this issue: #4681 because I see similar behaviour with markers in those browsers. Not sure if that PR is being progressed?
Example in Edge:
The text was updated successfully, but these errors were encountered: