[DE mobile][PE mobile] Fix Bug 47163

[DE][PE] Fix spacing settings
This commit is contained in:
Julia Radzhabova 2020-10-29 13:03:01 +03:00
parent bc87d9a41d
commit 1311957fee
4 changed files with 50 additions and 19 deletions

View file

@ -207,7 +207,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingBefore);
@ -227,7 +228,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingAfter);
@ -756,8 +758,10 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', true);
this.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null;
this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
value = props.get_Spacing() ? props.get_Spacing().get_After() : null;
this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);

View file

@ -244,7 +244,7 @@ define([
if ($button.hasClass('decrement')) {
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(maxValue, distance + step);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
@ -273,7 +273,7 @@ define([
if ($button.hasClass('decrement')) {
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(maxValue, distance + step);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));

View file

@ -210,7 +210,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingBefore);
@ -230,7 +231,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingAfter);
@ -434,8 +436,10 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.cmbSpecial.setValue(this.CurSpecial);
this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null;
this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
value = props.get_Spacing() ? props.get_Spacing().get_After() : null;
this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);

View file

@ -415,35 +415,58 @@ define([
onDistanceBefore: function (e) {
var $button = $(e.currentTarget),
distance = _paragraphInfo.spaceBefore;
distance = _paragraphInfo.spaceBefore,
step,
maxValue;
if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) {
step = 1;
} else {
step = 0.01;
}
maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8);
if ($button.hasClass('decrement')) {
distance = Math.max(-1, --distance);
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(100, ++distance);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceBefore = distance;
$('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : (_paragraphInfo.spaceBefore) + ' ' + metricText);
$('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : distanceFix + ' ' + metricText);
this.api.put_LineSpacingBeforeAfter(0, (_paragraphInfo.spaceBefore < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceBefore));
},
onDistanceAfter: function (e) {
var $button = $(e.currentTarget),
distance = _paragraphInfo.spaceAfter;
distance = _paragraphInfo.spaceAfter,
step,
maxValue;
if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) {
step = 1;
} else {
step = 0.01;
}
maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8);
if ($button.hasClass('decrement')) {
distance = Math.max(-1, --distance);
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(100, ++distance);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceAfter = distance;
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : (_paragraphInfo.spaceAfter) + ' ' + metricText);
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : distanceFix + ' ' + metricText);
this.api.put_LineSpacingBeforeAfter(1, (_paragraphInfo.spaceAfter < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceAfter));
},