diff --git a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js
index 8fd42f8cc..313c596ff 100644
--- a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js
+++ b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js
@@ -56,6 +56,11 @@ define([
title: this.textTitle
}, options || {});
+ this._state = {
+ width: 'Auto',
+ height: 'Auto'
+ };
+
this.template = [
'
',
'
',
@@ -99,6 +104,10 @@ define([
minValue : 1,
allowAuto : true
});
+ this.spnScaleWidth.on('change', _.bind(function (field) {
+ this._state.width = field.getValue();
+ this.setDisabledScale();
+ }, this));
this.spnScaleHeight = new Common.UI.MetricSpinner({
el : $('#scale-height'),
@@ -110,6 +119,10 @@ define([
minValue : 1,
allowAuto : true
});
+ this.spnScaleHeight.on('change', _.bind(function (field) {
+ this._state.height = field.getValue();
+ this.setDisabledScale();
+ }, this));
this.spnScale = new Common.UI.MetricSpinner({
el : $('#scale'),
@@ -138,6 +151,15 @@ define([
this._handleInput(event.currentTarget.attributes['result'].value);
},
+ setDisabledScale: function() {
+ if (this._state.height !== 'Auto' || this._state.width !== 'Auto') {
+ this.spnScale.setValue('100 %');
+ this.spnScale.setDisabled(true);
+ } else {
+ this.spnScale.setDisabled(false);
+ }
+ },
+
textTitle: 'Scale Settings',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',