mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-31 13:37:37 -06:00
UI: show an open padlock on an unlocked Composition / Timeline viewer lock
The viewer lock in a tab group's header drew the same closed padlock in both states, told apart only by brightness. Unlocked now draws an open padlock, locked the closed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5ed248bece
commit
a56a42c096
@@ -654,7 +654,8 @@ pub fn doc_tabs(
|
||||
out
|
||||
}
|
||||
|
||||
/// A viewer lock button (Composition viewers and the Timeline keep their comp while locked).
|
||||
/// A viewer lock button (Composition viewers and the Timeline keep their comp while locked): a
|
||||
/// closed padlock while locked, an open one while unlocked.
|
||||
/// Returns true when clicked. Automation: `panel.tab.<panel>.lock`.
|
||||
pub fn lock_button(ui: &mut egui::Ui, rect: Rect, panel: PanelKind, locked: bool, t: &Tokens, reg: &mut crate::automation::Registry) -> bool {
|
||||
let resp = ui.interact(rect, egui::Id::unique(("tab-lock", panel.id())), Sense::click());
|
||||
@@ -665,7 +666,7 @@ pub fn lock_button(ui: &mut egui::Ui, rect: Rect, panel: PanelKind, locked: bool
|
||||
} else {
|
||||
t.text_faint
|
||||
};
|
||||
icons::paint(ui.painter(), rect.shrink(2.0), Icon::Lock, color);
|
||||
icons::paint(ui.painter(), rect.shrink(2.0), if locked { Icon::Lock } else { Icon::LockOpen }, color);
|
||||
reg.add_response(&format!("panel.tab.{}.lock", panel.id()), &resp, if locked { "Unlock" } else { "Lock" });
|
||||
crate::widgets::focus_outline(ui, &resp, t);
|
||||
resp.clicked()
|
||||
|
||||
@@ -48,6 +48,8 @@ pub enum Icon {
|
||||
Speaker,
|
||||
Solo,
|
||||
Lock,
|
||||
/// An open padlock: the shackle lifted clear of the body on the right.
|
||||
LockOpen,
|
||||
Shy,
|
||||
Collapse,
|
||||
Quality,
|
||||
@@ -402,6 +404,12 @@ pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32) {
|
||||
pen.arc(8.0, 7.0, 3.0, 180.0, 360.0);
|
||||
pen.dot(8.0, 10.5, 1.0);
|
||||
}
|
||||
LockOpen => {
|
||||
pen.rect(3.5, 7.0, 12.5, 14.0);
|
||||
pen.arc(8.0, 4.0, 3.0, 180.0, 360.0);
|
||||
pen.line(&[(5.0, 4.0), (5.0, 7.0)]);
|
||||
pen.dot(8.0, 10.5, 1.0);
|
||||
}
|
||||
Shy => {
|
||||
pen.circle(8.0, 8.0, 5.8);
|
||||
pen.dot(6.0, 7.0, 0.8);
|
||||
|
||||
Reference in New Issue
Block a user