diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index fd3b411d1..77e9dffbe 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -249,7 +249,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } if (this._changedProps) { this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); - this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnShapeHeight.getNumberValue())); + this.fillShapeHeight(); } }, this)); this.spinners.push(this.spnShapeWidth); @@ -276,7 +276,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } if (this._changedProps) { this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); - this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnShapeWidth.getNumberValue())); + this.fillShapeWidth(); } }, this)); this.spinners.push(this.spnShapeHeight); @@ -298,6 +298,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._changedProps.get_SizeRelH().put_Value(field.getNumberValue()); this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom); + + this.fillShapeHeight(); } }, this)); @@ -318,6 +320,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._changedProps.get_SizeRelV().put_Value(field.getNumberValue()); this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom); + + this.fillShapeWidth(); } }, this)); @@ -1772,6 +1776,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat if (this._changedProps) { this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnShapeWidth.getNumberValue())); this._changedProps.put_SizeRelH(undefined); + + this.fillShapeHeight(); } this.chRatio.setDisabled(this.radioVSizePc.getValue()); this.cmbWidthPc.setDisabled(true); @@ -1788,6 +1794,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()); this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom); + + this.fillShapeHeight(); } this.chRatio.setDisabled(true); this.cmbWidthPc.setDisabled(false); @@ -1801,6 +1809,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat if (this._changedProps) { this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnShapeHeight.getNumberValue())); this._changedProps.put_SizeRelV(undefined); + + this.fillShapeWidth(); } this.chRatio.setDisabled(this.radioHSizePc.getValue()); this.cmbHeightPc.setDisabled(true); @@ -1817,6 +1827,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()); this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom); + + this.fillShapeWidth(); } this.chRatio.setDisabled(true); this.cmbHeightPc.setDisabled(false); @@ -1833,6 +1845,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._state.ShapeWidthPcFrom = record.value; this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()); this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom); + + this.fillShapeHeight(); } }, @@ -1844,6 +1858,32 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._state.ShapeHeightPcFrom = record.value; this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()); this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom); + + this.fillShapeWidth(); + } + }, + + fillShapeWidth: function(combo, record){ + if (this.radioHSize.getValue()) + this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnShapeWidth.getNumberValue())); + else { + if (this._changedProps.get_SizeRelH()===null || this._changedProps.get_SizeRelH()===undefined) + this._changedProps.put_SizeRelH(new Asc.CImagePositionH()); + + this._changedProps.get_SizeRelH().put_Value(this.spnShapeWidthPc.getNumberValue()); + this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom); + } + }, + + fillShapeHeight: function(combo, record){ + if (this.radioVSize.getValue()) + this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnShapeHeight.getNumberValue())); + else { + if (this._changedProps.get_SizeRelV()===null || this._changedProps.get_SizeRelV()===undefined) + this._changedProps.put_SizeRelV(new Asc.CImagePositionV()); + + this._changedProps.get_SizeRelV().put_Value(this.spnShapeHeightPc.getNumberValue()); + this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom); } },