Answer the question
In order to leave comments, you need to log in
How to redraw in browser?
Disclaimer . Some smart people post links to let me google for you.
You need a proven cross-browser and cross-platform solution for use in production, not links to Google. Thank you.
The point is this. Need to scale in browser on mobile devices using pinch-to-zoom and rotate svg map.
Using scale3d or scale, at the moment of zooming, the map becomes a raster, so that everything is processed quickly. But after releasing the fingers, it is still raster unless css-transitions is enabled or redraw is performed. Enabling css-transitions is stupid, because everything lags, as the browser tries to make an animation between each state. But then she does redraw.
In the end, I settled on a hack
$('svg').hide();
$('svg').get(0).offsetHeight();
$('svg').show();
Answer the question
In order to leave comments, you need to log in
There are different hacks for different browsers. People have even created libraries on this topic.
lmgtfy.com/?q=force+repaint+redraw+reflow
requestAnimationFrame
https://developer.mozilla.org/ru/docs/DOM/window.r...
After releasing
enable transitions
make scale(current scale + 0.01)
disable transitions via setTimeout
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question