-
-
Notifications
You must be signed in to change notification settings - Fork 926
broadcast zoom changed notifications #2989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,16 +12,30 @@ const MinZoomLevel = 0.4; | |
| const MaxZoomLevel = 2.6; | ||
| const ZoomDelta = 0.2; | ||
|
|
||
| function broadcastZoomFactorChanged(newZoomFactor: number): void { | ||
| for (const wc of electron.webContents.getAllWebContents()) { | ||
| if (wc.isDestroyed()) { | ||
| continue; | ||
| } | ||
| wc.send("zoom-factor-change", newZoomFactor); | ||
| } | ||
|
Comment on lines
+21
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broadcasting only the IPC leaves other Right now only the initiating 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| export function increaseZoomLevel(webContents: electron.WebContents): void { | ||
| const newZoom = Math.min(MaxZoomLevel, webContents.getZoomFactor() + ZoomDelta); | ||
| webContents.setZoomFactor(newZoom); | ||
| webContents.send("zoom-factor-change", newZoom); | ||
| broadcastZoomFactorChanged(newZoom); | ||
| } | ||
|
|
||
| export function decreaseZoomLevel(webContents: electron.WebContents): void { | ||
| const newZoom = Math.max(MinZoomLevel, webContents.getZoomFactor() - ZoomDelta); | ||
| webContents.setZoomFactor(newZoom); | ||
| webContents.send("zoom-factor-change", newZoom); | ||
| broadcastZoomFactorChanged(newZoom); | ||
| } | ||
|
|
||
| export function resetZoomLevel(webContents: electron.WebContents): void { | ||
| webContents.setZoomFactor(1); | ||
| broadcastZoomFactorChanged(1); | ||
| } | ||
|
|
||
| export function getElectronExecPath(): string { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zoom-changedstill bypasses the new broadcast path.This handler only sends
"zoom-factor-change"back tothis.webContents, so any zoom change that comes through Electron's nativezoom-changedflow remains local even after this refactor. If zoom notifications are supposed to be app-wide now, this should route through the same shared zoom sync/broadcast path instead of doing a per-tab send.🤖 Prompt for AI Agents