From fd21bc4f0485cb6acacac05b685c14498a5392fa Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 12 Oct 2026 00:19:29 +0000 Subject: [PATCH] =?UTF-8?q?Integration:=20Properties=20=E2=80=BA=20Transfo?= =?UTF-8?q?rm=20rotate=20and=20flip=20buttons=20use=20the=20Control=20pane?= =?UTF-8?q?l's=20icons=20(#541)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #541 adds rotate-cw, rotate-ccw, flip-h and flip-v icons for its Properties › Transform buttons; next's Control panel already draws the same actions with rotate-clockwise, tool-rotate, flip-horizontal and flip-vertical. The Properties buttons use those, and the PR's duplicate icon arms are removed so both panels show the same icons. --- crates/ui-egui/src/icons.rs | 23 ----------------------- crates/ui-egui/src/panels/properties.rs | 8 ++++---- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs index a734dab70..eac798497 100644 --- a/crates/ui-egui/src/icons.rs +++ b/crates/ui-egui/src/icons.rs @@ -189,29 +189,6 @@ pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) { pen.fill(&[(4.0, 3.0), (10.0, 8.0), (16.0, 3.0)]); pen.closed(&[(4.0, 17.0), (10.0, 12.0), (16.0, 17.0)]); } - // Properties › Transform: rotate a quarter turn (an arc over a square), flip (a shape and its - // mirror image across a dashed axis). - "rotate-cw" | "rotate-ccw" => { - let m = |x: f32| if name == "rotate-ccw" { 20.0 - x } else { x }; - pen.rect(m(3.0).min(m(11.0)), 9.0, m(3.0).max(m(11.0)), 17.0); - let pts: Vec<(f32, f32)> = (0..12) - .map(|i| { - let a = std::f32::consts::PI * (1.0 - i as f32 / 11.0); - (m(11.0 + 5.0 * a.cos()), 9.0 - 5.0 * a.sin()) - }) - .collect(); - pen.line(&pts); - pen.line(&[(m(14.0), 7.0), (m(16.0), 9.5), (m(18.0), 7.0)]); - } - "flip-h" | "flip-v" => { - let t = |x: f32, y: f32| if name == "flip-v" { (y, x) } else { (x, y) }; - pen.fill(&[t(3.0, 16.0), t(8.5, 4.0), t(8.5, 16.0)]); - pen.closed(&[t(11.5, 16.0), t(11.5, 4.0), t(17.0, 16.0)]); - for k in 0..4 { - let y0 = 2.5 + k as f32 * 4.0; - pen.line(&[t(10.0, y0), t(10.0, y0 + 2.0)]); - } - } "tool-gradient" | "tool-gradient-feather" => { for i in 0..6 { let a = 30 + i * 35; diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 56b884718..e7332bdab 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -518,10 +518,10 @@ fn transform_angles(app: &mut DesignApp, ui: &mut Ui, rp: u8) { ui.add_space(36.0); ui.spacing_mut().item_spacing.x = 10.0; for (icon, tip, cmd, params) in [ - ("rotate-cw", "Rotate 90° Clockwise", "transform.rotate", json!({"angle": -90})), - ("rotate-ccw", "Rotate 90° Counterclockwise", "transform.rotate", json!({"angle": 90})), - ("flip-h", "Flip Horizontal", "transform.flip", json!({"axis": "horizontal"})), - ("flip-v", "Flip Vertical", "transform.flip", json!({"axis": "vertical"})), + ("rotate-clockwise", "Rotate 90° Clockwise", "transform.rotate", json!({"angle": -90})), + ("tool-rotate", "Rotate 90° Counterclockwise", "transform.rotate", json!({"angle": 90})), + ("flip-horizontal", "Flip Horizontal", "transform.flip", json!({"axis": "horizontal"})), + ("flip-vertical", "Flip Vertical", "transform.flip", json!({"axis": "vertical"})), ] { let label = crate::i18n::tr(&lang, tip); let resp = icon_toggle(ui, icon, false, label);