- // Update touch location
- last_touch_x = touch.screenX;
- last_touch_y = touch.screenY;
+ // If change in location passes threshold for scroll
+ if (Math.abs(delta_y) >= guac_mouse.scrollThreshold) {
+
+ // Decide button based on Y movement direction
+ var button;
+ if (delta_y > 0) button = "down";
+ else button = "up";
+
+ // Fire button down event
+ guac_mouse.currentState[button] = true;
+ if (guac_mouse.onmousedown)
+ guac_mouse.onmousedown(guac_mouse.currentState);
+
+ // Fire button up event
+ guac_mouse.currentState[button] = false;
+ if (guac_mouse.onmouseup)
+ guac_mouse.onmouseup(guac_mouse.currentState);
+
+ // Only update touch location after a scroll has been
+ // detected
+ last_touch_x = touch.screenX;
+ last_touch_y = touch.screenY;
+
+ }
+
+ }