Skip to content

Commit

Permalink
Merge pull request #240 from Razzeee/menu-zoom
Browse files Browse the repository at this point in the history
Use default electron implementation for zoomin, zoomout and resetzoom
  • Loading branch information
yuya-oc authored Oct 19, 2016
2 parents 0d76af7 + 9557ca1 commit e6a5b04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 37 deletions.
19 changes: 0 additions & 19 deletions src/browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,6 @@ var MattermostView = React.createClass({
webview.addEventListener("dom-ready", function() {
// webview.openDevTools();

// In order to apply the zoom level to webview.
webFrame.setZoomLevel(parseInt(localStorage.getItem('zoomLevel')));

// Use 'Meiryo UI' and 'MS Gothic' to prevent CJK fonts on Windows(JP).
if (process.platform === 'win32') {
var applyCssFile = function(cssFile) {
Expand Down Expand Up @@ -662,22 +659,6 @@ var showUnreadBadge = function(unreadCount, mentionCount) {
}
}

if (!localStorage.getItem('zoomLevel')) {
localStorage.setItem('zoomLevel', 0);
}
webFrame.setZoomLevel(parseInt(localStorage.getItem('zoomLevel')));

ipcRenderer.on('zoom-in', (event, increment) => {
const zoomLevel = webFrame.getZoomLevel() + increment
webFrame.setZoomLevel(zoomLevel);
localStorage.setItem('zoomLevel', zoomLevel);
});

ipcRenderer.on('zoom-reset', (event) => {
webFrame.setZoomLevel(0);
localStorage.setItem('zoomLevel', 0);
});

ReactDOM.render(
<MainPage teams={ config.teams } onUnreadCountChange={ showUnreadBadge } />,
document.getElementById('content')
Expand Down
22 changes: 4 additions & 18 deletions src/main/menus/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,16 @@ var createTemplate = function(mainWindow, config) {
}, {
role: 'togglefullscreen'
}, separatorItem, {
label: 'Actual Size',
accelerator: 'CmdOrCtrl+0',
click: () => {
mainWindow.webContents.send('zoom-reset');
}
role: 'resetzoom'
}, {
label: 'Zoom In',
accelerator: 'CmdOrCtrl+Plus',
click: () => {
mainWindow.webContents.send('zoom-in', 1);
}
role: 'zoomin'
}, {
label: 'Zoom In (hidden)',
accelerator: 'CmdOrCtrl+=',
visible: false,
click: () => {
mainWindow.webContents.send('zoom-in', 1);
}
role: 'zoomin'
}, {
label: 'Zoom Out',
accelerator: 'CmdOrCtrl+-',
click: () => {
mainWindow.webContents.send('zoom-in', -1);
}
role: 'zoomout'
}, separatorItem, {
label: 'Toggle Developer Tools',
accelerator: (function() {
Expand Down

0 comments on commit e6a5b04

Please sign in to comment.