Make cursor respect the captured element#21421
Conversation
|
You can test this PR using the following package version. |
|
Clicking on the text of a TextBox now permanently changes cursor to default. |
Good catch thanks. I've tested a lot of dragging around, changing cursors on the fly, and missed this basic scenario :) |
|
That scenario is now tested and fixed. |
|
You can test this PR using the following package version. |
|
Could you also check the case when clicking on non-text area of TextBox? The cursor flashes quickly on pointer release (changes from IBeam to default and back). |
That one was subtle. When the capture gets released, we don't have a new pointer-over element yet, causing the cursor to revert back for one frame. The pointer-over element is now updated immediately after the capture changes. |
|
You can test this PR using the following package version. |
|
Thank you, with the latest changes this issue is fixed AvaloniaUI/AvaloniaEdit#585 |
* Add failing test for cursor when pointer changes * Introduce PresentationSource.CursorElement * Update cursor on capture change * Set correct cursor when capture is released * Recompute pointer-over element immediately when capture changes
What does the pull request do?
This PR ensures that the cursor always comes from the captured element, if there's one (otherwise it reverts to the pointer-over element).
Unit tests have been added.
Note that this does not change the pointer-over behavior itself (in other words, #19156 is not affected by this PR).
What is the current behavior?
The cursor changes as soon as the pointer-over element changes, even if there's a capture.
What is the updated/expected behavior with this PR?
The cursor always comes from the captured element if there's one.
Fixed issues