mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
Alter viewportClone into actual scrollable viewport, where all previously fixed elements are now absolute. Fixes issues on iPad and other tablets where reflowing of page did not reflow touch areas. Fixes issue where typing via native OSK automatically scrolled up to the top of the view.
This commit is contained in:
@@ -23,7 +23,7 @@ var GuacamoleUI = {
|
||||
|
||||
/* UI Elements */
|
||||
|
||||
"viewport" : document.getElementById("viewportClone"),
|
||||
"viewport" : document.getElementById("viewport"),
|
||||
"display" : document.getElementById("display"),
|
||||
"menu" : document.getElementById("menu"),
|
||||
"menuControl" : document.getElementById("menuControl"),
|
||||
@@ -463,10 +463,14 @@ GuacamoleUI.attach = function(guac) {
|
||||
var mouse = new Guacamole.Mouse(guac_display);
|
||||
mouse.onmousedown = mouse.onmouseup = mouse.onmousemove =
|
||||
function(mouseState) {
|
||||
|
||||
|
||||
// Get current viewport scroll
|
||||
var scroll_x = GuacamoleUI.viewport.scrollLeft;
|
||||
var scroll_y = GuacamoleUI.viewport.scrollTop;
|
||||
|
||||
// Determine mouse position within view
|
||||
var mouse_view_x = mouseState.x + guac_display.offsetLeft - window.pageXOffset;
|
||||
var mouse_view_y = mouseState.y + guac_display.offsetTop - window.pageYOffset;
|
||||
var mouse_view_x = mouseState.x + guac_display.offsetLeft - scroll_x;
|
||||
var mouse_view_y = mouseState.y + guac_display.offsetTop - scroll_y;
|
||||
|
||||
// Determine viewport dimensioins
|
||||
var view_width = GuacamoleUI.viewport.offsetWidth;
|
||||
@@ -491,7 +495,8 @@ GuacamoleUI.attach = function(guac) {
|
||||
scroll_amount_y = 0;
|
||||
|
||||
// Scroll (if necessary) to keep mouse on screen.
|
||||
window.scrollBy(scroll_amount_x, scroll_amount_y);
|
||||
GuacamoleUI.viewport.scrollLeft += scroll_amount_x;
|
||||
GuacamoleUI.viewport.scrollTop += scroll_amount_y;
|
||||
|
||||
// Send mouse event
|
||||
guac.sendMouseState(mouseState);
|
||||
|
Reference in New Issue
Block a user