You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit of an odd case and took me a long time to track down.
Use case:
Two windows - a primary and a secondary.
Primary window requires re-painting at 60fps (rendering animations/frames/etc)
Secondary window only requires re-painting in response to user interaction (e.g. a preferences window)
Trying to select text in the secondary window works fine only when it's the one being repainted. If the primary window repaints after selection has started, selection is cleared.
The relevant lines of code are from the label_text_selection.rs module:
if !state.has_reached_primary || !state.has_reached_secondary{// We didn't see both cursors this frame,// maybe because they are outside the visible area (scrolling),// or one disappeared. In either case we will have horrible glitches, so let's just deselect.let prev_selection = state.selection.take();
I suspect the reason this happens is because the store/load happening for the temporary selection state is not keyed at all by viewport, and because deferred viewports require their own begin/end frame cycle it ends up clearing the selection since the primary window was repainted and no widgets matched the current selection state.
Describe the bug
This is a bit of an odd case and took me a long time to track down.
Use case:
Two windows - a primary and a secondary.
Primary window requires re-painting at 60fps (rendering animations/frames/etc)
Secondary window only requires re-painting in response to user interaction (e.g. a preferences window)
Trying to select text in the secondary window works fine only when it's the one being repainted. If the primary window repaints after selection has started, selection is cleared.
The relevant lines of code are from the
label_text_selection.rs
module:I suspect the reason this happens is because the store/load happening for the temporary selection state is not keyed at all by viewport, and because deferred viewports require their own begin/end frame cycle it ends up clearing the selection since the primary window was repainted and no widgets matched the current selection state.
To Reproduce
ctx.request_repaint_of(ViewportId::ROOT);
to the mainupdate
methodExpected behavior
I'd expect selecting labels to work correctly
Desktop (please complete the following information):
Additional context
I was able to get a working version with the following. If it's acceptable, I can create a PR:
The text was updated successfully, but these errors were encountered: