mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 23:23:54 +08:00
Properly disable interface zoom in the onboarding window
This commit is contained in:
parent
cc99089670
commit
857decfb56
1 changed files with 20 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
|||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const _ = require('underscore');
|
||||
const { webFrame } = require('electron');
|
||||
const Actions = require('../actions').default;
|
||||
const MailspringStore = require('mailspring-store').default;
|
||||
|
||||
|
@ -33,13 +34,15 @@ class WorkspaceStore extends MailspringStore {
|
|||
this.listenTo(Actions.pushSheet, this.pushSheet);
|
||||
|
||||
const { windowType } = AppEnv.getLoadSettings();
|
||||
if (windowType !== 'onboarding') {
|
||||
require('electron').webFrame.setVisualZoomLevelLimits(1, 1);
|
||||
AppEnv.config.observe('core.workspace.interfaceZoom', z => {
|
||||
if (z && _.isNumber(z)) {
|
||||
require('electron').webFrame.setZoomFactor(z);
|
||||
}
|
||||
});
|
||||
|
||||
// Disable double-tap to zoom, pinch to zoom
|
||||
webFrame.setVisualZoomLevelLimits(1, 1);
|
||||
|
||||
// Allow the user to override the interface zoom
|
||||
this._applyDesiredScale();
|
||||
AppEnv.config.observe('core.workspace.interfaceZoom', this._applyDesiredScale);
|
||||
if (windowType === 'emptyWindow') {
|
||||
AppEnv.onWindowPropsReceived(this._applyDesiredScale);
|
||||
}
|
||||
|
||||
if (AppEnv.isMainWindow()) {
|
||||
|
@ -72,6 +75,16 @@ class WorkspaceStore extends MailspringStore {
|
|||
}
|
||||
}
|
||||
|
||||
_applyDesiredScale = () => {
|
||||
let zoom = AppEnv.config.get('core.workspace.interfaceZoom');
|
||||
if (AppEnv.getLoadSettings().windowType === 'onboarding') {
|
||||
zoom = 1; // onboarding is a fixed-size modal, zoom causes content clipping
|
||||
}
|
||||
if (zoom && _.isNumber(zoom)) {
|
||||
webFrame.setZoomFactor(zoom);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Inbound Events
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue