Fix scroll_to with align

Broke in https://github.com/emilk/egui/pull/1252
This commit is contained in:
Emil Ernerfeldt 2022-02-17 16:45:42 +01:00
parent 4af3cae26d
commit 4e316d32e5

View file

@ -507,7 +507,7 @@ impl Prepared {
// Depending on the alignment we need to add or subtract the spacing // Depending on the alignment we need to add or subtract the spacing
spacing *= remap(center_factor, 0.0..=1.0, -1.0..=1.0); spacing *= remap(center_factor, 0.0..=1.0, -1.0..=1.0);
offset + spacing offset + spacing - state.offset[d]
} else if start < clip_start && end < clip_end { } else if start < clip_start && end < clip_end {
-(clip_start - start + spacing).min(clip_end - end - spacing) -(clip_start - start + spacing).min(clip_end - end - spacing)
} else if end > clip_end && start > clip_start { } else if end > clip_end && start > clip_start {