Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/rsnap-overlay/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,7 @@ impl OverlaySession {
fn overlay_cursor_icon_for_monitor(&self, monitor: MonitorRect) -> CursorIcon {
match self.state.mode {
OverlayMode::Frozen => self.frozen_selection_cursor_icon_for_monitor(monitor),
OverlayMode::Live => CursorIcon::Default,
OverlayMode::Live => CursorIcon::Crosshair,
}
}

Expand All @@ -2009,13 +2009,16 @@ impl OverlaySession {
&self,
monitor: MonitorRect,
) -> Vec<OverlayCursorRect> {
let overlay_bounds =
Rect::from_min_size(Pos2::ZERO, Vec2::new(monitor.width as f32, monitor.height as f32));

if matches!(self.state.mode, OverlayMode::Live) {
return vec![OverlayCursorRect::new(overlay_bounds, CursorIcon::Crosshair)];
}
if !matches!(self.state.mode, OverlayMode::Frozen) {
return Vec::new();
}

let overlay_bounds =
Rect::from_min_size(Pos2::ZERO, Vec2::new(monitor.width as f32, monitor.height as f32));

if let Some((target_monitor, capture_rect)) = self.frozen_mosaic_drag_target() {
if target_monitor != monitor {
return Vec::new();
Expand Down
26 changes: 26 additions & 0 deletions packages/rsnap-overlay/src/overlay/tests/rendering_behaviors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,16 @@ fn frozen_selection_cursor_icon_uses_corner_resize_hover() {
assert_eq!(session.frozen_selection_cursor_icon_for_monitor(monitor), CursorIcon::Grab);
}

#[test]
fn live_overlay_cursor_icon_uses_crosshair() {
let monitor = tests::test_monitor();
let mut session = OverlaySession::new();

session.state.mode = OverlayMode::Live;

assert_eq!(session.overlay_cursor_icon_for_monitor(monitor), CursorIcon::Crosshair);
}

#[test]
fn frozen_text_edit_caret_rect_starts_at_anchor_when_text_is_empty() {
let ctx = tests::test_egui_context();
Expand Down Expand Up @@ -1183,6 +1193,22 @@ fn frozen_mosaic_cursor_rects_preserve_crosshair_hover_and_drag() {
assert_eq!(rects[0].rect.max, Pos2::new(monitor.width as f32, monitor.height as f32));
}

#[cfg(target_os = "macos")]
#[test]
fn live_cursor_rects_cover_overlay_with_crosshair() {
let monitor = tests::test_monitor();
let mut session = OverlaySession::new();

session.state.mode = OverlayMode::Live;

let rects = session.frozen_selection_cursor_rects_for_monitor(monitor);

assert_eq!(rects.len(), 1);
assert_eq!(rects[0].icon, CursorIcon::Crosshair);
assert_eq!(rects[0].rect.min, Pos2::ZERO);
assert_eq!(rects[0].rect.max, Pos2::new(monitor.width as f32, monitor.height as f32));
}

#[cfg(target_os = "macos")]
#[test]
fn macos_cursor_object_maps_crosshair_icon() {
Expand Down
Loading