0

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?

vidriduch
  • 4,753
  • 8
  • 41
  • 63

1 Answers1

1

To get the element from event, events property target could be used ...

...
let element = SVG.get(event.target.id);
...
vidriduch
  • 4,753
  • 8
  • 41
  • 63