Finished edit peresentationeditor

This commit is contained in:
OVSharova 2021-07-10 05:04:10 +03:00
parent af6e58fd87
commit d4574ef39c
5 changed files with 59 additions and 56 deletions

View file

@ -554,15 +554,13 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if(spinner.el.id != 'paragraphadv-spin-spacing-before' && spinner.el.id != 'paragraphadv-spin-spacing-after')
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-position' )
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position')
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else if( spinner.el.id == 'paragraph-spin-spacing-before' || spinner.el.id == 'paragraph-spin-spacing-after'){
else if( spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
spinner.setStep(1);
spinner.setDefaultUnit( Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
}
else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
}

View file

@ -943,14 +943,13 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if(spinner.el.id != 'paragraphadv-spin-spacing-before' && spinner.el.id != 'paragraphadv-spin-spacing-after')
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position')
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else if( spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after'){
else if( spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
spinner.setStep(1);
spinner.setDefaultUnit( Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
}
else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
}

View file

@ -100,7 +100,7 @@ define([
if ( this.cmbLineRule.getRawValue() === '' )
return;
if (this.api)
this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
},
onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){
@ -109,7 +109,7 @@ define([
if (num<0)
this.api.put_LineSpacingBeforeAfter(0, -1);
else
this.api.put_LineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this.api.put_LineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
}
},
@ -119,7 +119,7 @@ define([
if (num<0)
this.api.put_LineSpacingBeforeAfter(1, -1);
else
this.api.put_LineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this.api.put_LineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
}
},
@ -155,7 +155,7 @@ define([
if ( linerule == c_paragraphLinerule.LINERULE_AUTO ) {
val = line;
} else if (linerule !== null && line !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(line);
val = Common.Utils.Metric.fnRecalcFromMM(line, Common.Utils.Metric.c_MetricUnits.pt);
}
this.numLineHeight.setValue((val !== null) ? val : '', true);
@ -199,7 +199,7 @@ define([
if ( Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO ) {
val = Spacing.Line;
} else if (Spacing.LineRule !== null && Spacing.Line !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line);
val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line, Common.Utils.Metric.c_MetricUnits.pt);
}
this.numLineHeight.setValue((val !== null) ? val : '', true);
@ -209,14 +209,14 @@ define([
if ( Math.abs(this._state.LineSpacingBefore-Spacing.Before)>0.001 ||
(this._state.LineSpacingBefore===null || Spacing.Before===null)&&(this._state.LineSpacingBefore!==Spacing.Before)) {
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before<0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before) ) : '', true);
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before<0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
this._state.LineSpacingBefore=Spacing.Before;
}
if ( Math.abs(this._state.LineSpacingAfter-Spacing.After)>0.001 ||
(this._state.LineSpacingAfter===null || Spacing.After===null)&&(this._state.LineSpacingAfter!==Spacing.After)) {
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After<0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After) ) : '', true);
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After<0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
this._state.LineSpacingAfter=Spacing.After;
}
}
@ -226,19 +226,19 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
//spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
//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);
this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
val = this._state.LineSpacingAfter;
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true);
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
}
if (this.cmbLineRule) {
var rec = this.cmbLineRule.store.at(1);
rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
/*rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01});
step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01});**/
if (this._state.LineRule !== null) {
var obj;
@ -250,7 +250,7 @@ define([
if ( this._state.LineRule == c_paragraphLinerule.LINERULE_AUTO ) {
val = this._state.LineHeight;
} else if (this._state.LineHeight !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight);
val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight, Common.Utils.Metric.c_MetricUnits.pt);
}
this.numLineHeight && this.numLineHeight.setValue((val !== null) ? val : '', true);
}
@ -261,7 +261,7 @@ define([
var me = this;
this._arrLineRule = [
{displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''},
{displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}
{displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 1, defaultUnit: 'pt'}
];
// Short Size
@ -288,11 +288,11 @@ define([
this.numSpacingBefore = new Common.UI.MetricSpinner({
el: $('#paragraph-spin-spacing-before'),
step: .1,
step: 1,
width: 85,
value: '0 cm',
defaultUnit : "cm",
maxValue: 55.88,
value: '0 pt',
defaultUnit : "pt",
maxValue: 1584,
minValue: 0,
allowAuto : true,
autoText : this.txtAutoText
@ -302,11 +302,11 @@ define([
this.numSpacingAfter = new Common.UI.MetricSpinner({
el: $('#paragraph-spin-spacing-after'),
step: .1,
step: 1,
width: 85,
value: '0.35 cm',
defaultUnit : "cm",
maxValue: 55.88,
value: '0.35 pt',
defaultUnit : "pt",
maxValue: 1584,
minValue: 0,
allowAuto : true,
autoText : this.txtAutoText

View file

@ -83,7 +83,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this._arrLineRule = [
{displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''},
{displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}
{displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 1, defaultUnit: 'pt'}
];
var curLineRule = this._originalProps.get_Spacing().get_LineRule(),
@ -198,11 +198,11 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.numSpacingBefore = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-spacing-before'),
step: .1,
step: 1,
width: 85,
value: '',
defaultUnit : "cm",
maxValue: 55.88,
defaultUnit : "pt",
maxValue: 1584,
minValue: 0,
allowAuto : true,
autoText : this.txtAutoText
@ -213,17 +213,17 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.Spacing = properties.get_Spacing();
}
var value = field.getNumberValue();
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value,Common.Utils.Metric.c_MetricUnits.pt));
}, this));
this.spinners.push(this.numSpacingBefore);
this.numSpacingAfter = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-spacing-after'),
step: .1,
step: 1,
width: 85,
value: '',
defaultUnit : "cm",
maxValue: 55.88,
defaultUnit : "pt",
maxValue: 1584,
minValue: 0,
allowAuto : true,
autoText : this.txtAutoText
@ -234,7 +234,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.Spacing = properties.get_Spacing();
}
var value = field.getNumberValue();
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value, Common.Utils.Metric.c_MetricUnits.pt));
}, this));
this.spinners.push(this.numSpacingAfter);
@ -476,15 +476,15 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', 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);
this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value, Common.Utils.Metric.c_MetricUnits.pt)) : '', 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);
this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value, Common.Utils.Metric.c_MetricUnits.pt)) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);
if(props.get_Spacing() !== null && props.get_Spacing().get_Line() !== null) {
this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.get_Spacing().get_Line() : Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Line()), true);
this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.get_Spacing().get_Line() : Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Line(), Common.Utils.Metric.c_MetricUnits.pt), true);
} else {
this.numLineHeight.setValue('', true);
}
@ -535,16 +535,21 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
if(spinner.el.id != 'paragraphadv-spin-spacing-before' && spinner.el.id != 'paragraphadv-spin-spacing-after' && spinner.el.id != 'paragraphadv-spin-line-height')
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else if(spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
spinner.setStep(1);
else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
}
}
this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
/*this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
this._arrLineRule[1].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01;
this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01;*/
if (this.CurLineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step);
@ -796,7 +801,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
if (this.Spacing.get_LineRule() === c_paragraphLinerule.LINERULE_AUTO) {
this.numLineHeight.setValue(this._arrLineRule[indexSelectItem].defaultValue);
} else {
this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[indexSelectItem].defaultValue));
this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[indexSelectItem].defaultValue, Common.Utils.Metric.c_MetricUnits.pt));
}
this.CurLineRuleIdx = indexSelectItem;
}
@ -809,7 +814,7 @@ 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_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
},
textTitle: 'Paragraph - Advanced Settings',

View file

@ -532,7 +532,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
var spinner = this.spinners[i];
if(spinner.el.id != 'paragraphadv-spin-spacing-before' && spinner.el.id != 'paragraphadv-spin-spacing-after'&& spinner.el.id != 'paragraphadv-spin-line-height')
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
else if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' )
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);