Automatically reposition event target on focus in case browser automatically centers...
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 8 Apr 2012 23:31:11 +0000 (16:31 -0700)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 8 Apr 2012 23:31:11 +0000 (16:31 -0700)
src/main/webapp/scripts/interface.js

index 3ad73fb..67640ed 100644 (file)
@@ -279,6 +279,15 @@ var GuacamoleUI = {
     GuacamoleUI.buttons.touchShowKeyboard.ontouchstart = 
     GuacamoleUI.buttons.touchShowKeyboard.onclick = 
         function(e) {
+
+            // Center event target in case browser automatically centers
+            // input fields on focus.
+            GuacamoleUI.eventTarget.style.left =
+                (window.pageXOffset + GuacamoleUI.viewport.offsetWidth / 2) + "px";
+
+            GuacamoleUI.eventTarget.style.top =
+                (window.pageYOffset + GuacamoleUI.viewport.offsetHeight / 2) + "px";
+
             GuacamoleUI.eventTarget.focus();
             GuacamoleUI.hideTouchMenu();
             e.preventDefault();