getBBox() vs getBoundingClientRect() vs getClientRects()

后端 未结 3 1419
猫巷女王i
猫巷女王i 2021-02-01 01:36

I am unable to find an explicit reference for the use of these functions: getBBox() vs getBoundingClientRect() vs getClientRects().

<
3条回答
  •  不要未来只要你来
    2021-02-01 02:26

    getBBox is defined in the SVG specification it returns coordinates in the local coordinate system after the application of transforms.

    getBoundingClientRect and getClientRects are defined in the CSSOM specification. Their main difference is that they return coordinates in the outer SVG coordinate system.

    getBoundingClientRect returns a single rect that is the union of all the rects that getClientRect would return.

提交回复
热议问题