mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-23 18:54:54 +08:00
[PDFE] For bug 79947
This commit is contained in:
committed by
Maxim Kadushkin
parent
d8f9767b06
commit
e06ab2a36a
@ -386,6 +386,12 @@ define([
|
||||
$(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot);
|
||||
|
||||
if (!this.api) return;
|
||||
|
||||
const statusbarController = this.getApplication().getController('Statusbar');
|
||||
const stateBeforeOpenDlg = {
|
||||
zoom: statusbarController.getZoom(),
|
||||
scroll: this.api.getCurScroll()
|
||||
};
|
||||
|
||||
var me = this,
|
||||
res;
|
||||
@ -412,6 +418,19 @@ define([
|
||||
handler: handlerDlg,
|
||||
slides: _arr
|
||||
}).on('close', function() {
|
||||
//Restore zoom and scroll state
|
||||
const currentScroll = me.api.getCurScroll();
|
||||
if(statusbarController.getZoom() != stateBeforeOpenDlg.zoom) {
|
||||
me.api.zoom(stateBeforeOpenDlg.zoom);
|
||||
}
|
||||
if(
|
||||
Math.abs(currentScroll.x - stateBeforeOpenDlg.scroll.x) > 1 ||
|
||||
Math.abs(currentScroll.y - stateBeforeOpenDlg.scroll.y) > 1
|
||||
) {
|
||||
me.api.scrollToXY(stateBeforeOpenDlg.scroll.x, stateBeforeOpenDlg.scroll.y);
|
||||
}
|
||||
|
||||
(res === 'view') && me.api.asc_selectComment(arrIds);
|
||||
(res!=='ok' && res!=='view') && me.api.asc_removeAnnots(arrIds);
|
||||
});
|
||||
win.show();
|
||||
|
||||
@ -55,6 +55,8 @@ define([
|
||||
|
||||
initialize: function() {
|
||||
var me = this;
|
||||
this.zoomValue = 100;
|
||||
|
||||
this.addListeners({
|
||||
'Statusbar': {
|
||||
'zoom:value': function(value) {
|
||||
@ -158,6 +160,10 @@ define([
|
||||
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
|
||||
},
|
||||
|
||||
getZoom: function() {
|
||||
return this.zoomValue;
|
||||
},
|
||||
|
||||
onGotoPage: function (next, btn, e) {
|
||||
this.api && this.api.goToPage(this.api.getCurrentPage() + (next ? 1 : -1));
|
||||
},
|
||||
@ -172,6 +178,7 @@ define([
|
||||
$('.statusbar #label-zoom').text(Common.Utils.String.format(this.zoomText, percent));
|
||||
if(!this._isDocReady) return;
|
||||
var value = type == 2 ? -1 : (type == 1 ? -2 : percent);
|
||||
this.zoomValue = percent;
|
||||
Common.localStorage.setItem('pdfe-last-zoom', value);
|
||||
Common.Utils.InternalSettings.set('pdfe-last-zoom', value);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user