Merge pull request #647 from ONLYOFFICE/fix/bugfix
Fix changing units of measurement.
This commit is contained in:
commit
0c443a3c56
|
@ -185,6 +185,7 @@ define([
|
||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
});
|
});
|
||||||
this.lockedControls.push(this.spnWidth);
|
this.lockedControls.push(this.spnWidth);
|
||||||
|
this.spinners.push(this.spnWidth);
|
||||||
this.spnWidth.on('change', this.onWidthChange.bind(this));
|
this.spnWidth.on('change', this.onWidthChange.bind(this));
|
||||||
this.spnWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
|
this.spnWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ define([
|
||||||
formTextPr.put_MaxCharacters(this.spnMaxChars.getNumberValue() || 10);
|
formTextPr.put_MaxCharacters(this.spnMaxChars.getNumberValue() || 10);
|
||||||
if (this.spnWidth.getValue()) {
|
if (this.spnWidth.getValue()) {
|
||||||
var value = this.spnWidth.getNumberValue();
|
var value = this.spnWidth.getNumberValue();
|
||||||
formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4));
|
formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4 + 0.1));
|
||||||
} else
|
} else
|
||||||
formTextPr.put_Width(0);
|
formTextPr.put_Width(0);
|
||||||
}
|
}
|
||||||
|
@ -423,7 +424,7 @@ define([
|
||||||
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
|
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
|
||||||
if (this.spnWidth.getValue()) {
|
if (this.spnWidth.getValue()) {
|
||||||
var value = this.spnWidth.getNumberValue();
|
var value = this.spnWidth.getNumberValue();
|
||||||
formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4));
|
formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4 + 0.1));
|
||||||
} else
|
} else
|
||||||
formTextPr.put_Width(0);
|
formTextPr.put_Width(0);
|
||||||
|
|
||||||
|
@ -783,8 +784,11 @@ define([
|
||||||
for (var i=0; i<this.spinners.length; i++) {
|
for (var i=0; i<this.spinners.length; i++) {
|
||||||
var spinner = this.spinners[i];
|
var spinner = this.spinners[i];
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
var val = this._state.Width;
|
||||||
|
this.spnWidth && this.spnWidth.setMinValue(Common.Utils.Metric.fnRecalcFromMM(1));
|
||||||
|
this.spnWidth && this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
||||||
}
|
}
|
||||||
|
this.numPosition && this.numPosition.setValue(Common.Utils.Metric.fnRecalcFromMM(this._state.Position), true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,13 @@ define([
|
||||||
if (this._state.LineRuleIdx !== null) {
|
if (this._state.LineRuleIdx !== null) {
|
||||||
this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit);
|
this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit);
|
||||||
this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step);
|
this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step);
|
||||||
|
this.numLineHeight && this.numLineHeight.setValue((this._state.LineHeight !== null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight) : '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var val = this._state.LineSpacingBefore;
|
||||||
|
this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
|
val = this._state.LineSpacingAfter;
|
||||||
|
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
createDelayedElements: function() {
|
createDelayedElements: function() {
|
||||||
|
|
|
@ -577,6 +577,10 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
var val = this._state.Width;
|
||||||
|
this.numWidth && this.numWidth.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
|
val = this._state.Height;
|
||||||
|
this.numHeight && this.numHeight.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,8 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
this.spnWidth && this.spnWidth.setValue((this._state.Width!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Width) : '', true);
|
||||||
|
this.spnHeight && this.spnHeight.setValue((this._state.Height!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Height) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,10 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
||||||
}
|
}
|
||||||
|
var val = this._state.LineSpacingBefore;
|
||||||
|
this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
|
val = this._state.LineSpacingAfter;
|
||||||
|
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
}
|
}
|
||||||
if (this.cmbLineRule) {
|
if (this.cmbLineRule) {
|
||||||
var rec = this.cmbLineRule.store.at(1);
|
var rec = this.cmbLineRule.store.at(1);
|
||||||
|
@ -242,6 +246,7 @@ define([
|
||||||
if (!rec) rec = this.cmbLineRule.store.at(0);
|
if (!rec) rec = this.cmbLineRule.store.at(0);
|
||||||
this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
|
this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
|
||||||
this.numLineHeight.setStep(rec.get('step'));
|
this.numLineHeight.setStep(rec.get('step'));
|
||||||
|
this.numLineHeight && this.numLineHeight.setValue((this._state.LineHeight !== null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight) : '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -538,6 +538,10 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
var val = this._state.Width;
|
||||||
|
this.numWidth && this.numWidth.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
|
val = this._state.Height;
|
||||||
|
this.numHeight && this.numHeight.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -515,6 +515,8 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
this.spnWidth && this.spnWidth.setValue((this._state.Width!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Width) : '', true);
|
||||||
|
this.spnHeight && this.spnHeight.setValue((this._state.Height!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Height) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,8 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
this.spnWidth && this.spnWidth.setValue((this._state.Width!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Width) : '', true);
|
||||||
|
this.spnHeight && this.spnHeight.setValue((this._state.Height!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Height) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,10 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
|
||||||
}
|
}
|
||||||
|
var val = this._state.LineSpacingBefore;
|
||||||
|
this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
|
val = this._state.LineSpacingAfter;
|
||||||
|
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
|
||||||
}
|
}
|
||||||
if (this.cmbLineRule) {
|
if (this.cmbLineRule) {
|
||||||
var rec = this.cmbLineRule.store.at(1);
|
var rec = this.cmbLineRule.store.at(1);
|
||||||
|
@ -245,7 +249,7 @@ define([
|
||||||
if (!rec) rec = this.cmbLineRule.store.at(0);
|
if (!rec) rec = this.cmbLineRule.store.at(0);
|
||||||
this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
|
this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
|
||||||
this.numLineHeight.setStep(rec.get('step'));
|
this.numLineHeight.setStep(rec.get('step'));
|
||||||
|
this.numLineHeight && this.numLineHeight.setValue((this._state.LineHeight !== null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight) : '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -122,6 +122,14 @@ define([
|
||||||
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
||||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||||
}
|
}
|
||||||
|
this.spnWidth && this.spnWidth.setValue((this._state.Width!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Width) : '', true);
|
||||||
|
this.spnHeight && this.spnHeight.setValue((this._state.Height!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.Height) : '', true);
|
||||||
|
this.spnColWidth && this.spnColWidth.setValue((this._state.ColWidth!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.ColWidth) : '', true);
|
||||||
|
this.spnColHeight && this.spnColHeight.setValue((this._state.ColHeight!==null) ? Common.Utils.Metric.fnRecalcFromMM(this._state.ColHeight) : '', true);
|
||||||
|
var val = this._state.PosHor;
|
||||||
|
this.spnHor && this.spnHor.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
|
val = this._state.PosVert;
|
||||||
|
this.spnVert && this.spnVert.setValue((val !== null && val !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -436,9 +444,12 @@ define([
|
||||||
var Position = {X: value.get_X(), Y: value.get_Y()};
|
var Position = {X: value.get_X(), Y: value.get_Y()};
|
||||||
this.spnHor.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true);
|
this.spnHor.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true);
|
||||||
this.spnVert.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true);
|
this.spnVert.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true);
|
||||||
|
this._state.PosHor = Position.X;
|
||||||
|
this._state.PosVert = Position.Y;
|
||||||
} else {
|
} else {
|
||||||
this.spnHor.setValue('', true);
|
this.spnHor.setValue('', true);
|
||||||
this.spnVert.setValue('', true);
|
this.spnVert.setValue('', true);
|
||||||
|
this._state.PosHor = this._state.PosVert = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var slicerprops = props.asc_getSlicerProperties();
|
var slicerprops = props.asc_getSlicerProperties();
|
||||||
|
|
Loading…
Reference in a new issue