Skip to content
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

Feature Request: Add query methods for Visual/Layout ZoomLevelLimits #12994

Open
gioragutt opened this issue May 18, 2018 · 8 comments
Open

Feature Request: Add query methods for Visual/Layout ZoomLevelLimits #12994

gioragutt opened this issue May 18, 2018 · 8 comments

Comments

@gioragutt
Copy link

gioragutt commented May 18, 2018

Is your feature request related to a problem? Please describe.

The related PR - microsoft/vscode#49858 (Issue: microsoft/vscode#48357) - The UI setting of the zoom level was unbounded, although the actual zoom level has clear limits (+9 <-> -8).

We use the webFrame module of electron the get the zoom level, but it seems to be unbounded, at least not to reasonable values.

I've looked at the .d.ts declaration and at the web-frame.js and the c++ header which defines WebFrame, and I can only see a method to Set the layout and visual zoom level limits, but not retrieve them.

Describe the solution you'd like

I want to be able to logically bind the UI settings the values that electron itself bounds, not hard coded values that might be right for one screen/resolution/etc.

Currently in the PR listed above, the bounds are hard-coded, and I enforce them myself, logically, because webFrame.setZoomLevel and webFrame.getZoomLevel do not match the visual zoom level bounds.

I would want to have methods in webFrame, probably called:

v8::Local<v8::Value> GetVisualZoomLevelLimits() const;
v8::Local<v8::Value> GetLayoutZoomLevelLimits() const;

Which would be exported to the js webFrame module, which would in-turn allow me to query for the electron bounds value instead of hard coded ones, specifically here, since currently, webFrame.getZoomLevel/webFrame.setZoomLevel are not limiting values to the visual zoom level limits.

Describe alternatives you've considered

Currently, the PR is not in yet in production, but the workaround was to get the min/max zoom level limits via trial and error, and hard code those limits.

Thanks a lot for reading, perhaps tho I've just missed the methods which allow to do this in my research. But if not, that could help a lot.

If it's not too complicated, I'd love to PR it as well.

@welcome
Copy link

welcome bot commented May 18, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@gioragutt gioragutt changed the title Add query methods for VisualLayout ZoomLevelsLimits Feature Request: Add query methods for VisualLayout ZoomLevelsLimits May 18, 2018
@gioragutt gioragutt changed the title Feature Request: Add query methods for VisualLayout ZoomLevelsLimits Feature Request: Add query methods for Visual/Layout ZoomLevelLimits May 18, 2018
@sofianguy
Copy link
Contributor

sofianguy commented May 21, 2018

If it's not too complicated, I'd love to PR it as well.

You are more than welcome to submit a PR 🙂

@gioragutt
Copy link
Author

@sofianguy awesome! I'll be on it tomorrow.
@bpasero this is going to make it possible do do what you described in microsoft/vscode#48357

@gioragutt
Copy link
Author

@sofianguy hey, I've started doing some research, and I've traced the Set method calls to the WebView interface (which is what web_frame_->View() returns), and this doesn't seem to expose any getters for the limits.

Any chance to get like a hint or something here?

@gioragutt
Copy link
Author

Also, in what IDE do you develop code in C++? I tried using VSCode, but obviously without a proper indexer I would have any completions in the code...

@gioragutt
Copy link
Author

@sofianguy anything? I'd love to work on this but I need some assistance

@sethlu
Copy link
Contributor

sethlu commented May 27, 2018

@gioragutt I'm not sure if there is a good code hinting/completion tool for developing Electron since the build system is not as popular as something like cmake, and not much IDE supports it. I've been using VSCode and the best results I get is some jumping to declaration/definition and basic (but quick) searching. Since the codebase is quite spread-out, IntelliSense comes pretty slow. Not sure if any fellow contributors have a better solution to set up the dev env.

@MarshallOfSound
Copy link
Member

I rock VS Code as well, if you're looking for stuff in chromium your best bet is to use https://cs.chromium.org though to search and jump

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

No branches or pull requests

4 participants