Fix fold indicator offsets

This commit is contained in:
Mikayla Maki 2023-03-22 17:04:52 -07:00
parent 194c7a3af0
commit e729c4ad4f

View File

@ -576,13 +576,16 @@ impl EditorElement {
for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {
if let Some(indicator) = fold_indicator.as_mut() {
let mut x = bounds.width() - layout.gutter_padding;
let mut y = ix as f32 * line_height - scroll_top;
let position = vec2f(
bounds.width() - layout.gutter_padding,
ix as f32 * line_height - (scroll_top % line_height),
);
let centering_offset = vec2f(
((layout.gutter_padding + layout.gutter_margin - indicator.size().x()) / 2.),
(line_height - indicator.size().y()) / 2.,
);
x += ((layout.gutter_padding + layout.gutter_margin) - indicator.size().x()) / 2.;
y += (line_height - indicator.size().y()) / 2.;
let indicator_origin = bounds.origin() + vec2f(x, y);
let indicator_origin = bounds.origin() + position + centering_offset;
indicator.paint(indicator_origin, visible_bounds, cx);
}