diff --git a/crates/op-editor-ui/src/widgets/mod.rs b/crates/op-editor-ui/src/widgets/mod.rs index b722af940..149b45ed1 100644 --- a/crates/op-editor-ui/src/widgets/mod.rs +++ b/crates/op-editor-ui/src/widgets/mod.rs @@ -42,6 +42,7 @@ mod layer_panel_tests; mod layer_panel_walkers; pub mod property_panel; pub mod property_panel_code; +pub mod property_panel_effects; pub mod property_panel_fill; pub mod property_panel_inputs; pub mod property_panel_layout; diff --git a/crates/op-editor-ui/src/widgets/property_panel_effects.rs b/crates/op-editor-ui/src/widgets/property_panel_effects.rs new file mode 100644 index 000000000..e0e69cca5 --- /dev/null +++ b/crates/op-editor-ui/src/widgets/property_panel_effects.rs @@ -0,0 +1,128 @@ +//! Effects-section paint helpers for [`crate::widgets::PropertyPanel`]. +//! Split out of `property_panel_sections.rs` to honor the 800-line +//! file ceiling. Each effect block paints a type row plus one +//! parameter row per editable scalar field. + +use crate::theme::Theme; +use crate::widgets::icons::{draw_icon, Icon}; +use crate::widgets::property_panel::EffectSummary; +use crate::widgets::property_panel_inputs::{ + paint_section_divider, paint_section_label_with_add, to_jian_color, INPUT_HEIGHT, PAD_X, + SECTION_GAP, +}; +use crate::widgets::property_panel_layout::{ + effect_param_fields, EFFECT_PARAM_ROW_HEIGHT, EFFECT_ROW_HEIGHT, +}; +use crate::widgets::property_panel_sections::PropertyLabels; +use crate::widgets::PaintCx; +use crate::{Point2D, Rect, TextLayout}; + +// ── Effects section ─────────────────────────────────────────────── + +pub fn paint_effects_section( + cx: &mut PaintCx<'_>, + theme: &Theme, + labels: &PropertyLabels, + effects: &[EffectSummary], + x: f32, + y: f32, + width: f32, +) -> f32 { + let mut row_y = paint_section_label_with_add(cx, theme, labels.effects, x, y, width); + if effects.is_empty() { + row_y += 8.0; + } else { + for eff in effects { + paint_effect_row(cx, theme, eff, x, row_y, width); + row_y += EFFECT_ROW_HEIGHT; + for &(field, label) in effect_param_fields(eff.kind) { + paint_effect_param_row(cx, theme, label, eff.param_value(field), x, row_y, width); + row_y += EFFECT_PARAM_ROW_HEIGHT; + } + } + } + paint_section_divider(cx, theme, x, row_y, width); + row_y + SECTION_GAP +} + +/// Paint one effect-parameter row: `