From 88e88ebc04b18979cc6d0cc5ee4a2e54ffe6b5b1 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 22 May 2012 11:12:44 -0700 Subject: [PATCH] First basic absolute pointer implementation. --- src/main/resources/mouse.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mouse.js b/src/main/resources/mouse.js index 124fca7..6b39a0a 100644 --- a/src/main/resources/mouse.js +++ b/src/main/resources/mouse.js @@ -604,7 +604,9 @@ Guacamole.Mouse.Touchscreen = function(element) { e.stopPropagation(); e.preventDefault(); - // TODO: STUB + // Fire release event when the last touch is released, if event defined + if (e.touches.length == 0 && guac_touchscreen.onmouseup) + guac_touchscreen.onmouseup(guac_touchscreen.currentState); }, false); @@ -613,7 +615,17 @@ Guacamole.Mouse.Touchscreen = function(element) { e.stopPropagation(); e.preventDefault(); - // TODO: STUB + // Get touch + var touch = e.touches[0]; + + // Update state + guac_touchscreen.currentstate.x = touch.clientX; + guac_touchscreen.currentstate.y = touch.clientY; + + // Fire press event, if defined + if (guac_touchscreen.onmousedown) + guac_touchscreen.onmousedown(guac_touchscreen.currentState); + }, false); @@ -622,7 +634,16 @@ Guacamole.Mouse.Touchscreen = function(element) { e.stopPropagation(); e.preventDefault(); - // TODO: STUB + // Get touch + var touch = e.touches[0]; + + // Update state + guac_touchscreen.currentstate.x = touch.clientX; + guac_touchscreen.currentstate.y = touch.clientY; + + // Fire movement event, if defined + if (guac_touchscreen.onmousemove) + guac_touchscreen.onmousemove(guac_touchscreen.currentState); }, false); -- 1.7.10.4