Remove frame lag when creating loop region#11862
Conversation
|
Web viewer built successfully.
View image diff on kitdiff. Note: This comment is updated whenever you push a commit. |
IsseW
left a comment
There was a problem hiding this comment.
Looks good, also nice to factor out into a function
| let selected_range = time_commands | ||
| .iter() | ||
| .rev() | ||
| .find_map(|c| { |
| .iter() | ||
| .rev() | ||
| .find_map(|c| { | ||
| if let TimeControlCommand::SetLoopSelection(range) = c { |
There was a problem hiding this comment.
Could possibly check for a RemoveLoopSelection here to also have that not be frame delayed. But not as important as setting it
There was a problem hiding this comment.
More of a thought, not something I think needs any actions
There was a problem hiding this comment.
True, but removal is much less sensitive to frame delays than dragging is, so I rather not add the complexity now
| // Use latest range to avoid frame delay | ||
| let selected_range = time_commands | ||
| .iter() | ||
| .rev() | ||
| .find_map(|c| { | ||
| if let TimeControlCommand::SetLoopSelection(range) = c { | ||
| Some(AbsoluteTimeRangeF::from(*range)) | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| .or(time_ctrl.loop_selection())?; |
There was a problem hiding this comment.
I wish there was a nicer way to query this out, feels hacky :/
There was a problem hiding this comment.
I don't think it's that hacky when you consider that time_commands will almost always be empty. Might be nice to have a function for this if similar pattern pops up more times though.
There was a problem hiding this comment.
I think the nice way to re-arrange this at some point is to put the time commands into ctx and then have helpers on ctx to get the latest values, including pending commands. Maybe.
| let corner_radius = tokens.normal_corner_radius(); | ||
| let corner_radius = egui::CornerRadius { | ||
| nw: corner_radius, | ||
| ne: corner_radius, | ||
| sw: 0, | ||
| se: 0, | ||
| }; |
This was already very noticeable at 60 Hz. My bad for only using 120Hz+ in my day-to-day


This was already very noticeable at 60 Hz. My bad for only using 120Hz+ in my day-to-day