From 92522e9f09634abfa5b330fa75282d1dc4c62b26 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 18 Sep 2019 13:13:22 +0300 Subject: [PATCH 1/2] [SSE] Scale Settings --- .../main/app/view/ScaleDialog.js | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js index 69d913ce6..34ad019b1 100644 --- a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js @@ -129,15 +129,9 @@ define([ editable: true, data: this.arrDataScale, scrollAlwaysVisible: true - }).on('selected', _.bind(function (field) { - this._state.width = field.getValue(); - if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) { - this.radioScaleTo.setValue(true, true); - } else { - this.radioFitTo.setValue(true, true); - } - }, this)) - .on('changed:before', _.bind(this.onChangeComboScale, this, 'width')); + }).on('selected', _.bind(this.changeWidthHeight, this, 'width')) + .on('changed:after', _.bind(this.changeWidthHeight, this, 'width')) + .on('changed:before', _.bind(this.onChangeComboScale, this, 'width')); this.cmbScaleHeight = new Common.UI.ComboBox({ el: $('#scale-height'), @@ -147,15 +141,9 @@ define([ editable: true, data: this.arrDataScale, scrollAlwaysVisible: true - }).on('selected', _.bind(function (field) { - this._state.height = field.getValue(); - if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) { - this.radioScaleTo.setValue(true, true); - } else { - this.radioFitTo.setValue(true, true); - } - }, this)) - .on('changed:before', _.bind(this.onChangeComboScale, this, 'height')); + }).on('selected', _.bind(this.changeWidthHeight, this, 'height')) + .on('changed:after', _.bind(this.changeWidthHeight, this, 'height')) + .on('changed:before', _.bind(this.onChangeComboScale, this, 'height')); this.spnScale = new Common.UI.MetricSpinner({ el : $('#scale'), @@ -199,6 +187,26 @@ define([ return false; }, + changeWidthHeight: function (type, field) { + var value = field.getValue(); + if (typeof(value) === 'string') { + value = parseInt(value); + if (isNaN(value)) { + value = 0; + } + } + if (type === 'width') { + this._state.width = value; + } else { + this._state.height = value; + } + if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) { + this.radioScaleTo.setValue(true, true); + } else { + this.radioFitTo.setValue(true, true); + } + }, + onRadioScale: function(type, field, newValue) { if (type === 'scaleto') { this.cmbScaleHeight.setValue(0,true); From 10da1b3748e661402d0e001e61a024f1374bbac2 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 18 Sep 2019 13:23:25 +0300 Subject: [PATCH 2/2] [SSE] Scale to Fit (custom scale) --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 18d2cfa96..b5540e93f 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3414,7 +3414,6 @@ define([ } else if (scale < 10) { scale = 10; } - this.api.asc_SetPrintScale(0, 0, scale); this.onChangeScaleSettings(0, 0, scale); } },