fix: init zoom
This commit is contained in:
parent
aba3874797
commit
bedac4f59d
@ -47,8 +47,8 @@ function formatShortcutKey(shortcut: string[]): string {
|
|||||||
|
|
||||||
function handleZoom(delta: number) {
|
function handleZoom(delta: number) {
|
||||||
return (window: BrowserWindow) => {
|
return (window: BrowserWindow) => {
|
||||||
const currentZoom = window.webContents.getZoomFactor()
|
const currentZoom = configManager.getZoomFactor()
|
||||||
const newZoom = currentZoom + delta
|
const newZoom = Number((currentZoom + delta).toFixed(1))
|
||||||
if (newZoom >= 0.1 && newZoom <= 5.0) {
|
if (newZoom >= 0.1 && newZoom <= 5.0) {
|
||||||
window.webContents.setZoomFactor(newZoom)
|
window.webContents.setZoomFactor(newZoom)
|
||||||
configManager.setZoomFactor(newZoom)
|
configManager.setZoomFactor(newZoom)
|
||||||
@ -110,7 +110,9 @@ const convertShortcutRecordedByKeyboardEventKeyValueToElectronGlobalShortcutForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function registerShortcuts(window: BrowserWindow) {
|
export function registerShortcuts(window: BrowserWindow) {
|
||||||
window.webContents.setZoomFactor(configManager.getZoomFactor())
|
window.once('ready-to-show', () => {
|
||||||
|
window.webContents.setZoomFactor(configManager.getZoomFactor())
|
||||||
|
})
|
||||||
|
|
||||||
const register = () => {
|
const register = () => {
|
||||||
if (window.isDestroyed()) return
|
if (window.isDestroyed()) return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user