From e19b8f939720ec90e4fbac436993ba217f4bad9c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jan 2020 16:10:18 +0300 Subject: [PATCH] [DE] Bug 44021 (#322) --- .../main/app/view/PageMarginsDialog.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 2cb7a2b04..60ca60465 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -241,8 +241,24 @@ define([ this.cmbOrientation.on('selected', _.bind(function (combo, record) { if (this.api) { this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); - this.properties.put_Orientation(record.value); - this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + + if (this.properties.get_Orientation() !== record.value) { + this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(record.value ? this.spnLeft.getNumberValue() : this.spnRight.getNumberValue())); + this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(record.value ? this.spnRight.getNumberValue() : this.spnLeft.getNumberValue())); + this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(record.value ? this.spnBottom.getNumberValue() : this.spnTop.getNumberValue())); + this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(record.value ? this.spnTop.getNumberValue() : this.spnBottom.getNumberValue())); + + this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_TopMargin()), true); + this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_BottomMargin()), true); + this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_LeftMargin()), true); + this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_RightMargin()), true); + + var h = this.properties.get_H(); + this.properties.put_H(this.properties.get_W()); + this.properties.put_W(h); + this.properties.put_Orientation(record.value); + this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } } }, this)); @@ -356,6 +372,8 @@ define([ props.put_Gutter(Common.Utils.Metric.fnRecalcToMM(this.spnGutter.getNumberValue())); props.put_GutterAtTop(this.cmbGutterPosition.getValue() ? true : false); props.put_MirrorMargins(this.cmbMultiplePages.getValue() ? true : false); + props.put_H(this.properties.get_H()); + props.put_W(this.properties.get_W()); return props; },