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

Zoom out does not work when optimizer is enabled with defaults #17

Open
4 tasks done
mrmartineau opened this issue Sep 13, 2024 · 0 comments
Open
4 tasks done

Zoom out does not work when optimizer is enabled with defaults #17

mrmartineau opened this issue Sep 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mrmartineau
Copy link

Describe the bug

I have been debugging this for longer than I'd care to admit.. I have a custom menu config like so:

{
  label: "Zoom in",
  role: "zoomIn",
  accelerator: "CmdOrCtrl+Plus",
  click: function (_item, focusedWindow): void {
    // do stuff
  },
},
{
  label: "Zoom out",
  role: "zoomOut",
  accelerator: "CmdOrCtrl+-",
  click: function (_item, focusedWindow): void {
      // do stuff
  },
},
{
  label: "Reset Zoom",
  role: "resetZoom",
  accelerator: "CmdOrCtrl+0",
  click: function (_item, focusedWindow): void {
      // do stuff
  },
},

Both "zoom in" and "reset zoom" worked as expected but "zoom out" did not. I changed the accelerator to other combinations and it would work and I was at a loss until I searched through my code for "shortcut", the optimizer.watchWindowShortcuts(window) came up. I must have misunderstood the purpose of the method because I didn't think it affected zooming until I searched the source code.

I think the logic here is incorrect such that if you use the suggestion in the docs: optimizer.watchWindowShortcuts(window) it incorrectly disables zoom out or CmdOrCtrl+-

If I set zoom to false everything works as expected:

optimizer.watchWindowShortcuts(window, {
  zoom: true,
  escToCloseWindow: false,
});

Also, interestingly I was forced to have the escToCloseWindow option there because of a TypeScript issue:

image

For what it's worth, using CmdOrCtrl+numsub wasn't affected by this issue.

Ultimately I don't think I'll actually use this method at all because my app doesn't need those things disabled, but I thought I should report it anyway.

Electron-Toolkit Version

3.0.0

Electron Version

32.1.0

Validations

@mrmartineau mrmartineau added the bug Something isn't working label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant