Update cursor position when cursor image/hotspot is updated.
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Thu, 23 Feb 2012 19:22:15 +0000 (11:22 -0800)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Thu, 23 Feb 2012 19:22:15 +0000 (11:22 -0800)
src/main/resources/guacamole.js

index 7f474ac..ea5f875 100644 (file)
@@ -123,6 +123,9 @@ Guacamole.Client = function(tunnel) {
     var cursorHotspotX = 0;
     var cursorHotspotY = 0;
 
+    var cursorX = 0;
+    var cursorY = 0;
+
     function moveCursor(x, y) {
 
         var element = cursor.getElement();
@@ -131,6 +134,10 @@ Guacamole.Client = function(tunnel) {
         element.style.left = (x - cursorHotspotX) + "px";
         element.style.top  = (y - cursorHotspotY) + "px";
 
+        // Update stored position
+        cursorX = x;
+        cursorY = y;
+
     }
 
     guac_client.getDisplay = function() {
@@ -440,7 +447,8 @@ Guacamole.Client = function(tunnel) {
                 0 
             );
 
-            // FIXME: Update cursor position when hotspot changes
+            // Update cursor position (hotspot may have changed)
+            moveCursor(cursorX, cursorY);
 
         },