How to get coordinates of an svg element?

前端 未结 7 1999

I am using d3 to draw a line from a relative svg position and hence want to access the coordinates of the element itself. I tried something like this (where \"this\" refers

相关标签:
7条回答
  • 2020-12-23 12:17

    I was trying to select an area of svg with a rectangle and get all the elements from it. For this, element.getBoundingClientRect() worked perfectly for me. It returns current coordinates of svg elements regardless of whether svg is scaled or transformed.

    0 讨论(0)
提交回复
热议问题