update review tab UX/introduce shift+mousewheel for scrolling
This commit is contained in:
parent
860d690090
commit
14f55afb28
3 changed files with 912 additions and 267 deletions
20
src/tui.zig
20
src/tui.zig
|
|
@ -593,11 +593,27 @@ pub const App = struct {
|
|||
|
||||
switch (mouse.button) {
|
||||
.wheel_up => {
|
||||
self.wheelBy(-3);
|
||||
// shift+wheel scrolls the viewport (look-around,
|
||||
// no cursor change). Plain wheel routes through
|
||||
// `wheelBy` which prefers the active tab's
|
||||
// `onCursorMove`/`onWheelMove`. We pick shift
|
||||
// (not ctrl) because ctrl+wheel is the
|
||||
// near-universal "zoom" gesture in browsers and
|
||||
// editors — bending that to "scroll" would
|
||||
// confuse muscle memory.
|
||||
if (mouse.mods.shift) {
|
||||
self.scrollViewportBy(-3);
|
||||
} else {
|
||||
self.wheelBy(-3);
|
||||
}
|
||||
return ctx.consumeAndRedraw();
|
||||
},
|
||||
.wheel_down => {
|
||||
self.wheelBy(3);
|
||||
if (mouse.mods.shift) {
|
||||
self.scrollViewportBy(3);
|
||||
} else {
|
||||
self.wheelBy(3);
|
||||
}
|
||||
return ctx.consumeAndRedraw();
|
||||
},
|
||||
.left => {
|
||||
|
|
|
|||
|
|
@ -456,16 +456,10 @@ pub const tab = struct {
|
|||
return true;
|
||||
}
|
||||
|
||||
/// Mouse wheel: always scroll the viewport, never move the
|
||||
/// cursor. Keeps wheel-as-look-around and cursor-as-pointer
|
||||
/// distinct. The framework falls through to viewport scroll
|
||||
/// when this returns false.
|
||||
pub fn onWheelMove(state: *State, app: *App, delta: isize) bool {
|
||||
_ = state;
|
||||
_ = app;
|
||||
_ = delta;
|
||||
return false;
|
||||
}
|
||||
// No `onWheelMove`: by omitting it, wheel events fall through
|
||||
// to the framework's `onCursorMove` path. Wheel moves the
|
||||
// cursor like j/k. PageUp / PageDown / Home / End scroll the
|
||||
// viewport.
|
||||
|
||||
/// Pre-empt key handler. Called by the framework BEFORE
|
||||
/// global keymap matching runs. When portfolio is in a
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue