Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Doubleclick or doubletap

How do you listen a doubleclick or doubletap ?

I know I can use single click:

 

myRect.onclick = function(e) {
  console.log("click");
}

But how to achieve doubleclick listening?

I tried:

myRect.ondblclick = function(e) {
  console.log("double click");
}

 but with no success.

Best Answer
0 Votes
1 REPLY 1

I don't think the API directly supports this. I've managed to fudge it by setting a JS timer when a click is detected. If a second click occurs before the timer expires, I call it a double-click. If not, I call it a single click. Aside from being a bit cumbersome to code, this also slightly reduces the responsiveness of single clicks, but if you need double-clicks, ...

 

Another thing you can consider if you need extra user input is simultaneous (or nearly so) clicks of both RHS buttons.

Peter McLennan
Gondwana Software
Best Answer