Reputation: 4863
Using svg.js, how do you access element from custom event?
myCircle.on('someEvent', function(event) {
var circleX = event.x(); // event.x is not a function
circleX = event.target.x() // event.x is not a function
circleX = event.target.x() // event.target.x is not a function
circleX = this.x() // this is undefined
});
Using this. in click
event works, but cannot use this. in custome events...
Any ideas?
Upvotes: 0
Views: 112
Reputation: 4863
To get the element from event, events property target could be used ...
...
let element = SVG.get(event.target.id);
...
Upvotes: 1