Skip to content

Conversation

@niutech
Copy link
Contributor

@niutech niutech commented Apr 14, 2025

I've added the zoom factor (50%-300%) in the Webpage settings.

This branch is based on the Release 2.6.0-beta, for changes see the last commit.

Copy link
Member

@alexk111 alexk111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the zoom-factor branch was created from the Release 2.6.0 branch instead of master. This will merge all of the Rel 2.6.0 changes with the zoom-factor ones.
This also makes it impossible to see the code changes made for that specific feature.

@niutech
Copy link
Contributor Author

niutech commented Jun 12, 2025

@alexk111 Done!

@alexk111
Copy link
Member

Thanks for the update!
The proposed solution will only allow setting the zoom level if all webview instances open a url on different domains. If multiply webviews will try to open a same-domain url there will be a random zoom level applied by a last webview setting the zoom factor for the domain.

You may reproduce the problem by copy-pasting a webpage widget instance and setting different zoom factors for them.

Quote from https://www.electronjs.org/docs/latest/api/webview-tag

The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.

@niutech
Copy link
Contributor Author

niutech commented Jun 13, 2025 via email

@alexk111
Copy link
Member

Yup, had the same idea :) Will try it a bit later.
Also researched how this is implemented in the zoom extensions for Chrome - not helped much though, as they are using the zoom feature of the Chrome-specific chrome.tabs API.

@alexk111
Copy link
Member

Experimented with the CSS zoom property. It scales elements and triggers layout recalculations, but does not scale the viewport. As a result, @media queries do not respond as expected, since the document's viewport dimensions remain unchanged.

@niutech
Copy link
Contributor Author

niutech commented Jun 17, 2025

@alexk111 So what do you propose? Maybe, to keep it simple, just store a hash table of zoom per domain in the store: zoom['example.org'] = 0.8?

@alexk111
Copy link
Member

Since applying a zoom factor on a per-widget basis isn't possible, and its state is managed by Chromium, I implemented it as a context menu action rather than a widget setting. The change has already been merged into master.

@alexk111 alexk111 closed this Jun 17, 2025
@niutech
Copy link
Contributor Author

niutech commented Jun 17, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants