I use Snap.svg API. I need to get an element position:
const outPort = paper.select(`#${outPortId}`);
console.log(`outPort: {x:${outPort.attr("x")},y:${outPort.attr("y")}}`);
Console output:
outPort: {x:null,y:null}
How can I get an element position in Snap.svg API?
Dimity's suggestion helped me; using
outPort.getBBox().cx, outPort.getBBox().cy
Also, converting these coordinates to client window coordinates like in that answer , was useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.