@@ -855,6 +855,8 @@ impl SplitScrollDelegate for TableSplitScrollDelegate<'_> {
855855 . entry ( column_id)
856856 . or_insert ( column. current ) ;
857857
858+ let layout_width = * column_width; // Width used when computing col_x
859+
858860 if ui. is_sizing_pass ( ) || column. auto_size_this_frame {
859861 // Shrink to fit the widest element in the column:
860862 * column_width = used_width;
@@ -865,7 +867,8 @@ impl SplitScrollDelegate for TableSplitScrollDelegate<'_> {
865867
866868 let column_resize_id = self . id . with ( column. id_for ( col_nr) ) . with ( "resize" ) ;
867869
868- let mut x = self . col_x [ col_nr + 1 ] - scroll_offset. x ; // Right side of the column
870+ // Right side of the column, adjusted for any width change since layout:
871+ let mut x = self . col_x [ col_nr + 1 ] - scroll_offset. x + ( * column_width - layout_width) ;
869872 let yrange = Rangef :: new ( * top, ui. clip_rect ( ) . bottom ( ) ) ;
870873 let line_rect = egui:: Rect :: from_x_y_ranges ( x..=x, yrange)
871874 . expand ( ui. style ( ) . interaction . resize_grab_radius_side ) ;
@@ -876,25 +879,13 @@ impl SplitScrollDelegate for TableSplitScrollDelegate<'_> {
876879 if resize_response. dragged ( )
877880 && let Some ( pointer) = ui. ctx ( ) . pointer_latest_pos ( )
878881 {
879- let desired_new_width = * column_width + pointer. x - x;
880- let desired_new_width = column. range . clamp ( desired_new_width) ;
881-
882- // We don't want to shrink below the size that was actually used.
883- // However, we still want to allow content that shrinks when you try
884- // to make the column less wide, so we allow some small shrinkage each frame:
885- // big enough to allow shrinking over time, small enough not to look ugly when
886- // shrinking fails. This is a bit of a HACK around immediate mode.
887- // TODO: do something smarter by remembering success/failure to resize from one frame to the next.
888- // Probably best solved by implementing `ui.intrinsic_size`.
889- let max_shrinkage_per_frame = 8.0 ;
890- let new_width = desired_new_width. at_least ( used_width - max_shrinkage_per_frame) ;
882+ // Drag-to-resize.
883+ // TODO: use `ui.intrinsic_size` (once it exist) to prevent
884+ // resizing below what the content can fit within.
885+ let new_width = * column_width + pointer. x - x;
891886 let new_width = column. range . clamp ( new_width) ;
892887 x += new_width - * column_width;
893888 * column_width = new_width;
894-
895- if new_width != desired_new_width {
896- ui. ctx ( ) . request_repaint ( ) ; // Get there faster
897- }
898889 }
899890
900891 let dragging_something_else =
0 commit comments