[DE mobile] Margins to current units
This commit is contained in:
parent
498586c185
commit
265407d61f
|
@ -83,7 +83,8 @@ define([
|
||||||
_canReview = false,
|
_canReview = false,
|
||||||
_isReviewOnly = false,
|
_isReviewOnly = false,
|
||||||
_fileKey,
|
_fileKey,
|
||||||
templateInsert;
|
templateInsert,
|
||||||
|
_metricText = Common.Utils.Metric.getCurrentMetricName();
|
||||||
|
|
||||||
var mm2Cm = function(mm) {
|
var mm2Cm = function(mm) {
|
||||||
return parseFloat((mm/10.).toFixed(2));
|
return parseFloat((mm/10.).toFixed(2));
|
||||||
|
@ -249,6 +250,7 @@ define([
|
||||||
|
|
||||||
initPageMargin: function() {
|
initPageMargin: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
_metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric());
|
||||||
|
|
||||||
// Init page margins
|
// Init page margins
|
||||||
me.localSectionProps = me.api.asc_GetSectionProps();
|
me.localSectionProps = me.api.asc_GetSectionProps();
|
||||||
|
@ -257,10 +259,15 @@ 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;
|
||||||
|
|
||||||
$('#document-margin-top .item-after label').text(mm2Cm(me.localSectionProps.get_TopMargin()) + ' ' + txtCm);
|
var top = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_TopMargin())).toFixed(2),
|
||||||
$('#document-margin-bottom .item-after label').text(mm2Cm(me.localSectionProps.get_BottomMargin()) + ' ' + txtCm);
|
bottom = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_BottomMargin())).toFixed(2),
|
||||||
$('#document-margin-left .item-after label').text(mm2Cm(me.localSectionProps.get_LeftMargin()) + ' ' + txtCm);
|
left = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_LeftMargin())).toFixed(2),
|
||||||
$('#document-margin-right .item-after label').text(mm2Cm(me.localSectionProps.get_RightMargin()) + ' ' + txtCm);
|
right = parseFloat(Common.Utils.Metric.fnRecalcFromMM(me.localSectionProps.get_RightMargin())).toFixed(2);
|
||||||
|
|
||||||
|
$('#document-margin-top .item-after label').text(top + ' ' + _metricText);
|
||||||
|
$('#document-margin-bottom .item-after label').text(bottom + ' ' + _metricText);
|
||||||
|
$('#document-margin-left .item-after label').text(left + ' ' + _metricText);
|
||||||
|
$('#document-margin-right .item-after label').text(right + ' ' + _metricText);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(["top", "left", "bottom", "right"], function(align) {
|
_.each(["top", "left", "bottom", "right"], function(align) {
|
||||||
|
@ -524,9 +531,15 @@ define([
|
||||||
onPageMarginsChange: function (align, e) {
|
onPageMarginsChange: function (align, e) {
|
||||||
var me = this,
|
var me = this,
|
||||||
$button = $(e.currentTarget),
|
$button = $(e.currentTarget),
|
||||||
step = 1, // mm
|
step,
|
||||||
txtCm = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm),
|
txtCm = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm),
|
||||||
marginValue = null;
|
marginValue = null;
|
||||||
|
if(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) {
|
||||||
|
step = 1;
|
||||||
|
} else {
|
||||||
|
step = 0.1;
|
||||||
|
}
|
||||||
|
step = Common.Utils.Metric.fnRecalcToMM(step);
|
||||||
|
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case 'left': marginValue = me.localSectionProps.get_LeftMargin(); break;
|
case 'left': marginValue = me.localSectionProps.get_LeftMargin(); break;
|
||||||
|
@ -548,7 +561,8 @@ define([
|
||||||
case 'bottom': me.localSectionProps.put_BottomMargin(marginValue); break;
|
case 'bottom': me.localSectionProps.put_BottomMargin(marginValue); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(Common.Utils.String.format('#document-margin-{0} .item-after label', align)).text(mm2Cm(marginValue) + ' ' + txtCm);
|
var valueCurrentMetric = parseFloat(Common.Utils.Metric.fnRecalcFromMM(marginValue)).toFixed(2);
|
||||||
|
$(Common.Utils.String.format('#document-margin-{0} .item-after label', align)).text(valueCurrentMetric + ' ' + _metricText);
|
||||||
|
|
||||||
me.applyPageMarginsIfNeed()
|
me.applyPageMarginsIfNeed()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue