From cc99089670aa91349a369b1a86dc31d83eac8509 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Sun, 4 Nov 2018 23:09:43 -0800 Subject: [PATCH] Workaround Electron #940, revert interface zoom to 1 when showing billing UI --- app/src/components/billing-modal.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/components/billing-modal.jsx b/app/src/components/billing-modal.jsx index 342836bea..e59d3b6b1 100644 --- a/app/src/components/billing-modal.jsx +++ b/app/src/components/billing-modal.jsx @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { webFrame } from 'electron'; import Webview from './webview'; import Actions from '../flux/actions'; import IdentityStore from '../flux/stores/identity-store'; @@ -30,6 +31,14 @@ export default class BillingModal extends React.Component { } componentDidMount() { + // Due to a bug in Electron, opening a webview with a non 100% size when + // the app has a custom zoomLevel scales it's contents incorrectly and no + // CSS will fix it. Fix this by just temporarily reverting zoom to 1.0 + // https://github.com/electron/electron/issues/940#issuecomment-125999112 + this._initialZoom = webFrame.getZoomFactor(); + if (this._initialZoom !== 1) { + webFrame.setZoomFactor(1); + } this._mounted = true; } @@ -41,6 +50,7 @@ export default class BillingModal extends React.Component { * to determine if the user succesffully paid us or not. */ componentWillUnmount() { + webFrame.setZoomFactor(this._initialZoom); this._mounted = false; }