[DE] Bug 54241
This commit is contained in:
parent
2c3440423d
commit
05961f64ad
|
@ -80,7 +80,6 @@ define([
|
||||||
});
|
});
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'ViewTab': {
|
'ViewTab': {
|
||||||
'zoom:value': _.bind(this.onChangeZoomValue, this),
|
|
||||||
'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'),
|
'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'),
|
||||||
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'),
|
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'),
|
||||||
'rulers:change': _.bind(this.onChangeRulers, this),
|
'rulers:change': _.bind(this.onChangeRulers, this),
|
||||||
|
@ -125,6 +124,11 @@ define([
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
me.view.setEvents();
|
me.view.setEvents();
|
||||||
|
|
||||||
|
me.view.cmbZoom.on('selected', _.bind(me.onSelectedZoomValue, me))
|
||||||
|
.on('changed:before',_.bind(me.onZoomChanged, me, true))
|
||||||
|
.on('changed:after', _.bind(me.onZoomChanged, me, false))
|
||||||
|
.on('combo:blur', _.bind(me.onComboBlur, me, false));
|
||||||
|
|
||||||
me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) {
|
me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) {
|
||||||
if (state !== me.view.btnNavigation.pressed)
|
if (state !== me.view.btnNavigation.pressed)
|
||||||
me.view.turnNavigation(state);
|
me.view.turnNavigation(state);
|
||||||
|
@ -166,11 +170,38 @@ define([
|
||||||
this.view.cmbZoom.setValue(percent, percent + '%');
|
this.view.cmbZoom.setValue(percent, percent + '%');
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeZoomValue: function (value) {
|
applyZoom: function (value) {
|
||||||
this.api.zoom(value);
|
var val = parseFloat(value);
|
||||||
|
val = isNaN(val) ? 25 : Math.max(25, Math.min(500, val));
|
||||||
|
this.api.zoom(val);
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSelectedZoomValue: function (combo, record) {
|
||||||
|
this.applyZoom(record.value);
|
||||||
|
},
|
||||||
|
|
||||||
|
onZoomChanged: function (before, combo, record, e) {
|
||||||
|
var me = this;
|
||||||
|
if (before) {
|
||||||
|
var value = parseFloat(record.value),
|
||||||
|
expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(%)?\\s*$');
|
||||||
|
if (!(expr.exec(record.value)) || value<25 || value>500) {
|
||||||
|
setTimeout( function() {
|
||||||
|
Common.UI.error({
|
||||||
|
msg: me.textZoomErr,
|
||||||
|
callback: function() {
|
||||||
|
_.defer(function() {
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
this.applyZoom(record.value);
|
||||||
|
},
|
||||||
|
|
||||||
onBtnZoomTo: function(type) {
|
onBtnZoomTo: function(type) {
|
||||||
var btn, func;
|
var btn, func;
|
||||||
if ( type === 'topage' ) {
|
if ( type === 'topage' ) {
|
||||||
|
@ -214,5 +245,11 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onComboBlur: function() {
|
||||||
|
this.fireEvent('editcomplete', this);
|
||||||
|
},
|
||||||
|
|
||||||
|
textZoomErr: 'The entered value is incorrect.<br>Please enter a value between 25% and 500%.'
|
||||||
|
|
||||||
}, DE.Controllers.ViewTab || {}));
|
}, DE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -54,9 +54,6 @@ define([
|
||||||
me.btnNavigation.on('click', function (btn, e) {
|
me.btnNavigation.on('click', function (btn, e) {
|
||||||
me.fireEvent('viewtab:navigation', [btn.pressed]);
|
me.fireEvent('viewtab:navigation', [btn.pressed]);
|
||||||
});
|
});
|
||||||
me.cmbZoom.on('selected', function (combo, record) {
|
|
||||||
me.fireEvent('zoom:value', [record.value]);
|
|
||||||
});
|
|
||||||
me.btnFitToPage.on('click', function () {
|
me.btnFitToPage.on('click', function () {
|
||||||
me.fireEvent('zoom:topage');
|
me.fireEvent('zoom:topage');
|
||||||
});
|
});
|
||||||
|
@ -104,7 +101,7 @@ define([
|
||||||
el: $host.find('#slot-field-zoom'),
|
el: $host.find('#slot-field-zoom'),
|
||||||
cls: 'input-group-nr',
|
cls: 'input-group-nr',
|
||||||
menuStyle: 'min-width: 55px;',
|
menuStyle: 'min-width: 55px;',
|
||||||
editable: false,
|
editable: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
data: [
|
data: [
|
||||||
{ displayValue: "50%", value: 50 },
|
{ displayValue: "50%", value: 50 },
|
||||||
|
|
Loading…
Reference in a new issue