From 5a51a8d85fd7f915ed44489059dec86d2c223220 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 26 Aug 2019 16:38:08 +0300 Subject: [PATCH] [SSE] Scale Dialog (set disabled) --- .../main/app/view/ScaleDialog.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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',