Skip to content

Commit

Permalink
Use default electron implementation for zoomin, zoomout and resetzoom
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Aug 11, 2016
1 parent eac17de commit d39b95a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"electron-builder": "5.2.1",
"electron-connect": "^0.3.7",
"electron-packager": "^7.0.1",
"electron-prebuilt": "1.2.6",
"electron-prebuilt": "1.3.3",
"electron-winstaller": "^2.2.0",
"esformatter": "^0.9.3",
"esformatter-jsx": "^5.0.0",
Expand Down
19 changes: 0 additions & 19 deletions src/browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,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 @@ -548,22 +545,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
18 changes: 3 additions & 15 deletions src/main/menus/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,11 @@ var createTemplate = function(mainWindow, config) {
}
}
}, 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 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 d39b95a

Please sign in to comment.