-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
fix(handleWheel): mouse scrolling behavior for out-of-focus windows #2992
fix(handleWheel): mouse scrolling behavior for out-of-focus windows #2992
Conversation
3476a90
to
b39d1c9
Compare
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.
While that works, I find the logic quite convoluted.
How about the following:
unbindEvents() {
...
// Kept for backward compatibility purpose
publicAPI.setContainer(null);
}
setContainer(newContainer) {
if (newContainer === model.container) {
return false;
}
unbindEvents();
model.container = newContainer;
bindEvents();
return true;
}
// container parameter is for backward compatibility purpose
bindEvents(container = model.container){
if (model.container != container) {
setContainer(container)
return;
}
...
}
...
publicAPI.delete(
...
setContainer(null);
}
And to not forget about modified()
and _onContainerChanged()
(see macro.js::findSetter()
,
setContainer(newContainer) {
if (newContainer === model.container) {
return false;
}
unbindEvents();
const res = superclass.setContainer(newContainer);
bindEvents(model.container);
return res;
}
...
macro.setGet(...[container]);
Oh yes, thanks for reminding about I don't agree on the new call tree you suggested. It is more complex to my eyes. Specially since |
16deccc
to
4731fad
Compare
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.
LGTM
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.
One last change needed: the getContainer()
type needs to be updated to be getContainer(): Nullable<HTMLElement>
. You can also update the setContainer
type to use Nullable for consistency.
When rebinding events with a different container, make sure all timeouts and state variables from previous containter are cleared.
4731fad
to
dae07b6
Compare
LGTM |
🎉 This PR is included in version 29.4.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Brief Description
When rebinding events with a different container, make sure all timeouts and state variables from previous container are cleared.
This PR is part of a react-vtk-js fix for out-of-focus wheel events (Kitware/react-vtk-js#125)
Context
Results
Changes
PR and Code Checklist
npm run reformat
to have correctly formatted codeTesting
This change adds or fixes unit tests