[DE mobile] [SSE mobile] Refactoring commits

This commit is contained in:
Julia Svinareva 2019-04-29 18:17:50 +03:00
parent 46409ac45d
commit 9450c4ac67
3 changed files with 21 additions and 28 deletions

View file

@ -259,10 +259,10 @@ define([
me.maxMarginsH = me.localSectionProps.get_H() - 26; me.maxMarginsH = me.localSectionProps.get_H() - 26;
me.maxMarginsW = me.localSectionProps.get_W() - 127; me.maxMarginsW = me.localSectionProps.get_W() - 127;
var top = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_TopMargin())).toFixed(2)), var top = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_TopMargin()).toFixed(2)),
bottom = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_BottomMargin())).toFixed(2)), bottom = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_BottomMargin()).toFixed(2)),
left = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_LeftMargin())).toFixed(2)), left = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_LeftMargin()).toFixed(2)),
right = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_RightMargin())).toFixed(2)); right = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_RightMargin()).toFixed(2));
$('#document-margin-top .item-after label').text(top + ' ' + _metricText); $('#document-margin-top .item-after label').text(top + ' ' + _metricText);
$('#document-margin-bottom .item-after label').text(bottom + ' ' + _metricText); $('#document-margin-bottom .item-after label').text(bottom + ' ' + _metricText);
@ -321,8 +321,8 @@ define([
// Init format // Init format
$pageSize.find('.item-title').text(_pageSizes[_pageSizesIndex]['caption']); $pageSize.find('.item-title').text(_pageSizes[_pageSizesIndex]['caption']);
var curMetricName = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric()), var curMetricName = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric()),
sizeW = +(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][0]).toFixed(2)), sizeW = parseFloat(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][0]).toFixed(2)),
sizeH = +(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][1]).toFixed(2)); sizeH = parseFloat(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][1]).toFixed(2));
var pageSizeTxt = sizeW + ' ' + curMetricName + ' x ' + sizeH + ' ' + curMetricName; var pageSizeTxt = sizeW + ' ' + curMetricName + ' x ' + sizeH + ' ' + curMetricName;
$pageSize.find('.item-subtitle').text(pageSizeTxt); $pageSize.find('.item-subtitle').text(pageSizeTxt);
@ -564,7 +564,7 @@ define([
case 'bottom': me.localSectionProps.put_BottomMargin(marginValue); break; case 'bottom': me.localSectionProps.put_BottomMargin(marginValue); break;
} }
var valueCurrentMetric = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(marginValue)).toFixed(2)); var valueCurrentMetric = parseFloat(Common.Utils.Metric.fnRecalcFromMM(marginValue).toFixed(2));
$(Common.Utils.String.format('#document-margin-{0} .item-after label', align)).text(valueCurrentMetric + ' ' + _metricText); $(Common.Utils.String.format('#document-margin-{0} .item-after label', align)).text(valueCurrentMetric + ' ' + _metricText);
me.applyPageMarginsIfNeed() me.applyPageMarginsIfNeed()

View file

@ -144,15 +144,15 @@ define([
if (_paragraphProperty.get_Ind()===null || _paragraphProperty.get_Ind()===undefined) { if (_paragraphProperty.get_Ind()===null || _paragraphProperty.get_Ind()===undefined) {
_paragraphProperty.get_Ind().put_FirstLine(0); _paragraphProperty.get_Ind().put_FirstLine(0);
} }
var firstLineFix = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(_paragraphProperty.get_Ind().get_FirstLine())).toFixed(2)); var firstLineFix = parseFloat(Common.Utils.Metric.fnRecalcFromMM(_paragraphProperty.get_Ind().get_FirstLine()).toFixed(2));
$('#paragraph-spin-first-line .item-after label').text(firstLineFix + ' ' + metricText); $('#paragraph-spin-first-line .item-after label').text(firstLineFix + ' ' + metricText);
} }
if (_paragraphObject) { if (_paragraphObject) {
_paragraphInfo.spaceBefore = _paragraphObject.get_Spacing().get_Before() < 0 ? _paragraphObject.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_Before()); _paragraphInfo.spaceBefore = _paragraphObject.get_Spacing().get_Before() < 0 ? _paragraphObject.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_Before());
_paragraphInfo.spaceAfter = _paragraphObject.get_Spacing().get_After() < 0 ? _paragraphObject.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_After()); _paragraphInfo.spaceAfter = _paragraphObject.get_Spacing().get_After() < 0 ? _paragraphObject.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_After());
var distanceBeforeFix = +(parseFloat(_paragraphInfo.spaceBefore).toFixed(2)); var distanceBeforeFix = parseFloat(_paragraphInfo.spaceBefore.toFixed(2));
var distanceAfterFix = +(parseFloat(_paragraphInfo.spaceAfter).toFixed(2)); var distanceAfterFix = parseFloat(_paragraphInfo.spaceAfter.toFixed(2));
$('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : distanceBeforeFix + ' ' + metricText); $('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : distanceBeforeFix + ' ' + metricText);
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : distanceAfterFix + ' ' + metricText); $('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : distanceAfterFix + ' ' + metricText);
@ -253,7 +253,7 @@ define([
distance = Math.min(maxValue, distance + step); distance = Math.min(maxValue, distance + step);
} }
var distanceFix = +(distance.toFixed(2)); var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceBefore = distance; _paragraphInfo.spaceBefore = distance;
@ -282,7 +282,7 @@ define([
distance = Math.min(maxValue, distance + step); distance = Math.min(maxValue, distance + step);
} }
var distanceFix = +(distance.toFixed(2)); var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceAfter = distance; _paragraphInfo.spaceAfter = distance;
@ -314,7 +314,7 @@ define([
distance = Math.min(maxValue, distance + step); distance = Math.min(maxValue, distance + step);
} }
var distanceFix = +(distance.toFixed(2)); var distanceFix = parseFloat(distance.toFixed(2));
$('#paragraph-spin-first-line .item-after label').text(distanceFix + ' ' + metricText); $('#paragraph-spin-first-line .item-after label').text(distanceFix + ' ' + metricText);

View file

@ -111,8 +111,6 @@ define([
setApi: function (api) { setApi: function (api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onSendThemeColorSchemes, this)); this.api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onSendThemeColorSchemes, this));
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.sheetChanged, this));
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', _.bind(this.sheetChanged, this));
}, },
onLaunch: function () { onLaunch: function () {
@ -219,7 +217,7 @@ define([
$switchHideHeadings.single('change', _.bind(me.clickCheckboxHideHeadings, me)); $switchHideHeadings.single('change', _.bind(me.clickCheckboxHideHeadings, me));
$switchHideGridlines.single('change', _.bind(me.clickCheckboxHideGridlines, me)); $switchHideGridlines.single('change', _.bind(me.clickCheckboxHideGridlines, me));
var params = me.sheetChanged(); var params = me.api.asc_getSheetViewSettings();
$switchHideHeadings.prop('checked',!params.asc_getShowRowColHeaders()); $switchHideHeadings.prop('checked',!params.asc_getShowRowColHeaders());
$switchHideGridlines.prop('checked',!params.asc_getShowGridLines()); $switchHideGridlines.prop('checked',!params.asc_getShowGridLines());
@ -227,7 +225,7 @@ define([
var currentSheet = this.api.asc_getActiveWorksheetIndex(), var currentSheet = this.api.asc_getActiveWorksheetIndex(),
props = this.api.asc_getPageOptions(currentSheet), props = this.api.asc_getPageOptions(currentSheet),
opt = props.asc_getPageSetup(); opt = props.asc_getPageSetup();
if(Number(opt.asc_getOrientation()) === 0) { if(opt.asc_getOrientation() === Asc.c_oAscPageOrientation.PagePortrait) {
$('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="0"]').prop( "checked", true ); $('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="0"]').prop( "checked", true );
} else { } else {
$('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="1"]').prop( "checked", true ); $('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="1"]').prop( "checked", true );
@ -244,8 +242,8 @@ define([
Common.Utils.Metric.setCurrentMetric(valueUnit); Common.Utils.Metric.setCurrentMetric(valueUnit);
var curMetricName = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric()), var curMetricName = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric()),
sizeW = +(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][0]).toFixed(2)), sizeW = parseFloat(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][0]).toFixed(2)),
sizeH = +(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][1]).toFixed(2)); sizeH = parseFloat(Common.Utils.Metric.fnRecalcFromMM(_pageSizes[_pageSizesIndex]['value'][1]).toFixed(2));
var pageSizeTxt = sizeW + ' ' + curMetricName + ' x ' + sizeH + ' ' + curMetricName; var pageSizeTxt = sizeW + ' ' + curMetricName + ' x ' + sizeH + ' ' + curMetricName;
$pageSize.find('.item-subtitle').text(pageSizeTxt); $pageSize.find('.item-subtitle').text(pageSizeTxt);
@ -286,10 +284,10 @@ define([
_metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric()); _metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric());
var left = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getLeft())).toFixed(2)), var left = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getLeft()).toFixed(2)),
top = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getTop())).toFixed(2)), top = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getTop()).toFixed(2)),
right = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getRight())).toFixed(2)), right = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getRight()).toFixed(2)),
bottom = +(parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getBottom())).toFixed(2)); bottom = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localMarginProps.asc_getBottom()).toFixed(2));
if (me.localMarginProps) { if (me.localMarginProps) {
@ -371,11 +369,6 @@ define([
this.api.asc_setDisplayGridlines(!checked); this.api.asc_setDisplayGridlines(!checked);
}, },
sheetChanged: function() {
var params = this.api.asc_getSheetViewSettings();
return(params);
},
initPageColorSchemes: function() { initPageColorSchemes: function() {
$('#color-schemes-content').html(templateInsert); $('#color-schemes-content').html(templateInsert);
$('.color-schemes-menu').on('click', _.bind(this.onColorSchemaClick, this)); $('.color-schemes-menu').on('click', _.bind(this.onColorSchemaClick, this));