Skip to content

Commit

Permalink
Shows presenter-view without external display (#248)
Browse files Browse the repository at this point in the history
* Shows presenter-view without external display

* fixes presenter-view switching while casting
  • Loading branch information
inderpreetsingh authored and tsingh777 committed Aug 15, 2018
1 parent fbe9e4f commit 119b4b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function createViewer(ipcData) {
});
});
}
mainWindow.webContents.send('presenter-view');
}

app.on('ready', () => {
Expand Down
25 changes: 17 additions & 8 deletions www/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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);
});
Expand Down Expand Up @@ -473,6 +481,7 @@ module.exports = {
},

'presenter-view': function presenterView() {
checkPresenterView();
updateViewerScale();
},

Expand Down

0 comments on commit 119b4b4

Please sign in to comment.