Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svg out of screen, is rendered?

Scenario: I have SVG image that I can zoom-in and zoom-out. Depending on the zoom, I will display more/less details on the visible part.

The question is: should I take care of not displaying details on the parts that are not currently visible (out of the screen), or the rendering engine is smart enough to skip (clip) those parts before they are rendered?

like image 900
Jakub M. Avatar asked Oct 11 '22 12:10

Jakub M.


1 Answers

Yes, browsers are usually clever enough to not render things outside the viewport area.

Note however that the browser still needs to traverse the entire document tree, so even things outside the viewport area can have an impact. It's usually enough to mark the non-interesting subtrees with display="none" to let the browser skip over them when traversing. On small documents that's usually not something that you need to worry about.

like image 79
Erik Dahlström Avatar answered Oct 14 '22 02:10

Erik Dahlström