From 119b4b4fb67cc03aa0be793df3e11dccf4fc2b51 Mon Sep 17 00:00:00 2001 From: Inder Singh Date: Wed, 15 Aug 2018 08:56:42 +0530 Subject: [PATCH] Shows presenter-view without external display (#248) * Shows presenter-view without external display * fixes presenter-view switching while casting --- app.js | 1 + www/js/controller.js | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 0e6526078..7d4047c74 100644 --- a/app.js +++ b/app.js @@ -211,6 +211,7 @@ function createViewer(ipcData) { }); }); } + mainWindow.webContents.send('presenter-view'); } app.on('ready', () => { diff --git a/www/js/controller.js b/www/js/controller.js index 4259f4c2c..c4237a606 100644 --- a/www/js/controller.js +++ b/www/js/controller.js @@ -378,12 +378,20 @@ function updateViewerScale() { } } -global.platform.ipc.on('external-display', (e, args) => { +function checkPresenterView() { if (store.getUserPref('app.layout.presenter-view')) { document.body.classList.add('presenter-view'); document.body.classList.remove('home'); + document.body.classList.add('scale-viewer'); } - document.body.classList.add('scale-viewer'); +} + +global.platform.ipc.on('presenter-view', () => { + checkPresenterView(); + updateViewerScale(); +}); + +global.platform.ipc.on('external-display', (e, args) => { global.externalDisplay = { width: args.width, height: args.height, @@ -427,11 +435,9 @@ global.platform.ipc.on('cast-session-active', () => { menuCast.items[0].visible = false; menuCast.items[1].visible = true; - if (store.getUserPref('app.layout.presenter-view')) { - document.body.classList.add('presenter-view', 'scale-viewer'); - document.body.classList.remove('home'); - updateViewerScale(); - } + store.setUserPref('app.layout.presenter-view', true); + checkPresenterView(); + updateViewerScale(); store.set('userPrefs.slide-layout.display-options.akhandpaatt', false); store.set('userPrefs.slide-layout.display-options.disable-akhandpaatt', true); @@ -441,8 +447,10 @@ global.platform.ipc.on('cast-session-active', () => { global.platform.ipc.on('cast-session-stopped', () => { menuCast.items[1].visible = false; menuCast.items[0].visible = true; - if (!global.externalDisplay) { + if (store.getUserPref('app.layout.presenter-view')) { document.body.classList.remove('presenter-view', 'scale-viewer'); + store.setUserPref('app.layout.presenter-view', false); + global.core.platformMethod('updateSettings'); } store.set('userPrefs.slide-layout.display-options.disable-akhandpaatt', false); }); @@ -473,6 +481,7 @@ module.exports = { }, 'presenter-view': function presenterView() { + checkPresenterView(); updateViewerScale(); },