From 4939665d9fc7ddf70194bb6001dbef71db995077 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 24 Nov 2016 12:42:43 +0300 Subject: [PATCH] [PE] Fix Bug 33519. When starting preview in the Chrome browser in fullscreen mode (F11) resize event isn't fired. --- .../main/app/controller/Statusbar.js | 8 +++++++- .../main/app/controller/Toolbar.js | 8 +++++++- .../main/app/view/DocumentHolder.js | 14 +++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Statusbar.js b/apps/presentationeditor/main/app/controller/Statusbar.js index 197be4478..cbd11c786 100644 --- a/apps/presentationeditor/main/app/controller/Statusbar.js +++ b/apps/presentationeditor/main/app/controller/Statusbar.js @@ -122,10 +122,13 @@ define([ onPreview: function(btn, e) { var previewPanel = PE.getController('Viewport').getView('DocumentPreview'), - me = this; + me = this, + isResized = false; if (previewPanel && me.api) { previewPanel.show(); var onWindowResize = function() { + if (isResized) return; + isResized = true; Common.NotificationCenter.off('window:resize', onWindowResize); var current = me.api.getCurrentPage(); @@ -136,6 +139,9 @@ define([ if (!me.statusbar.mode.isDesktopApp && !Common.Utils.isIE11) { Common.NotificationCenter.on('window:resize', onWindowResize); me.fullScreen(document.documentElement); + setTimeout(function(){ + onWindowResize(); + }, 100); } else onWindowResize(); } diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 1f8be2c25..2bfe4873a 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -763,10 +763,13 @@ define([ onPreview: function(slidenum) { var previewPanel = PE.getController('Viewport').getView('DocumentPreview'), - me = this; + me = this, + isResized = false; if (previewPanel && me.api) { previewPanel.show(); var onWindowResize = function() { + if (isResized) return; + isResized = true; Common.NotificationCenter.off('window:resize', onWindowResize); me.api.StartDemonstration('presentation-preview', _.isNumber(slidenum) ? slidenum : 0); Common.component.Analytics.trackEvent('ToolBar', 'Preview'); @@ -774,6 +777,9 @@ define([ if (!me.toolbar.mode.isDesktopApp && !Common.Utils.isIE11) { Common.NotificationCenter.on('window:resize', onWindowResize); me.fullScreen(document.documentElement); + setTimeout(function(){ + onWindowResize(); + }, 100); } else onWindowResize(); } diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index fbcdb1157..2cb7d9685 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1291,6 +1291,7 @@ define([ var hkPreview = 'command+f5,ctrl+f5'; keymap[hkPreview] = function(e) { + var isResized = false; e.preventDefault(); e.stopPropagation(); if (me.slidesCount>0) { @@ -1298,12 +1299,17 @@ define([ if (previewPanel && !previewPanel.isVisible() && me.api) { previewPanel.show(); var onWindowResize = function() { + if (isResized) return; + isResized = true; Common.NotificationCenter.off('window:resize', onWindowResize); me.api.StartDemonstration('presentation-preview', 0); }; if (!me.mode.isDesktopApp && !Common.Utils.isIE11) { Common.NotificationCenter.on('window:resize', onWindowResize); me.fullScreen(document.documentElement); + setTimeout(function(){ + onWindowResize(); + }, 100); } else onWindowResize(); } @@ -1558,10 +1564,13 @@ define([ var mnuPreview = new Common.UI.MenuItem({ caption : me.txtPreview }).on('click', function(item) { - var previewPanel = PE.getController('Viewport').getView('DocumentPreview'); + var previewPanel = PE.getController('Viewport').getView('DocumentPreview'), + isResized = false; if (previewPanel && me.api) { previewPanel.show(); var onWindowResize = function() { + if (isResized) return; + isResized = true; Common.NotificationCenter.off('window:resize', onWindowResize); var current = me.api.getCurrentPage(); @@ -1572,6 +1581,9 @@ define([ if (!me.mode.isDesktopApp && !Common.Utils.isIE11) { Common.NotificationCenter.on('window:resize', onWindowResize); me.fullScreen(document.documentElement); + setTimeout(function(){ + onWindowResize(); + }, 100); } else onWindowResize(); }