mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-152: Handle zoom changes with autoFit correctly.
This commit is contained in:
@@ -742,6 +742,16 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
||||
$scope.client.clientProperties.scale -= 0.1;
|
||||
};
|
||||
|
||||
/**
|
||||
* When zoom is manually set by entering a value
|
||||
* into the controller, this method turns off autoFit,
|
||||
* both in the menu and the clientProperties.
|
||||
*/
|
||||
$scope.zoomSet = function zoomSet() {
|
||||
$scope.menu.autoFit = false;
|
||||
$scope.client.clientProperties.autoFit = false;
|
||||
};
|
||||
|
||||
$scope.changeAutoFit = function changeAutoFit() {
|
||||
if ($scope.menu.autoFit && $scope.client.clientProperties.minScale) {
|
||||
$scope.client.clientProperties.autoFit = true;
|
||||
|
@@ -26,7 +26,13 @@ angular.module('client').directive('guacZoomCtrl', function guacZoomCtrl() {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
priority: 101,
|
||||
link: function(scope, element, attr, ngModel) {
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
|
||||
// Evaluate the ngChange attribute when the model
|
||||
// changes.
|
||||
ngModel.$viewChangeListeners.push(function() {
|
||||
scope.$eval(attrs.ngChange);
|
||||
});
|
||||
|
||||
// When pushing to the menu, mutiply by 100.
|
||||
ngModel.$formatters.push(function(value) {
|
||||
|
@@ -154,7 +154,8 @@
|
||||
<div class="zoom-ctrl">
|
||||
<input type="number" class="zoom-ctrl" guac-zoom-ctrl
|
||||
ng-model="client.clientProperties.scale"
|
||||
ng-model-options="{ updateOn: 'blur submit' }" />%
|
||||
ng-model-options="{ updateOn: 'blur submit' }"
|
||||
ng-change="zoomSet();" />%
|
||||
</div>
|
||||
<div ng-click="zoomIn()" id="zoom-in"><img src="images/settings/zoom-in.png" alt="+"/></div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user