[DE PE SSE] Fix bug 54241
This commit is contained in:
parent
05961f64ad
commit
51942c7e02
|
@ -168,11 +168,12 @@ define([
|
||||||
this.view.btnFitToWidth.toggle(type == 1, true);
|
this.view.btnFitToWidth.toggle(type == 1, true);
|
||||||
|
|
||||||
this.view.cmbZoom.setValue(percent, percent + '%');
|
this.view.cmbZoom.setValue(percent, percent + '%');
|
||||||
|
|
||||||
|
this._state.zoomValue = percent;
|
||||||
},
|
},
|
||||||
|
|
||||||
applyZoom: function (value) {
|
applyZoom: function (value) {
|
||||||
var val = parseFloat(value);
|
var val = Math.max(25, Math.min(500, value));
|
||||||
val = isNaN(val) ? 25 : Math.max(25, Math.min(500, val));
|
|
||||||
this.api.zoom(val);
|
this.api.zoom(val);
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
@ -182,24 +183,20 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onZoomChanged: function (before, combo, record, e) {
|
onZoomChanged: function (before, combo, record, e) {
|
||||||
var me = this;
|
var value = parseFloat(record.value);
|
||||||
if (before) {
|
if (before) {
|
||||||
var value = parseFloat(record.value),
|
var expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(%)?\\s*$');
|
||||||
expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(%)?\\s*$');
|
if (!expr.exec(record.value)) {
|
||||||
if (!(expr.exec(record.value)) || value<25 || value>500) {
|
this.view.cmbZoom.setValue(this._state.zoomValue, this._state.zoomValue + '%');
|
||||||
setTimeout( function() {
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
Common.UI.error({
|
|
||||||
msg: me.textZoomErr,
|
|
||||||
callback: function() {
|
|
||||||
_.defer(function() {
|
|
||||||
me.fireEvent('editcomplete', me);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
this.applyZoom(record.value);
|
if (this._state.zoomValue !== value && !isNaN(value)) {
|
||||||
|
this.applyZoom(value);
|
||||||
|
} else if (record.value !== this._state.zoomValue + '%') {
|
||||||
|
this.view.cmbZoom.setValue(this._state.zoomValue, this._state.zoomValue + '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onBtnZoomTo: function(type) {
|
onBtnZoomTo: function(type) {
|
||||||
|
@ -246,10 +243,8 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onComboBlur: function() {
|
onComboBlur: function() {
|
||||||
this.fireEvent('editcomplete', this);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
}
|
||||||
|
|
||||||
textZoomErr: 'The entered value is incorrect.<br>Please enter a value between 25% and 500%.'
|
|
||||||
|
|
||||||
}, DE.Controllers.ViewTab || {}));
|
}, DE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -82,7 +82,6 @@ define([
|
||||||
});
|
});
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'ViewTab': {
|
'ViewTab': {
|
||||||
'zoom:value': _.bind(this.onChangeZoomValue, this),
|
|
||||||
'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'),
|
'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'),
|
||||||
'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),
|
||||||
|
@ -141,6 +140,10 @@ define([
|
||||||
accept();
|
accept();
|
||||||
})).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));
|
||||||
});
|
});
|
||||||
|
|
||||||
var menuItems = [],
|
var menuItems = [],
|
||||||
|
@ -165,13 +168,6 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeZoomValue: function (value) {
|
|
||||||
this._state.zoom_type = undefined;
|
|
||||||
this._state.zoom_percent = undefined;
|
|
||||||
this.api.zoom(value);
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
|
||||||
},
|
|
||||||
|
|
||||||
onBtnZoomTo: function (type, btn) {
|
onBtnZoomTo: function (type, btn) {
|
||||||
this._state.zoom_type = undefined;
|
this._state.zoom_type = undefined;
|
||||||
this._state.zoom_percent = undefined;
|
this._state.zoom_percent = undefined;
|
||||||
|
@ -207,5 +203,38 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
applyZoom: function (value) {
|
||||||
|
this._state.zoom_percent = undefined;
|
||||||
|
this._state.zoom_type = undefined;
|
||||||
|
var val = Math.max(25, Math.min(500, value));
|
||||||
|
this.api.zoom(val);
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
},
|
||||||
|
|
||||||
|
onSelectedZoomValue: function (combo, record) {
|
||||||
|
this.applyZoom(record.value);
|
||||||
|
},
|
||||||
|
|
||||||
|
onZoomChanged: function (before, combo, record, e) {
|
||||||
|
var value = parseFloat(record.value);
|
||||||
|
if (before) {
|
||||||
|
var expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(%)?\\s*$');
|
||||||
|
if (!expr.exec(record.value)) {
|
||||||
|
this.view.cmbZoom.setValue(this._state.zoom_percent, this._state.zoom_percent + '%');
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this._state.zoom_percent !== value && !isNaN(value)) {
|
||||||
|
this.applyZoom(value);
|
||||||
|
} else if (record.value !== this._state.zoom_percent + '%') {
|
||||||
|
this.view.cmbZoom.setValue(this._state.zoom_percent, this._state.zoom_percent + '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onComboBlur: function() {
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
}
|
||||||
|
|
||||||
}, PE.Controllers.ViewTab || {}));
|
}, PE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -51,9 +51,6 @@ define([
|
||||||
|
|
||||||
setEvents: function () {
|
setEvents: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
me.cmbZoom && me.cmbZoom.on('selected', function (combo, record) {
|
|
||||||
me.fireEvent('zoom:value', [record.value]);
|
|
||||||
});
|
|
||||||
me.btnFitToSlide && me.btnFitToSlide.on('click', function () {
|
me.btnFitToSlide && me.btnFitToSlide.on('click', function () {
|
||||||
me.fireEvent('zoom:toslide', [me.btnFitToSlide]);
|
me.fireEvent('zoom:toslide', [me.btnFitToSlide]);
|
||||||
});
|
});
|
||||||
|
@ -89,7 +86,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,
|
||||||
lock: [_set.disableOnStart],
|
lock: [_set.disableOnStart],
|
||||||
data: [
|
data: [
|
||||||
{ displayValue: "50%", value: 50 },
|
{ displayValue: "50%", value: 50 },
|
||||||
|
|
|
@ -85,6 +85,9 @@ define([
|
||||||
});
|
});
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'ViewTab': {
|
'ViewTab': {
|
||||||
|
'zoom:selected': _.bind(this.onSelectedZoomValue, this),
|
||||||
|
'zoom:changedbefore': _.bind(this.onZoomChanged, this),
|
||||||
|
'zoom:changedafter': _.bind(this.onZoomChanged, this),
|
||||||
'viewtab:freeze': this.onFreeze,
|
'viewtab:freeze': this.onFreeze,
|
||||||
'viewtab:freezeshadow': this.onFreezeShadow,
|
'viewtab:freezeshadow': this.onFreezeShadow,
|
||||||
'viewtab:formula': this.onViewSettings,
|
'viewtab:formula': this.onViewSettings,
|
||||||
|
@ -151,13 +154,36 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
onZoom: function(zoom) {
|
applyZoom: function (value) {
|
||||||
if (this.api) {
|
var val = Math.max(25, Math.min(500, value));
|
||||||
this.api.asc_setZoom(zoom/100);
|
this.api.asc_setZoom(val/100);
|
||||||
}
|
|
||||||
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 value = parseFloat(record.value);
|
||||||
|
if (this._state.zoomValue === undefined) {
|
||||||
|
this._state.zoomValue = 100;
|
||||||
|
}
|
||||||
|
if (before) {
|
||||||
|
var expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(%)?\\s*$');
|
||||||
|
if (!expr.exec(record.value)) {
|
||||||
|
this.view.cmbZoom.setValue(this._state.zoomValue, this._state.zoomValue + '%');
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this._state.zoomValue !== value && !isNaN(value)) {
|
||||||
|
this.applyZoom(value);
|
||||||
|
} else if (record.value !== this._state.zoomValue + '%') {
|
||||||
|
this.view.cmbZoom.setValue(this._state.zoomValue, this._state.zoomValue + '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onViewSettings: function(type, value){
|
onViewSettings: function(type, value){
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -245,8 +271,10 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiZoomChange: function(zf, type){
|
onApiZoomChange: function(zf, type){
|
||||||
|
console.log('zoom');
|
||||||
var value = Math.floor((zf + .005) * 100);
|
var value = Math.floor((zf + .005) * 100);
|
||||||
this.view.cmbZoom.setValue(value, value + '%');
|
this.view.cmbZoom.setValue(value, value + '%');
|
||||||
|
this._state.zoomValue = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
onThemeChanged: function () {
|
onThemeChanged: function () {
|
||||||
|
|
|
@ -76,15 +76,21 @@ define([
|
||||||
this.chZeros.on('change', function (field, value) {
|
this.chZeros.on('change', function (field, value) {
|
||||||
me.fireEvent('viewtab:zeros', [3, value]);
|
me.fireEvent('viewtab:zeros', [3, value]);
|
||||||
});
|
});
|
||||||
this.cmbZoom.on('selected', function(combo, record) {
|
|
||||||
me.fireEvent('viewtab:zoom', [record.value]);
|
|
||||||
});
|
|
||||||
this.chToolbar.on('change', function (field, value) {
|
this.chToolbar.on('change', function (field, value) {
|
||||||
me.fireEvent('viewtab:showtoolbar', [field, value !== 'checked']);
|
me.fireEvent('viewtab:showtoolbar', [field, value !== 'checked']);
|
||||||
});
|
});
|
||||||
this.chStatusbar.on('change', function (field, value) {
|
this.chStatusbar.on('change', function (field, value) {
|
||||||
me.fireEvent('statusbar:setcompact', [field, value === 'checked']);
|
me.fireEvent('statusbar:setcompact', [field, value === 'checked']);
|
||||||
});
|
});
|
||||||
|
this.cmbZoom.on('selected', function (combo, record) {
|
||||||
|
me.fireEvent('zoom:selected', [combo, record]);
|
||||||
|
}).on('changed:before', function (combo, record) {
|
||||||
|
me.fireEvent('zoom:changedbefore', [true, combo, record]);
|
||||||
|
}).on('changed:after', function (combo, record) {
|
||||||
|
me.fireEvent('zoom:changedafter', [false, combo, record]);
|
||||||
|
}).on('combo:blur', function () {
|
||||||
|
me.fireEvent('editcomplete', me);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -160,7 +166,7 @@ define([
|
||||||
cls : 'input-group-nr',
|
cls : 'input-group-nr',
|
||||||
menuStyle : 'min-width: 55px;',
|
menuStyle : 'min-width: 55px;',
|
||||||
hint : me.tipFontSize,
|
hint : me.tipFontSize,
|
||||||
editable : false,
|
editable : true,
|
||||||
lock : [_set.coAuth, _set.lostConnect, _set.editCell],
|
lock : [_set.coAuth, _set.lostConnect, _set.editCell],
|
||||||
data : [
|
data : [
|
||||||
{ displayValue: "50%", value: 50 },
|
{ displayValue: "50%", value: 50 },
|
||||||
|
|
Loading…
Reference in a new issue