Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into HEAD

bflatasticd5163b612542
diff --cc crates/ui-egui/src/panels/markers_ui.rs
index 186dfafb7,14e774f67..cc08f223d
--- a/crates/ui-egui/src/panels/markers_ui.rs
+++ b/crates/ui-egui/src/panels/markers_ui.rs
@@@ -298,23 -300,10 +300,23 @@@ fn marker(app: &mut EffectcraftApp, ui
}
p.add(egui::Shape::convex_polygon(marker_shape(x, y0, h), col, Stroke::NONE));
if !m.comment.is_empty() {
- p.text(pos2(x + 7.0, y0 + h / 2.0), Align2::LEFT_CENTER, m.comment.lines().next().unwrap_or_default(), Tokens::ui(10.0), t.text);
+ // The name sits in a small outlined box beside the flag, as in After Effects. It is drawn in the theme's field
+ // colours, so it follows Dark, Darker and Light.
+ let galley = p.layout_no_wrap(m.comment.lines().next().unwrap_or_default().to_string(), Tokens::ui(10.0), t.text);
+ let (box_w, mut box_x) = (galley.size().x + 8.0, x + 6.0);
+ // A duration that ends under the box would be hidden by its fill: the box steps past the end cap instead.
+ if let Some(xe) = end
+ && xe > box_x
+ && xe < box_x + box_w
+ {
+ box_x = xe + 3.0;
+ }
+ let box_rect = Rect::from_min_size(pos2(box_x, y0), vec2(box_w, h.max(galley.size().y + 2.0)));
+ p.rect(box_rect, t.radius_sm, t.field_bg, Stroke::new(1.0, t.field_border), egui::StrokeKind::Inside);
+ p.galley(pos2(box_rect.min.x + 4.0, box_rect.center().y - galley.size().y / 2.0), galley, t.text);
}
let hit = Rect::from_min_max(pos2(x - 5.0, y0 - 1.0), pos2(x + 5.0, y1));
- let id = egui::Id::new(("marker", r.layer, r.index));
+ let id = egui::Id::unique(("marker", r.layer, r.index));
let resp = ui.interact(hit, id, Sense::click_and_drag());
app.auto.add(&r.auto_id(), hit, if m.comment.is_empty() { "marker" } else { &m.comment });
let tip = if m.comment.is_empty() { "Marker".to_string() } else { m.comment.clone() };