Skip to content

Commit d2dabce

Browse files
committed
feat(cursor): a size slider up to four times the default
Normal / Large / Extra large stopped at 2.75. The low end was right, the high end has to reach at least twice that: cursor size is a slider again, over SETTING_BOUNDS.cursorSize, now [1.5, 6] (was [1, 3]). At 6 the built-in sprites were stretched 2.3x in a 1080p export and went soft. They are rasterized at 256 instead of 128 (arrow 70 -> 139 px tall); the hotspot table and the Rust fixtures follow the new crop.
1 parent f7727bf commit d2dabce

47 files changed

Lines changed: 83 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/compositor/src/compositor_linux.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5075,11 +5075,11 @@ mod tests {
50755075
/// Les états que le rendu passe en revue (hotspots de `DEFAULT_CURSOR_SPRITES`), et s'ils
50765076
/// sont centrés : ni tangage ni lacet.
50775077
const MODEL_STATES: [(&str, [f32; 2], bool); 6] = [
5078-
("arrow", [0.119, 0.0874], false),
5079-
("pointer", [0.3893, 0.0032], false),
5080-
("text", [0.4375, 0.5333], true),
5081-
("open-hand", [0.4375, 0.1781], false),
5082-
("resize-ew", [0.4881, 0.4706], true),
5078+
("arrow", [0.1205, 0.0881], false),
5079+
("pointer", [0.3874, 0.0032], false),
5080+
("text", [0.4355, 0.5369], true),
5081+
("open-hand", [0.4375, 0.1724], false),
5082+
("resize-ew", [0.485, 0.4706], true),
50835083
("not-allowed", [0.5, 0.5], true),
50845084
];
50855085

‎crates/compositor/src/compositor_macos.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,11 +3709,11 @@ mod tests {
37093709
/// Les états que le rendu passe en revue (hotspots de `DEFAULT_CURSOR_SPRITES`), et s'ils
37103710
/// sont centrés : ni tangage ni lacet.
37113711
const MODEL_STATES: [(&str, [f32; 2], bool); 6] = [
3712-
("arrow", [0.119, 0.0874], false),
3713-
("pointer", [0.3893, 0.0032], false),
3714-
("text", [0.4375, 0.5333], true),
3715-
("open-hand", [0.4375, 0.1781], false),
3716-
("resize-ew", [0.4881, 0.4706], true),
3712+
("arrow", [0.1205, 0.0881], false),
3713+
("pointer", [0.3874, 0.0032], false),
3714+
("text", [0.4355, 0.5369], true),
3715+
("open-hand", [0.4375, 0.1724], false),
3716+
("resize-ew", [0.485, 0.4706], true),
37173717
("not-allowed", [0.5, 0.5], true),
37183718
];
37193719

‎crates/compositor/src/cursor_sdf.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,11 @@ mod tests {
458458
fn the_shipped_arrow_loads() {
459459
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../public/cursors/default/arrow.png");
460460
let sdf = CursorSdf::load(path).expect("arrow.png");
461-
assert_eq!((sdf.width, sdf.height), (42 * 4, 70 * 4));
462-
assert_eq!(sdf.shape.size, [0.6, 1.0]);
461+
assert_eq!((sdf.width, sdf.height), (83 * 4, 139 * 4));
462+
assert_eq!(sdf.shape.size, [83.0 / 139.0, 1.0]);
463463
assert!(sdf.shape.top < 0.02, "haut de la silhouette : {}", sdf.shape.top);
464-
// Le hotspot (0.119, 0.0874) est la pointe de l'incrustation, dans la silhouette.
465-
assert!(sdf.sample([0.119, 0.0874]) < 0.0);
464+
// Le hotspot (0.1205, 0.0881) est la pointe de l'incrustation, dans la silhouette.
465+
assert!(sdf.sample([0.1205, 0.0881]) < 0.0);
466466
assert!(sdf.sample([0.9, 0.1]) > 0.0);
467467
assert_eq!(sdf.f16_bytes().len(), sdf.texels.len() * 2);
468468
}

‎crates/compositor/src/frame_geometry.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6476,7 +6476,7 @@ mod tests {
64766476
#[test]
64776477
fn sprite_hotspot_stays_on_target_at_any_size() {
64786478
let center = [0.4, 0.6];
6479-
let hotspot = [0.119, 0.0874]; // flèche intégrée : la pointe, près du coin haut-gauche
6479+
let hotspot = [0.1205, 0.0881]; // flèche intégrée : la pointe, près du coin haut-gauche
64806480

64816481
for (w, h) in [(0.02, 0.04), (0.08, 0.16)] {
64826482
let dst = cursor_sprite_dst(center, w, h, hotspot);
@@ -7091,17 +7091,17 @@ mod tests {
70917091
/// Les seize états du thème par défaut et leurs hotspots (`DEFAULT_CURSOR_SPRITES`,
70927092
/// `src/lib/cursor/cursorThemes.ts`).
70937093
const DEFAULT_SPRITES: [(&str, [f32; 2]); 16] = [
7094-
("arrow", [0.119, 0.0874]),
7095-
("text", [0.4375, 0.5333]),
7096-
("pointer", [0.3893, 0.0032]),
7094+
("arrow", [0.1205, 0.0881]),
7095+
("text", [0.4355, 0.5369]),
7096+
("pointer", [0.3874, 0.0032]),
70977097
("crosshair", [0.4667, 0.4667]),
7098-
("open-hand", [0.4375, 0.1781]),
7099-
("closed-hand", [0.3889, 0.451]),
7100-
("resize-ew", [0.4881, 0.4706]),
7098+
("open-hand", [0.4375, 0.1724]),
7099+
("closed-hand", [0.3889, 0.4455]),
7100+
("resize-ew", [0.485, 0.4706]),
71017101
("resize-ns", [0.5, 0.5]),
71027102
("resize-nesw", [0.5, 0.5]),
71037103
("resize-nwse", [0.5, 0.5]),
7104-
("move", [0.4444, 0.4444]),
7104+
("move", [0.4437, 0.4437]),
71057105
("not-allowed", [0.5, 0.5]),
71067106
("wait", [0.5, 0.5]),
71077107
("app-starting", [0.05, 0.0537]),

‎crates/compositor/tests/cursor_model_render.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ const CONTACT_S: f32 = 0.0495;
4141
/// Les seize états du thème par défaut et leurs hotspots (`DEFAULT_CURSOR_SPRITES`,
4242
/// `src/lib/cursor/cursorThemes.ts`).
4343
const STATES: [(&str, [f32; 2]); 16] = [
44-
("arrow", [0.119, 0.0874]),
45-
("text", [0.4375, 0.5333]),
46-
("pointer", [0.3893, 0.0032]),
44+
("arrow", [0.1205, 0.0881]),
45+
("text", [0.4355, 0.5369]),
46+
("pointer", [0.3874, 0.0032]),
4747
("crosshair", [0.4667, 0.4667]),
48-
("open-hand", [0.4375, 0.1781]),
49-
("closed-hand", [0.3889, 0.451]),
50-
("resize-ew", [0.4881, 0.4706]),
48+
("open-hand", [0.4375, 0.1724]),
49+
("closed-hand", [0.3889, 0.4455]),
50+
("resize-ew", [0.485, 0.4706]),
5151
("resize-ns", [0.5, 0.5]),
5252
("resize-nesw", [0.5, 0.5]),
5353
("resize-nwse", [0.5, 0.5]),
54-
("move", [0.4444, 0.4444]),
54+
("move", [0.4437, 0.4437]),
5555
("not-allowed", [0.5, 0.5]),
5656
("wait", [0.5, 0.5]),
5757
("app-starting", [0.05, 0.0537]),

‎crates/compositor/tests/cursor_tap_render.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ fn scene_json(rotation: &str, hide: bool, click_bounce: f32) -> String {
167167
"zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":{rotation},"hideCursor":{hide}}}],
168168
"annotations":[],
169169
"cursor":{{"show":true,"size":4,"smoothing":0.5,"motionBlur":0.5,"clickBounce":{click_bounce},"model3d":true,"clipToBounds":false,"theme":"default",
170-
"cursorSprites":{{"arrow":{{"path":"{dir}/arrow.png","hotspotX":0.119,"hotspotY":0.0874}},
171-
"pointer":{{"path":"{dir}/pointer.png","hotspotX":0.3893,"hotspotY":0.0032}}}}}},
170+
"cursorSprites":{{"arrow":{{"path":"{dir}/arrow.png","hotspotX":0.1205,"hotspotY":0.0881}},
171+
"pointer":{{"path":"{dir}/pointer.png","hotspotX":0.3874,"hotspotY":0.0032}}}}}},
172172
"cropByClip":[null],
173173
"output":{{"width":1280,"height":720,"fps":30}}}}"##
174174
)

‎crates/compositor/tests/device_frame_render.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ fn orbit_clip_frames() {
10411041
std::fs::write(&path, format!(r#"{{"samples":[{}]}}"#, samples.join(","))).expect("sidecar");
10421042
let track = CursorTrack::load(path.to_str().unwrap(), 0.0, 10.0).expect("piste curseur");
10431043
let cursor = format!(
1044-
r#"{{"show":true,"size":4,"smoothing":0.2,"motionBlur":0,"clickBounce":2.5,"model3d":true,"clipToBounds":false,"theme":"default","cursorSprites":{{"arrow":{{"path":"{}/arrow.png","hotspotX":0.119,"hotspotY":0.0874}}}}}}"#,
1044+
r#"{{"show":true,"size":4,"smoothing":0.2,"motionBlur":0,"clickBounce":2.5,"model3d":true,"clipToBounds":false,"theme":"default","cursorSprites":{{"arrow":{{"path":"{}/arrow.png","hotspotX":0.1205,"hotspotY":0.0881}}}}}}"#,
10451045
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
10461046
.join("../../public/cursors/default")
10471047
.to_string_lossy()

‎crates/compositor/tests/follow_camera_render.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ fn orbit_scene(source: &str, regions: &str, (w, h): (u32, u32)) -> Scene {
381381
"zoomRegions":[{regions}],
382382
"annotations":[],
383383
"cursor":{{"show":true,"size":2.2,"smoothing":0,"motionBlur":0,"clickBounce":2.5,"model3d":true,"clipToBounds":false,"theme":"default",
384-
"cursorSprites":{{"arrow":{{"path":"{arrow}","hotspotX":0.119,"hotspotY":0.0874}}}}}},
384+
"cursorSprites":{{"arrow":{{"path":"{arrow}","hotspotX":0.1205,"hotspotY":0.0881}}}}}},
385385
"cropByClip":[null],
386386
"output":{{"width":{w},"height":{h},"fps":30}}}}"##
387387
))
6.2 KB

‎public/cursors/default/arrow.png‎

1.46 KB

0 commit comments

Comments
 (0)