Integration: Properties › Transform rotate and flip buttons use the Control panel's icons (#541)

#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.
This commit is contained in:
aiongg
2026-10-12 00:19:29 +00:00
parent 30354c0a88
commit fd21bc4f04
2 changed files with 4 additions and 27 deletions
-23
View File
@@ -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;
+4 -4
View File
@@ -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);