KineticJS: right click fires click

events, jquery, kineticjs, rect, right-click

Solution

You need to filter out right mouse click

this.rect.on('click tap', function(e){ 
   // 1:left, 2: middle, 3: right, for IE 8, e.button != 2
   if (e.which != 3) {
      foo();
   }
}

Problem

I'm using Kineticjs and I'm defining a rect event like this ``` this.rect.on('click tap', function(){ foo(); }); ``` The event is fired when I left-click, but also when right-click. How can I avoid to fire this event with right-click? (I can't disabled the right-click in the page because I want to open a context menu if I rightclick over the rect) Thank you

Original source