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

Expose mouse wheel events #1774

Closed
lmvco opened this issue Jan 21, 2020 · 3 comments
Closed

Expose mouse wheel events #1774

lmvco opened this issue Jan 21, 2020 · 3 comments
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@lmvco
Copy link

lmvco commented Jan 21, 2020

I am trying to implement the editor zoom updating the fontSize option as suggested in #196.

Besides the CTRL + NUMPAD_ADD / NUMPAD_SUBTRACT shortcut keys, I would like to set the zoom level using CTRL + Mouse Wheel. From one hand, I did not find in Monaco API a way to listen mouse wheel events. On the other hand, listening those events in a monaco wrapper does not work also because Monaco is stop this event propagation.

Is there any workaround?

@alexdima
Copy link
Member

@lmvco Have you tried using the option mouseWheelZoom: true. The editor listens to ctrl + mouse wheel by itself, but that is just turned off because on macOS the trackpad is very sensitive.

@alexdima alexdima added the info-needed Issue requires more information from poster label Jan 21, 2020
@lmvco
Copy link
Author

lmvco commented Jan 21, 2020

I have already tried using mouseWheelZoom option. I just have 2 concerns:

  1. I would like to be notified when the user changes the zoom level (in order to store it in user preferences)
  2. I would like to provide a zoom level when creating the editor

Does the Monaco API support both scenarios?

@alexdima
Copy link
Member

@lmvco No, unfortunately there is no API for that.

Then I suggest that you add a capture mousewheel listener on the editor's container and then compute a zoom level on your own which you can then use as a multiplier for fontSize.

@alexdima alexdima added *question Issue represents a question, should be posted to StackOverflow (VS Code) and removed info-needed Issue requires more information from poster labels Jan 22, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants