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

mouseup 500ms after mousedown

Hi everyone,

 

I'm trying to implement a "long press" (tap to do one thing, press and hold to put the watch into a different mode), but I'm running into an odd problem, at least with the simulator: if I click and hold, a mouseup event occurs about 500ms after the mousedown event, even if I don't release the mouse.

 

Here's the code I've added to the digital clock starter project:

  

// Event logging.
let mouseDownTime = null;
myLabel.onmousedown = () => {
  mouseDownTime = new Date();
  console.log ("mousedown at " + mouseDownTime.getTime());
};
myLabel.onmouseup = () => {
  let now = new Date();
  console.log ("mouseup at " + now.getTime() 
               + " elapsed " + (now.getTime() - mouseDownTime.getTime()))
};

 

A normal click and release produces the results you'd expect:

 

[10:44:48 PM]mousedown at 1533696288397
[10:44:48 PM]mouseup at 1533696288517 elapsed 120
 
but a click and hold consistently produces a mouseup at or just after 500ms from the mousedown:
 
[10:44:49 PM]mousedown at 1533696289929
[10:44:50 PM]mouseup at 1533696290429 elapsed 500
[10:44:52 PM]mousedown at 1533696292826
[10:44:53 PM]mouseup at 1533696293328 elapsed 502
[10:44:54 PM]mousedown at 1533696294687
[10:44:55 PM]mouseup at 1533696295187 elapsed 500
[10:44:56 PM]mousedown at 1533696296486
[10:44:56 PM]mouseup at 1533696296986 elapsed 500
 
It's as if a half-second timer is expiring.
I can work around it by setting the difference between a tap and a long press at about 250ms, but I was wondering if anyone else is running into something similar.
Best Answer
2 REPLIES 2

Dear Fitbit, could you please add a fix for this bug to your do-to list? Thanks!

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Wrong Post.

 

Best Answer
0 Votes