Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

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

aionggfd21bc4f0485
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);