From 1ea2d40c198cbaf71981129fe0e7a813ad18b685 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 29 Jan 2015 12:54:38 -0800 Subject: [PATCH 1/2] GUAC-958: Adjust viewport height based purely on scroll state. Manually scroll if we suspect doing so may result in height adjustments. --- .../webapp/app/client/directives/guacViewport.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/directives/guacViewport.js b/guacamole/src/main/webapp/app/client/directives/guacViewport.js index b75549c9d..b3d97bf32 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacViewport.js +++ b/guacamole/src/main/webapp/app/client/directives/guacViewport.js @@ -31,8 +31,8 @@ angular.module('client').directive('guacViewport', [function guacViewport() { scope: {}, transclude: true, templateUrl: 'app/client/templates/guacViewport.html', - controller: ['$scope', '$window', '$document', '$element', - function guacViewportController($scope, $window, $document, $element) { + controller: ['$scope', '$interval', '$window', '$document', '$element', + function guacViewportController($scope, $interval, $window, $document, $element) { /** * The fullscreen container element. @@ -69,7 +69,7 @@ angular.module('client').directive('guacViewport', [function guacViewport() { var scrollHeight = document.body.scrollHeight; // Calculate new height - var adjustedHeight = $window.innerHeight - scrollTop; + var adjustedHeight = scrollHeight - scrollTop; // Only update if not in response to our own call to scrollTo() if (scrollLeft !== scrollWidth && scrollTop !== scrollHeight @@ -84,14 +84,22 @@ angular.module('client').directive('guacViewport', [function guacViewport() { } + // Manually attempt scroll if height has not been adjusted + else if (adjustedHeight === 0) + $window.scrollTo(scrollWidth, scrollHeight); + }; // Fit container within visible region when window scrolls $window.addEventListener('scroll', fitVisibleArea); - // Clean up event listener on destroy + // Poll every 10ms, in case scroll event does not fire + var pollArea = $interval(fitVisibleArea, 10); + + // Clean up on destruction $scope.$on('$destroy', function destroyViewport() { $window.removeEventListener('scroll', fitVisibleArea); + $interval.cancel(pollArea); }); }] From 03f0e22199a17cf3d60c131b05aca65ba5e92e9c Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 29 Jan 2015 14:22:25 -0800 Subject: [PATCH 2/2] GUAC-958: Work around iOS 7 visibility issue (text input UI invisible - apparently miscalculated by Safari as obscured by the iframe). --- .../src/main/webapp/app/client/templates/guacClient.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/templates/guacClient.html b/guacamole/src/main/webapp/app/client/templates/guacClient.html index 30e5d606d..a27a03c4c 100644 --- a/guacamole/src/main/webapp/app/client/templates/guacClient.html +++ b/guacamole/src/main/webapp/app/client/templates/guacClient.html @@ -21,15 +21,17 @@ THE SOFTWARE. --> - - -
+ + + +
+
\ No newline at end of file