diff --git a/ASSETS.md b/ASSETS.md
index 03f33d9a6e..a74a9a29a4 100644
--- a/ASSETS.md
+++ b/ASSETS.md
@@ -83,11 +83,18 @@ Generated-in-code art is original and has no file to list. This covers the defau
| `assets/cursors/cursor-mark-ring.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-mark-square.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-mark-star.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-move.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-not-allowed.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-pen-convert.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-pen-curvature.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-pen-join.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-pen-new.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/cursors/cursor-reshape-segment.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-resize-h.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-resize-nesw.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-resize-nwse.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-resize-v.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
+| `assets/cursors/cursor-type-vertical.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/fonts/Inter-Medium.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface, not product iconography or artwork |
| `assets/fonts/Inter-Regular.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface, not product iconography or artwork |
| `assets/fonts/Inter-SemiBold.ttf` | Rasmus Andersson / The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | Open-source typeface, not product iconography or artwork |
diff --git a/assets/cursors/cursor-move.svg b/assets/cursors/cursor-move.svg
new file mode 100644
index 0000000000..ee3c16ed90
--- /dev/null
+++ b/assets/cursors/cursor-move.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-not-allowed.svg b/assets/cursors/cursor-not-allowed.svg
new file mode 100644
index 0000000000..83a8556cd0
--- /dev/null
+++ b/assets/cursors/cursor-not-allowed.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-resize-h.svg b/assets/cursors/cursor-resize-h.svg
new file mode 100644
index 0000000000..361da7e098
--- /dev/null
+++ b/assets/cursors/cursor-resize-h.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-resize-nesw.svg b/assets/cursors/cursor-resize-nesw.svg
new file mode 100644
index 0000000000..0f37741f94
--- /dev/null
+++ b/assets/cursors/cursor-resize-nesw.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-resize-nwse.svg b/assets/cursors/cursor-resize-nwse.svg
new file mode 100644
index 0000000000..d143d581da
--- /dev/null
+++ b/assets/cursors/cursor-resize-nwse.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-resize-v.svg b/assets/cursors/cursor-resize-v.svg
new file mode 100644
index 0000000000..095be8455d
--- /dev/null
+++ b/assets/cursors/cursor-resize-v.svg
@@ -0,0 +1 @@
+
diff --git a/assets/cursors/cursor-type-vertical.svg b/assets/cursors/cursor-type-vertical.svg
new file mode 100644
index 0000000000..62b0d50f65
--- /dev/null
+++ b/assets/cursors/cursor-type-vertical.svg
@@ -0,0 +1 @@
+
diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml
index 5528b7cd97..5e34518138 100644
--- a/crates/tools/src/cursors.toml
+++ b/crates/tools/src/cursors.toml
@@ -483,7 +483,7 @@ shown_when = [
"The Smooth tool, and the Pencil or Blob Brush where Alt gives the Smooth tool, when no path is selected that the Smooth tool can act on: a drag changes nothing.",
]
hotspot = "The centre."
-designer = false
+look = "A ring crossed by a diagonal bar."
[[cursor]]
id = "Busy"
diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs
index b120d35c4a..436d8306e0 100644
--- a/crates/ui-egui/src/cursors.rs
+++ b/crates/ui-egui/src/cursors.rs
@@ -29,11 +29,18 @@ pub static CURSOR_ICONS: AppIcons = AppIcons::new(
("cursor-mark-ring", include_bytes!("../../../assets/cursors/cursor-mark-ring.svg")),
("cursor-mark-square", include_bytes!("../../../assets/cursors/cursor-mark-square.svg")),
("cursor-mark-star", include_bytes!("../../../assets/cursors/cursor-mark-star.svg")),
+ ("cursor-move", include_bytes!("../../../assets/cursors/cursor-move.svg")),
+ ("cursor-not-allowed", include_bytes!("../../../assets/cursors/cursor-not-allowed.svg")),
("cursor-pen-convert", include_bytes!("../../../assets/cursors/cursor-pen-convert.svg")),
("cursor-pen-curvature", include_bytes!("../../../assets/cursors/cursor-pen-curvature.svg")),
("cursor-pen-join", include_bytes!("../../../assets/cursors/cursor-pen-join.svg")),
("cursor-pen-new", include_bytes!("../../../assets/cursors/cursor-pen-new.svg")),
("cursor-reshape-segment", include_bytes!("../../../assets/cursors/cursor-reshape-segment.svg")),
+ ("cursor-resize-h", include_bytes!("../../../assets/cursors/cursor-resize-h.svg")),
+ ("cursor-resize-nesw", include_bytes!("../../../assets/cursors/cursor-resize-nesw.svg")),
+ ("cursor-resize-nwse", include_bytes!("../../../assets/cursors/cursor-resize-nwse.svg")),
+ ("cursor-resize-v", include_bytes!("../../../assets/cursors/cursor-resize-v.svg")),
+ ("cursor-type-vertical", include_bytes!("../../../assets/cursors/cursor-type-vertical.svg")),
],
);
@@ -45,6 +52,8 @@ const PIPETTE_TIP: Vec2 = Vec2::new(2.0, 22.0);
const CARET: Vec2 = Vec2::new(12.0, 6.0);
/// The blade's point of the knife, at the box's upper right.
const BLADE_POINT: Vec2 = Vec2::new(20.0, 4.0);
+/// The middle of the box: the crossing of the move, resize and not-allowed glyphs and the vertical I-beam's center.
+const CENTER: Vec2 = Vec2::new(12.0, 12.0);
/// The bottom of the drop below the paint bucket.
const BUCKET_DROP: Vec2 = Vec2::new(20.0, 22.0);
/// The bottom of the drop beside the Live Paint diamond.
@@ -91,12 +100,12 @@ pub fn tool_cursor(c: Cursor) -> cb::Cursor {
Cursor::GroupSelection => badged(CursorBadge::Add),
Cursor::SelectionMove => badged(CursorBadge::Move),
Cursor::SelectionCopy => badged(CursorBadge::Copy),
- Cursor::Move => system(CursorIcon::Move),
+ Cursor::Move => tool("cursor-move", CENTER, None),
Cursor::Crosshair => PaintedCursor::Crosshair.into(),
- Cursor::ResizeH => system(CursorIcon::ResizeHorizontal),
- Cursor::ResizeV => system(CursorIcon::ResizeVertical),
- Cursor::ResizeNwSe => system(CursorIcon::ResizeNwSe),
- Cursor::ResizeNeSw => system(CursorIcon::ResizeNeSw),
+ Cursor::ResizeH => tool("cursor-resize-h", CENTER, None),
+ Cursor::ResizeV => tool("cursor-resize-v", CENTER, None),
+ Cursor::ResizeNwSe => tool("cursor-resize-nwse", CENTER, None),
+ Cursor::ResizeNeSw => tool("cursor-resize-nesw", CENTER, None),
Cursor::ShearH => PaintedCursor::skew(Vec2::new(1.0, 0.0)).into(),
Cursor::ShearV => PaintedCursor::skew(Vec2::new(0.0, -1.0)).into(),
Cursor::Rotate => turn_toward(0),
@@ -112,16 +121,18 @@ pub fn tool_cursor(c: Cursor) -> cb::Cursor {
Cursor::PenConvert => tool("cursor-pen-convert", TIP, None),
Cursor::Curvature => tool("cursor-pen-curvature", TIP, None),
Cursor::AnchorPoint => tool("cursor-anchor-point", CARET, None),
- Cursor::Text => system(CursorIcon::Text),
- Cursor::TypeVertical | Cursor::TypeAreaVertical | Cursor::TypeOnPathVertical => system(CursorIcon::VerticalText),
+ Cursor::Text => PaintedCursor::IBeam.into(),
+ Cursor::TypeVertical | Cursor::TypeAreaVertical | Cursor::TypeOnPathVertical => tool("cursor-type-vertical", CENTER, None),
Cursor::TypeArea => PaintedCursor::type_on(false).into(),
Cursor::TypeOnPath => PaintedCursor::type_on(true).into(),
Cursor::Hand => PaintedCursor::Hand.into(),
- Cursor::HandGrab => system(CursorIcon::Grabbing),
+ // The framework draws the hand closed while the primary button is down.
+ Cursor::HandGrab => PaintedCursor::Hand.into(),
Cursor::ZoomIn => PaintedCursor::zoom(false).into(),
Cursor::ZoomOut => PaintedCursor::zoom(true).into(),
Cursor::Eyedropper => tool("pipette", PIPETTE_TIP, None),
- Cursor::NotAllowed => system(CursorIcon::NotAllowed),
+ Cursor::NotAllowed => tool("cursor-not-allowed", CENTER, None),
+ // The window-wide wait pointer of a long operation, not a canvas tool's cursor.
Cursor::Busy => system(CursorIcon::Progress),
Cursor::AddStop => badged(CursorBadge::Add),
Cursor::RemoveStop => badged(CursorBadge::Subtract),
diff --git a/crates/ui-egui/src/cursors/tests.rs b/crates/ui-egui/src/cursors/tests.rs
index a0554f26bb..c83bd7fd1c 100644
--- a/crates/ui-egui/src/cursors/tests.rs
+++ b/crates/ui-egui/src/cursors/tests.rs
@@ -35,6 +35,42 @@ fn every_tool_cursors_hotspot_is_on_its_glyph() {
assert!(missed.is_empty(), "hotspots off their glyphs: {missed:?}");
}
+/// One tool switches between these looks as the pointer moves (the Curvature pen over an anchor, the
+/// Selection arrow over a corner handle, the Hand while it pans, a tool that has nothing to act on, the
+/// type tools). The app draws all of them at its own cursor size, so none comes from the desktop's
+/// cursor theme at another size; only the window-wide wait pointer of a long operation does.
+#[test]
+fn a_tools_move_resize_grab_and_not_allowed_cursors_are_drawn_like_its_own() {
+ use craft::ui::primitives::{painted_image, register_app_icons};
+ use craft::ui::runtime::env::Env;
+ crate::icons::register();
+ register_app_icons(&CURSOR_ICONS);
+ let pairs = [
+ (Cursor::Curvature, Cursor::Move),
+ (Cursor::Arrow, Cursor::ResizeNwSe),
+ (Cursor::Arrow, Cursor::ResizeH),
+ (Cursor::Hand, Cursor::HandGrab),
+ (Cursor::Smooth, Cursor::NotAllowed),
+ (Cursor::TypeArea, Cursor::Text),
+ (Cursor::TypeArea, Cursor::TypeVertical),
+ ];
+ crate::testing::ui_context()
+ .run_ui(Default::default(), |ui| {
+ let env = Env::of(ui);
+ for (own, other) in pairs {
+ for c in [own, other] {
+ let cb::Cursor::Painted(painted) = tool_cursor(c) else { panic!("{c:?} beside {own:?} comes from the desktop's cursor theme") };
+ let (one, two) = (painted_image(&env, &painted, 1.0), painted_image(&env, &painted, 2.0));
+ let (Some(one), Some(two)) = (one, two) else { panic!("{c:?} has no image") };
+ assert!(two.size[0] > one.size[0] && two.size[1] > one.size[1], "{c:?} grows with the cursor scale");
+ }
+ }
+ })
+ .textures_delta
+ .clear();
+ assert!(matches!(tool_cursor(Cursor::Busy), cb::Cursor::System(_)), "the wait pointer stays the system's");
+}
+
/// A `cursor-` icon name a cursor uses must be in the set the host registers.
#[test]
fn every_cursor_icon_the_app_names_is_in_its_set() {