From 448b39ec6c8c398aaf7a8fd5226bc0dd5cfa9d71 Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Sun, 17 May 2026 14:45:43 +0800 Subject: [PATCH] refactor(panels): split effects paint into property_panel_effects.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `property_panel_sections.rs` reached 862 lines after the effect parameter-stepper work — over the 800-line repo file gate. Move `paint_effects_section` + `paint_effect_row` + `paint_effect_param_row` into a new `property_panel_effects.rs` (128 lines) and re-export `paint_effects_section` from `property_panel_sections` so callers keep using `sections::*`. `property_panel_sections.rs` is now 755 lines. No behaviour change; op-editor-ui 140 / op-host-desktop 64 tests green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- crates/op-editor-ui/src/widgets/mod.rs | 1 + .../src/widgets/property_panel_effects.rs | 128 ++++++++++++++++++ .../src/widgets/property_panel_sections.rs | 121 +---------------- 3 files changed, 136 insertions(+), 114 deletions(-) create mode 100644 crates/op-editor-ui/src/widgets/property_panel_effects.rs 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: `