mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-06 00:41:16 -05:00
Masking: inset sliders, fixed decimals, wider overlay dropdown, non-selectable row labels; save effect dialog width and label colours
This commit is contained in:
@@ -81,7 +81,8 @@ pub(super) fn show_root(app: &mut LightcraftApp, root: &mut egui::Ui, blocked: b
|
||||
});
|
||||
})
|
||||
.show(root, |ui, _| {
|
||||
ui.set_min_width(380.0);
|
||||
// the dialog is as wide as its body asks: a fixed width, not the whole window
|
||||
ui.set_width(425.0);
|
||||
ui.spacing_mut().item_spacing.y = 8.0;
|
||||
if let Dialog::SaveEffect { name, group, fields, amount, brush } = &mut dialog {
|
||||
let submitted = crate::panels::mask_effects::save_body(app, ui, name, group, fields, amount, brush);
|
||||
|
||||
@@ -216,7 +216,7 @@ pub fn effect_row(app: &mut LightcraftApp, ui: &mut egui::Ui, mask: &Mask) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
egui::Frame::NONE.inner_margin(egui::Margin { left: 24, right: 22, top: 2, bottom: 4 }).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(crate::i18n::tr("Effect")).font(t.font(12.0)).color(t.text_label));
|
||||
ui.add(egui::Label::new(egui::RichText::new(crate::i18n::tr("Effect")).font(t.font(12.0)).color(t.text_label)).selectable(false));
|
||||
let current = fx::matching_effect(&app.session, &mask.adjust);
|
||||
let label = current.as_deref().map(display_name).unwrap_or_else(|| crate::i18n::tr("Custom").to_string());
|
||||
let r = crate::widgets::dropdown(ui, "maskEffect", &label, t.font(12.0), t.text);
|
||||
@@ -491,6 +491,9 @@ fn save_naming_field(ui: &mut egui::Ui, widget: &str, value: &mut String, hint:
|
||||
eligible && shown.submitted
|
||||
}
|
||||
|
||||
/// How wide the button that picks an existing group is.
|
||||
const PICKER_WIDTH: f32 = 28.0;
|
||||
|
||||
/// The New Effect Preset dialog's body.
|
||||
pub fn save_body(
|
||||
app: &LightcraftApp,
|
||||
@@ -521,8 +524,8 @@ pub fn save_body(
|
||||
let mut popup_probe_buttons: Vec<(String, egui::Response)> = Vec::new();
|
||||
ui.horizontal(|ui| {
|
||||
// Group Return ends its field but must never use Name's Save path.
|
||||
save_naming_field(ui, "field:effectGroup", group, "Group (optional)", ui.available_width() - 30.0, false);
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width().max(1.0), ui.spacing().interact_size.y.max(24.0)), Sense::hover());
|
||||
save_naming_field(ui, "field:effectGroup", group, "Group (optional)", ui.available_width() - PICKER_WIDTH - ui.spacing().item_spacing.x, false);
|
||||
let (rect, _) = ui.allocate_exact_size(vec2(PICKER_WIDTH, ui.spacing().interact_size.y.max(24.0)), Sense::hover());
|
||||
let picker = Button::new("…").id_salt("button:effectGroupPick").tooltip(crate::i18n::tr("Choose a group").to_owned()).show_at(ui, rect);
|
||||
if real {
|
||||
register_response("button:effectGroupPick", picker.rect, &picker);
|
||||
@@ -625,7 +628,7 @@ pub fn save_body(
|
||||
egui::FontFamily::Monospace => FontRef::monospace(),
|
||||
egui::FontFamily::Name(name) => FontRef::named(name),
|
||||
};
|
||||
let run = DocRun::new(words.clone(), face, font.size, DataColor::new(if changed_here { t.text } else { t.text_dim }));
|
||||
let run = DocRun::new(words.clone(), face, font.size, DataColor::new(if changed_here { t.text } else { t.text_label }));
|
||||
let run = if changed_here { run.bold() } else { run };
|
||||
let shown = cx.labelled_with(
|
||||
&mut cols[i % 2],
|
||||
|
||||
@@ -198,7 +198,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
|
||||
// mask list
|
||||
egui::Frame::NONE.inner_margin(egui::Margin { left: 16, right: 16, top: 8, bottom: 8 }).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(crate::i18n::tr("Masks")).font(t.semibold(13.0)).color(t.text_label));
|
||||
ui.add(egui::Label::new(egui::RichText::new(crate::i18n::tr("Masks")).font(t.semibold(13.0)).color(t.text_label)).selectable(false));
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
let on = app.ui.mask_overlay;
|
||||
if icon_button(ui, "maskOverlay", Icon::Eye, vec2(24.0, 24.0), on, true, "Show overlay (O)").clicked() {
|
||||
@@ -488,12 +488,16 @@ fn mask_local_scalar(app: &mut LightcraftApp, ui: &mut egui::Ui, target: (PhotoI
|
||||
.fill(false)
|
||||
.enabled(enabled)
|
||||
.number_codec(
|
||||
NumberCodec::new(Reader::new(), usize::from(spec.decimals)).parse_with(move |text| crate::widgets::typed_value(&number_spec, text)),
|
||||
NumberCodec::new(Reader::new(), usize::from(spec.decimals)).fixed().parse_with(move |text| crate::widgets::typed_value(&number_spec, text)),
|
||||
);
|
||||
if let Some(face) = mask_local_track::face(spec.track) {
|
||||
control = control.track_face(face);
|
||||
}
|
||||
let out = with_env(ui, |env| env.wheel = Some(WheelScope::Directional), |ui| control.show(ui));
|
||||
// (inset like the other rows of the panel, so the label and the value box lie inside it)
|
||||
let out = egui::Frame::NONE
|
||||
.inner_margin(egui::Margin { left: 24, right: 22, top: 0, bottom: 0 })
|
||||
.show(ui, |ui| with_env(ui, |env| env.wheel = Some(WheelScope::Directional), |ui| control.show(ui)))
|
||||
.inner;
|
||||
// PaintUi::{child,labelled} document parent.with(key). Read the actual rendered responses:
|
||||
// aliases never stand in for a synthetic hit, layout guess, or the composite's non-slider group.
|
||||
for (prefix, child) in [("slider", "slider"), ("sliderValue", "field"), ("sliderField", "field")] {
|
||||
@@ -760,11 +764,11 @@ fn overlay_options(app: &mut LightcraftApp, ui: &mut egui::Ui) {
|
||||
let parent_enabled = ui.is_enabled();
|
||||
let view = MaskView::parse(&app.ui.mask_overlay_mode).unwrap_or_default();
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(crate::i18n::tr("Overlay")).color(t.text_dim));
|
||||
ui.add(egui::Label::new(egui::RichText::new(crate::i18n::tr("Overlay")).color(t.text_dim)).selectable(false));
|
||||
// Reserve the original dropdown's size and automatic response ID. The SDK owns
|
||||
// its list, real focus, proposals and cancellation; only a pick runs the command.
|
||||
let g = one_line(ui.painter(), menu_label(view.label()), t.font(12.5), t.text_label, f32::INFINITY);
|
||||
let (id, rect) = ui.allocate_space(vec2(g.size().x + 20.0, g.size().y.max(20.0)));
|
||||
let (id, rect) = ui.allocate_space(vec2(g.size().x + 44.0, g.size().y.max(20.0)));
|
||||
let entries: Vec<_> = MaskView::ALL.into_iter().map(|v| Entry::new(v.name().to_owned(), menu_label(v.label()))).collect();
|
||||
let out = Select::new(crate::i18n::tr("Overlay"), Bind::given(view.name().to_owned()), &entries).id(id).enabled(real).show_at(ui, rect);
|
||||
if real {
|
||||
|
||||
Reference in New Issue
Block a user