admin管理员组文章数量:1395904
)
I have a question about the KonvaJS.
I am trying to figure out how to catch the right click mouse event on a shape.
There are already some events for this kind of "event catching" but it seems to be that they are not for the shapes/groups.
So, what I've already tried:
group.addEventListener('contextmenu', function() {
alert("test");
});
group.on('contextmenu', function(){
alert("test");
});
group.on('contentContextmenu', function(){
alert("test");
});
All three of them are not working
The only thing what is working fine
stage.on('contentContextmenu', function(e) {
e.evt.preventDefault();
console.log(e);
});
Is there any other events present in the framework?
Maybe you can help me =)
Thank You
)
I have a question about the KonvaJS.
I am trying to figure out how to catch the right click mouse event on a shape.
There are already some events for this kind of "event catching" but it seems to be that they are not for the shapes/groups.
So, what I've already tried:
group.addEventListener('contextmenu', function() {
alert("test");
});
group.on('contextmenu', function(){
alert("test");
});
group.on('contentContextmenu', function(){
alert("test");
});
All three of them are not working
The only thing what is working fine
stage.on('contentContextmenu', function(e) {
e.evt.preventDefault();
console.log(e);
});
Is there any other events present in the framework?
Maybe you can help me =)
Thank You
Share Improve this question asked Feb 17, 2018 at 2:14 XearoxXearox 492 silver badges7 bronze badges1 Answer
Reset to default 8// do not show context menu on right click
stage.on('contextmenu', (e) => {
e.evt.preventDefault();
});
// do something else on right click
circle.on('click', (e) => {
if (e.evt.button === 2) {
alert('right click')
}
});
Demo: https://jsbin./junilaboqo/1/edit?js,output
本文标签: javascriptIs it possible to catch the right click event on a shapegroup in KonvaJSStack Overflow
版权声明:本文标题:javascript - Is it possible to catch the right click event on a shapegroup in KonvaJS? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744660933a2618242.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论