File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ impl TransitionTrait for SlideTransition {
9494 fn create_child_ui ( & self , ui : & mut Ui , t : f32 , with_id : Id ) -> Ui {
9595 let available_size = ui. available_size ( ) ;
9696 let offset = available_size * ( 1.0 - t) * self . amount ;
97+ // Round to pixels to prevent sub-pixel jitter and flickering in child components
98+ let offset = Vec2 :: new ( offset. x . round ( ) , offset. y . round ( ) ) ;
9799 let child_rect = ui. max_rect ( ) . translate ( offset) ;
98100
99101 ui. new_child ( UiBuilder :: new ( ) . max_rect ( child_rect) . id_salt ( with_id) )
Original file line number Diff line number Diff line change @@ -130,9 +130,9 @@ impl VirtualList {
130130 ) -> VirtualListResponse {
131131 let mut scroll_to_item_index_visibility = None ;
132132 {
133- let available_width_rounded = ( ui. available_width ( ) * 10.0 ) . round ( ) / 10.0 ;
133+ let available_width_rounded = ( ui. max_rect ( ) . width ( ) * 10.0 ) . round ( ) / 10.0 ;
134134 if let Some ( last_width) = self . last_width {
135- if available_width_rounded != last_width {
135+ if ( available_width_rounded - last_width) . abs ( ) > 1.0 {
136136 self . last_width = Some ( available_width_rounded) ;
137137 if self . check_for_resize {
138138 self . last_known_row_index = None ;
You can’t perform that action at this time.
0 commit comments