digitalepidemiologylab / VaxGame

network-based vaccination game
81 stars 42 forks source link

MisClicks Resolved #13

Closed ells closed 10 years ago

ells commented 10 years ago

In the past, if you mouse-down and move before releasing (even the tiniest amount), default drag behavior skips over the "click" event and considers it a "drag".

Frustratingly, this resulted in quite a substantial proportion of vaccination/quarantine events being interpreted as drag events.

I have resolved this in the following way: mousedown --> mouseup = vaccinate/quarantine mousedown --> mousemove\ --> mouseup = conditional vaccinate/quarantine or drag

\ Click + mousemove <10px = vaccinate/quarantine * Click + mousemove > 10px = vaccinate/quarantine IF duration < 100ms * Click + mousemove > 10px = drag IF duration > 100ms

However, by measuring the velocity of the mouse (between mousedown and mouseup events), I can predict the player's intended action.