use gpui_kit::{Hsla, Pixels, Window};
use super::{
CellChange, LiveGridDelegate,
a11y::RowOutline,
change::RowChanges,
frame::{FillRuns, PlannedRow, RowPlanner},
};
use crate::{
element::Region,
engine::DisplayRow,
highlight::RowChange,
model::ColumnSet,
store::{RowId, StoreSnapshot},
};
pub(super) struct FadingLine {
pub(super) id: RowId,
pub(super) y: Pixels,
pub(super) display_ix: usize,
pub(super) line: DisplayRow,
pub(super) background: Option<Hsla>,
}
impl<D: LiveGridDelegate> RowPlanner<'_, D> {
pub(super) fn plan_fading_line(
&mut self,
fading: &FadingLine,
snapshot: &StoreSnapshot<D::Row>,
regions: &mut [Region; 3],
fills: &mut [FillRuns; 3],
window: &mut Window,
) -> bool {
let Some((row, removed)) = snapshot.fading_row(fading.id) else {
return false;
};
let Some(intensity) = self.policy.removal_intensity(removed, self.tick) else {
return false;
};
let change = CellChange {
intensity,
change: RowChange::Removed,
direction: None,
column_ix: None,
};
let a11y = self.a11y.take();
self.plan_row(
&PlannedRow {
row,
y: fading.y,
changes: RowChanges::Removed(change),
display_ix: fading.display_ix,
line: Some(fading.line),
outline: RowOutline::default(),
pinned: None,
background: fading.background,
foreground: self.palette.foreground,
selected: ColumnSet::EMPTY,
whole_row: false,
focused_column: None,
hovered_column: None,
},
regions,
Some(fills),
window,
);
self.a11y = a11y;
true
}
}