R3.3: the LOK view's pointer follows the kernel; an arrow over cells
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> [skip ci]
This commit is contained in:
1 parent
ee1b8ad375
commit
26c0a64665
11 files changed
+72
-6
No files matched your search
@@ -384,6 +384,9 @@ impl LokView {
|
||||
}
|
||||
if self.dragging && event.pressed_button == Some(MouseButton::Left) {
|
||||
self.mouse(2, event.position, 1, 1, &event.modifiers);
|
||||
} else if event.pressed_button.is_none() {
|
||||
// A hover: the kernel answers with its pointer.
|
||||
self.mouse(2, event.position, 0, 1, &event.modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ impl Render for LokView {
|
||||
.aria_value(self.a11y.text.clone())
|
||||
.key_context(CONTEXT)
|
||||
.track_focus(&self.focus)
|
||||
.cursor(CursorStyle::IBeam)
|
||||
.cursor(self.pointer)
|
||||
.size_full()
|
||||
.overflow_hidden()
|
||||
.bg(canvas_color)
|
||||
@@ -360,3 +360,29 @@ impl LokView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The cursor for a kernel CSS pointer name.
|
||||
pub(super) fn pointer(css: &str) -> CursorStyle {
|
||||
match css {
|
||||
"default" | "wait" | "help" => CursorStyle::Arrow,
|
||||
"text" => CursorStyle::IBeam,
|
||||
"vertical-text" => CursorStyle::IBeamCursorForVerticalLayout,
|
||||
"crosshair" | "fill" => CursorStyle::Crosshair,
|
||||
"move" => CursorStyle::ClosedHand,
|
||||
"grab" => CursorStyle::OpenHand,
|
||||
"pointer" => CursorStyle::PointingHand,
|
||||
"n-resize" | "s-resize" => CursorStyle::ResizeUpDown,
|
||||
"e-resize" | "w-resize" => CursorStyle::ResizeLeftRight,
|
||||
"ne-resize" | "sw-resize" => CursorStyle::ResizeUpRightDownLeft,
|
||||
"nw-resize" | "se-resize" => CursorStyle::ResizeUpLeftDownRight,
|
||||
"col-resize" => CursorStyle::ResizeColumn,
|
||||
"row-resize" => CursorStyle::ResizeRow,
|
||||
"copy" => CursorStyle::DragCopy,
|
||||
"alias" => CursorStyle::DragLink,
|
||||
"not-allowed" => CursorStyle::OperationNotAllowed,
|
||||
_ => {
|
||||
log::warn!("lok: unknown pointer {css}");
|
||||
CursorStyle::Arrow
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ impl LokView {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Ctrl (Cmd on macOS) with the wheel zooms; else it scrolls.
|
||||
/// Ctrl (macOS: Cmd) and the wheel zoom; else scroll.
|
||||
pub(super) fn on_wheel(&mut self, event: &ScrollWheelEvent, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if !self.wheel_zoom(event, cx) {
|
||||
self.on_scroll(event, window, cx);
|
||||
|
||||
Reference in new issue
Block a user