[PE] Добавлена настройка ориентации слайда.
This commit is contained in:
parent
210327a73a
commit
3f8f42ac02
|
@ -525,9 +525,10 @@ define([
|
||||||
this.currentPageSize.height = height;
|
this.currentPageSize.height = height;
|
||||||
this.currentPageSize.type = -1;
|
this.currentPageSize.type = -1;
|
||||||
|
|
||||||
|
var portrait = (height>width);
|
||||||
for (var i = 0; i < this.slideSizeArr.length; i++) {
|
for (var i = 0; i < this.slideSizeArr.length; i++) {
|
||||||
if (Math.abs(this.slideSizeArr[i][0] - this.currentPageSize.width) < 0.001 &&
|
if (Math.abs(this.slideSizeArr[i][portrait ? 1 : 0] - this.currentPageSize.width) < 0.001 &&
|
||||||
Math.abs(this.slideSizeArr[i][1] - this.currentPageSize.height) < 0.001) {
|
Math.abs(this.slideSizeArr[i][portrait ? 0 : 1] - this.currentPageSize.height) < 0.001) {
|
||||||
this.currentPageSize.type = i;
|
this.currentPageSize.type = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1345,16 +1346,17 @@ define([
|
||||||
|
|
||||||
onSlideSize: function(menu, item) {
|
onSlideSize: function(menu, item) {
|
||||||
if (item.value !== 'advanced') {
|
if (item.value !== 'advanced') {
|
||||||
|
var portrait = (this.currentPageSize.height > this.currentPageSize.width);
|
||||||
this.currentPageSize = {
|
this.currentPageSize = {
|
||||||
type : item.value,
|
type : item.value,
|
||||||
width : this.slideSizeArr[item.value][0],
|
width : this.slideSizeArr[item.value][portrait ? 1 : 0],
|
||||||
height : this.slideSizeArr[item.value][1]
|
height : this.slideSizeArr[item.value][portrait ? 0 : 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.api)
|
if (this.api)
|
||||||
this.api.changeSlideSize(
|
this.api.changeSlideSize(
|
||||||
this.slideSizeArr[item.value][0],
|
this.slideSizeArr[item.value][portrait ? 1 : 0],
|
||||||
this.slideSizeArr[item.value][1]
|
this.slideSizeArr[item.value][portrait ? 0 : 1]
|
||||||
);
|
);
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
|
|
|
@ -58,12 +58,12 @@ define([
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
this.template = [
|
this.template = [
|
||||||
'<div class="box" style="height: 95px;">',
|
'<div class="box" style="height: 148px;">',
|
||||||
'<div class="input-row">',
|
'<div class="input-row">',
|
||||||
'<label class="text columns-text" style="font-weight: bold;">' + this.textSlideSize + '</label>',
|
'<label class="text columns-text" style="font-weight: bold;">' + this.textSlideSize + '</label>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div id="slide-size-combo" class="" style="margin-bottom: 10px;"></div>',
|
'<div id="slide-size-combo" class="" style="margin-bottom: 10px;"></div>',
|
||||||
'<table cols="2" style="width: 100%;margin-bottom: 10px;">',
|
'<table cols="2" style="width: 100%;margin-bottom: 7px;">',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="padding-small" style="padding-right: 10px;">',
|
'<td class="padding-small" style="padding-right: 10px;">',
|
||||||
'<label class="input-label" style="font-weight: bold;">' + this.textWidth + '</label>',
|
'<label class="input-label" style="font-weight: bold;">' + this.textWidth + '</label>',
|
||||||
|
@ -75,6 +75,10 @@ define([
|
||||||
'</td>',
|
'</td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'</table>',
|
'</table>',
|
||||||
|
'<div class="input-row">',
|
||||||
|
'<label class="text columns-text" style="font-weight: bold;">' + this.textSlideOrientation + '</label>',
|
||||||
|
'</div>',
|
||||||
|
'<div id="slide-orientation-combo" class="" style="margin-bottom: 10px;"></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div class="separator horizontal"/>',
|
'<div class="separator horizontal"/>',
|
||||||
'<div class="footer center">',
|
'<div class="footer center">',
|
||||||
|
@ -122,8 +126,12 @@ define([
|
||||||
if (record.value<0) {
|
if (record.value<0) {
|
||||||
// set current slide size
|
// set current slide size
|
||||||
} else {
|
} else {
|
||||||
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(record.size[0]), true);
|
var w = record.size[0],
|
||||||
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(record.size[1]), true);
|
h = record.size[1],
|
||||||
|
orient = this.cmbSlideOrientation.getValue(),
|
||||||
|
cond = orient==0 && w>h || orient==1 && h>w;
|
||||||
|
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(cond ? h : w), true);
|
||||||
|
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(cond ? w : h), true);
|
||||||
}
|
}
|
||||||
this._noApply = false;
|
this._noApply = false;
|
||||||
}, this));
|
}, this));
|
||||||
|
@ -139,8 +147,12 @@ define([
|
||||||
});
|
});
|
||||||
this.spinners.push(this.spnWidth);
|
this.spinners.push(this.spnWidth);
|
||||||
this.spnWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
this.spnWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||||
if (!this._noApply && this.cmbSlideSize.getValue() >-1) {
|
if (!this._noApply) {
|
||||||
|
if (this.cmbSlideSize.getValue() >-1)
|
||||||
this.cmbSlideSize.setValue(-1);
|
this.cmbSlideSize.setValue(-1);
|
||||||
|
var w = this.spnWidth.getNumberValue(),
|
||||||
|
h = this.spnHeight.getNumberValue();
|
||||||
|
this.cmbSlideOrientation.setValue( h>w ? 0 : 1);
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
@ -155,11 +167,38 @@ define([
|
||||||
});
|
});
|
||||||
this.spinners.push(this.spnHeight);
|
this.spinners.push(this.spnHeight);
|
||||||
this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||||
if (!this._noApply && this.cmbSlideSize.getValue() >-1) {
|
if (!this._noApply) {
|
||||||
|
if (this.cmbSlideSize.getValue() >-1)
|
||||||
this.cmbSlideSize.setValue(-1);
|
this.cmbSlideSize.setValue(-1);
|
||||||
|
var w = this.spnWidth.getNumberValue(),
|
||||||
|
h = this.spnHeight.getNumberValue();
|
||||||
|
this.cmbSlideOrientation.setValue( h>w ? 0 : 1);
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
this.cmbSlideOrientation = new Common.UI.ComboBox({
|
||||||
|
el: $('#slide-orientation-combo'),
|
||||||
|
cls: 'input-group-nr',
|
||||||
|
style: 'width: 100%;',
|
||||||
|
menuStyle: 'min-width: 218px;',
|
||||||
|
editable: false,
|
||||||
|
data: [
|
||||||
|
{value:0, displayValue: this.strPortrait},
|
||||||
|
{value:1, displayValue: this.strLandscape}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
this.cmbSlideOrientation.setValue(1);
|
||||||
|
this.cmbSlideOrientation.on('selected', _.bind(function(combo, record) {
|
||||||
|
this._noApply = true;
|
||||||
|
var w = this.spnWidth.getNumberValue(),
|
||||||
|
h = this.spnHeight.getNumberValue();
|
||||||
|
if (record.value==0 && w>h || record.value==1 && h>w) {
|
||||||
|
this.spnWidth.setValue(h, true);
|
||||||
|
this.spnHeight.setValue(w, true);
|
||||||
|
}
|
||||||
|
this._noApply = false;
|
||||||
|
}, this));
|
||||||
|
|
||||||
var $window = this.getChild();
|
var $window = this.getChild();
|
||||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
|
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
|
||||||
|
@ -189,6 +228,7 @@ define([
|
||||||
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(pagewitdh), true);
|
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(pagewitdh), true);
|
||||||
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(pageheight), true);
|
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(pageheight), true);
|
||||||
this.cmbSlideSize.setValue(type);
|
this.cmbSlideSize.setValue(type);
|
||||||
|
this.cmbSlideOrientation.setValue((pageheight>pagewitdh) ? 0 : 1);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -225,6 +265,9 @@ define([
|
||||||
txt35: '35 mm Slides',
|
txt35: '35 mm Slides',
|
||||||
txtOverhead: 'Overhead',
|
txtOverhead: 'Overhead',
|
||||||
txtBanner: 'Banner',
|
txtBanner: 'Banner',
|
||||||
txtCustom: 'Custom'
|
txtCustom: 'Custom',
|
||||||
|
textSlideOrientation: 'Slide Orientation',
|
||||||
|
strPortrait: 'Portrait',
|
||||||
|
strLandscape: 'Landscape'
|
||||||
}, PE.Views.SlideSizeSettings || {}))
|
}, PE.Views.SlideSizeSettings || {}))
|
||||||
});
|
});
|
|
@ -611,7 +611,10 @@
|
||||||
"PE.Views.SlideSettings.txtWood": "Wood",
|
"PE.Views.SlideSettings.txtWood": "Wood",
|
||||||
"PE.Views.SlideSizeSettings.cancelButtonText": "Cancel",
|
"PE.Views.SlideSizeSettings.cancelButtonText": "Cancel",
|
||||||
"PE.Views.SlideSizeSettings.okButtonText": "OK",
|
"PE.Views.SlideSizeSettings.okButtonText": "OK",
|
||||||
|
"PE.Views.SlideSizeSettings.strPortrait": "Portrait",
|
||||||
|
"PE.Views.SlideSizeSettings.strLandscape": "Landscape",
|
||||||
"PE.Views.SlideSizeSettings.textHeight": "Height",
|
"PE.Views.SlideSizeSettings.textHeight": "Height",
|
||||||
|
"PE.Views.SlideSizeSettings.textSlideOrientation": "Slide Orientation",
|
||||||
"PE.Views.SlideSizeSettings.textSlideSize": "Slide Size",
|
"PE.Views.SlideSizeSettings.textSlideSize": "Slide Size",
|
||||||
"PE.Views.SlideSizeSettings.textTitle": "Slide Size Settings",
|
"PE.Views.SlideSizeSettings.textTitle": "Slide Size Settings",
|
||||||
"PE.Views.SlideSizeSettings.textWidth": "Width",
|
"PE.Views.SlideSizeSettings.textWidth": "Width",
|
||||||
|
|
Loading…
Reference in a new issue