-
Notifications
You must be signed in to change notification settings - Fork 567
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
Add hot state updating via wheel events. #951
Conversation
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.
Looks good.
I was wondering why MouseMove
is a special case for recursion.
It should probably get a comment about why that was done.
Should I open an issue for that?
No need for an issue, I'll send a simple PR with that comment in a few minutes. |
I have a thought related to this that I'm not sure I've ever spelled out: I think it should be an invariant that changes in mouse position always generate a move event. That is: a click or a wheel or any other mouse event should always occur at the same position as the last move. If this isn't something the platform enforces, it's something that we could implement in druid-shell. I think this offers a lot of clarity at the druid layer; it would simplify a lot of code, and would then be a very useful guarantee that we could pass along to users. Is there any reason this doesn't make sense? |
Yeah that makes sense and we can do it. I don't think any of the platforms we support guarantee a move event before click, but |
Yes, this sounds like a good idea, after all widgets care about mouse movement relative to their own position, which would be changed by scrolling a |
I wouldn't include scroll in this, I think that's an over-complication. |
Hmm, well this is actually a bit tricky. So Druid would still suffer. Imagine the following scenario:
I don't think this can be solved without keeping some sort of state per widget about the mouse location. This would have to be in Thus I'm not sure if it's worth doing this move event guarantee. It would end up in more complex code than right now. |
I guess the other thing to consider is do we want to make scrolling first-class, and have some sort of 'ScrollChanged' lifecycle event? |
Not sure I understand. (Also just to be clear, my example above about a widget moving is independent of scrolling and can happen with regular widgets and regular clicks.) |
I think druid should generate |
Hot state is already updated after layout changes. I think this is something specific to |
I see, as long as hot state is reliable, it could be ok not to generate |
I think And yes, |
This fixes an edge case where we receive a wheel event at a location different than the last move event.