admin管理员组文章数量:1279008
I'm trying to make an event for rightclicking an element in jointjs, however the event does not fire at all for right click only left click and middle click work. How to make it work for right click? Why doesn't it work?
this.paper.on('element:pointerdown', (elementView: any, event: MouseEvent) => {
console.log("1");
if (event.button === 2) {
console.log("2");
event.preventDefault();
this.startEdgeCreation(elementView.model, event);
}
});
I'm trying to make an event for rightclicking an element in jointjs, however the event does not fire at all for right click only left click and middle click work. How to make it work for right click? Why doesn't it work?
this.paper.on('element:pointerdown', (elementView: any, event: MouseEvent) => {
console.log("1");
if (event.button === 2) {
console.log("2");
event.preventDefault();
this.startEdgeCreation(elementView.model, event);
}
});
Share
Improve this question
asked Feb 24 at 4:35
MiccaMicca
372 bronze badges
1 Answer
Reset to default 1You should use the element:contextmenu
event instead: https://docs.jointjs/api/dia/Paper/#contextmenu
So, in your case:
this.paper.on('element:contextmenu', (elementView: any, event: MouseEvent) => {
console.log("2");
event.preventDefault();
this.startEdgeCreation(elementView.model, event);
});
本文标签:
版权声明:本文标题:javascript - jointjs - element:pointerdown for rightclick doesnt fire, only left click and middle button click - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741294182a2370720.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论