Check for svg element in viewport

having an SVG embedded HTML document, with the "xywh" field. How to check if an item is inside the viewport?

saying that an element can be a nested child path within a group, etc.

so I think I'm looking for a built-in SVG function, or quick to check it out.

I tried to save the viewbox courts, and the element I want to check if it is in the viewport I did something like:

while (parent ! the svg element ...) { parent = get elem parent } 

// now I have the most important parent of this element, inside svg doc now check if there is a parent inside the viewbox, if true, then child, otherwise false

+4
source share
1 answer

perhaps you can try the checkEnclosure method of the SVGSVGElement.

0
source

Source: https://habr.com/ru/post/1403173/


All Articles