fix clip heights

This commit is contained in:
🪞👃🪞 2025-01-16 19:51:55 +01:00
parent 3030f28ef7
commit dff6f1e279

View file

@ -502,33 +502,32 @@ impl Tek {
let color: ItemPalette = track.color.dark.into(); let color: ItemPalette = track.color.dark.into();
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0)))); let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
map_east(x1 as u16, w, border(Map::new(scenes, move|(_, scene, y1, y2), s| { map_east(x1 as u16, w, border(Map::new(scenes, move|(_, scene, y1, y2), s| {
let last_color = last_color.clone();
let h = (1 + y2 - y1) as u16; let h = (1 + y2 - y1) as u16;
let color = scene.color; let color = scene.color;
let (name, fg, bg) = if let Some(c) = &scene.clips[t] { let (name, fg, bg) = if let Some(c) = &scene.clips[t] {
let c = c.read().unwrap(); let c = c.read().unwrap();
(c.name.to_string(), c.color.lightest.rgb, c.color.base.rgb) (c.name.to_string(), c.color.lightest.rgb, c.color)
} else { } else {
("".to_string(), TuiTheme::g(64), TuiTheme::g(32)) ("".to_string(), TuiTheme::g(64), TuiTheme::g(32).into())
}; };
let same_track = selected_track == Some(t+1); let same_track = selected_track == Some(t+1);
let selected = same_track && Some(s+1) == selected_scene; let selected = same_track && Some(s+1) == selected_scene;
let neighbor = same_track && Some(s) == selected_scene; let neighbor = same_track && Some(s) == selected_scene;
let active = editing && selected; let active = editing && selected;
let label = move||Tui::fg(fg, Push::x(1, Tui::bold(true, name.to_string()))); let label = move||Tui::fg(fg, Push::x(1, Tui::bold(true, name.to_string())));
let mid = if active { bg.light } else { bg.base };
let top = if neighbor { None } else { Some(last_color.read().unwrap().base.rgb) };
let mid = mid.rgb;
let low = Color::Rgb(0, 0, 0);
*last_color.write().unwrap() = bg;
map_south(y1 as u16, h, Push::y(1, Fixed::y(h, Either::new(active, map_south(y1 as u16, h, Push::y(1, Fixed::y(h, Either::new(active,
Thunk::new(||Bsp::a( Thunk::new(||Bsp::a(
Fill::xy(Align::nw(button(" Tab ".into(), "".into()))), Fill::xy(Align::nw(button(" Tab ".into(), "".into()))),
&self.editor)), &self.editor)),
Thunk::new(move||Bsp::a( Thunk::new(move||Bsp::a(
When::new(selected, Fill::y(Align::n(button(" Tab ".into(), "edit".into())))), When::new(selected, Fill::y(Align::n(button(" Tab ".into(), "edit".into())))),
phat_sel_3( phat_sel_3(selected, label(), label(), top, mid, low)
selected,
label(),
label(),
if neighbor { None } else { Some(bg.into()) },
bg.into(),
bg.into(),
)
)), )),
)))) ))))
}))).boxed() }))).boxed()
@ -1119,19 +1118,20 @@ trait HasScenes: HasSelection + HasEditor + Send + Sync {
let selected = self.selected().scene(); let selected = self.selected().scene();
let iter = ||self.scenes_sizes(self.is_editing(), 2, 15); let iter = ||self.scenes_sizes(self.is_editing(), 2, 15);
Map::new(iter, move|(_, scene, y1, y2), i| { Map::new(iter, move|(_, scene, y1, y2), i| {
let h = (1 + y2 - y1) as u16; let h = (1 + y2 - y1) as u16;
let name = format!("🭬{}", &scene.name); let name = format!("🭬{}", &scene.name);
let color = scene.color; let color = scene.color;
let active = selected == Some(i + 1); let active = selected == Some(i + 1);
let mid = if active { color.light } else { color.base }; let neighbor = selected == Some(i);
let top = Some(last_color.read().unwrap().base.rgb); let mid = if active { color.light } else { color.base };
let cell = phat_sel_3( let top = if neighbor { None } else { Some(last_color.read().unwrap().base.rgb) };
let mid = mid.rgb;
let low = Color::Rgb(0, 0, 0);
let cell = phat_sel_3(
active, active,
Tui::bold(true, name.clone()), Tui::bold(true, name.clone()),
Tui::bold(true, name), Tui::bold(true, name),
top, top, mid, low
mid.rgb,
Color::Rgb(0, 0, 0)
); );
*last_color.write().unwrap() = color; *last_color.write().unwrap() = color;
map_south(y1 as u16, h, Push::y(1, Fixed::y(h, map_south(y1 as u16, h, Push::y(1, Fixed::y(h,