I am trying to implement code for different events on a shape which is dragged on to the paper element from stencil. pointerup event triggers a halo with options around the element. Double click event triggers some modal window and right click event triggers a custom context menu with click actions. How can i differentiate different events in Rappid like leftclick, rightclick, clicking on mouse wheel. I have code as below.
this.paper.on({
'element:pointerup': onElementClick,
//something like contextmenu
//'element:contextmenu': onElementRightClick,
});
This is a workaround i got from rappid for click and doubleclick.It is working but i am looking for rightclick functionality too. please, help.
paper.on({
'element:pointerdown': onElementClick
});
var clickTimerId;
function onElementClick(view) {
if (clickTimerId) {
// double click
window.clearTimeout(clickTimerId);
clickTimerId = null;
onElementDblClick(view);
} else {
// single click
clickTimerId = window.setTimeout(click, 200);
}
function click() {
clickTimerId = null;
// open halo and inspector here
}
}
function onElementDblClick(view) {
// open the modal window here
}