[英]How to access element from custom event using svg.js
Using svg.js, how do you access element from custom event? 使用svg.js,如何从自定义事件访问元素?
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. 在
click
事件中有效,但不能使用它。 in custome events... 在习俗活动中...
Any ideas? 有任何想法吗?
To get the element from event, events property target could be used ... 为了从事件中获取元素,可以使用events属性目标。
...
let element = SVG.get(event.target.id);
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.