Wheel scrolling
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
! From a user (novice) point of view, how does it look like?
|
||||
|
||||
- Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep)
|
||||
- Maybe wheel click should scroll??? PROBABLY
|
||||
|
||||
- Make all the keybinding / hook parsing initialize at the start to reduce runtime problems
|
||||
- RegisterCommand should_appear_in_listing variable
|
||||
|
||||
@@ -44,6 +44,7 @@ WindowID DocumentSelected = {-1};
|
||||
WindowID ResizerSelected = {-1};
|
||||
WindowID ResizerHover = {-1};
|
||||
Caret DocumentAnchor;
|
||||
Vec2I MouseMiddleAnchor;
|
||||
|
||||
Buffer *GCInfoBuffer;
|
||||
Buffer *EventBuffer;
|
||||
|
||||
@@ -58,6 +58,8 @@ void SetMouseCursor(SDL_SystemCursor id) {
|
||||
JS_SetMouseCursor("default");
|
||||
} else if (id == SDL_SYSTEM_CURSOR_TEXT) {
|
||||
JS_SetMouseCursor("text");
|
||||
} else if (id == SDL_SYSTEM_CURSOR_MOVE) {
|
||||
JS_SetMouseCursor("all-scroll");
|
||||
} else {
|
||||
InvalidCodepath();
|
||||
}
|
||||
@@ -104,6 +106,11 @@ void SetMouseCursor(Event event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MouseMiddleAnchor.x != 0 && MouseMiddleAnchor.y != 0) {
|
||||
SetMouseCursor(SDL_SYSTEM_CURSOR_MOVE);
|
||||
return;
|
||||
}
|
||||
|
||||
For(order) {
|
||||
if (!it->visible) continue;
|
||||
bool mouse_in_total = AreOverlapping(mouse, it->total_rect);
|
||||
@@ -315,6 +322,20 @@ void OnCommand(Event event) {
|
||||
MouseLoadWord(event);
|
||||
}
|
||||
|
||||
{
|
||||
Vec2I mouse = MouseVec2I();
|
||||
if (Mouse(MIDDLE)) {
|
||||
MouseMiddleAnchor = mouse;
|
||||
} else if (Mouse(MIDDLE_UP)) {
|
||||
MouseMiddleAnchor = {0, 0};
|
||||
}
|
||||
if (MouseMiddleAnchor.x != 0) {
|
||||
BSet active = GetBSet(ActiveWindowID);
|
||||
active.view->scroll += mouse - MouseMiddleAnchor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Ctrl() && Mouse(LEFT)) {
|
||||
MouseLoadWord(event);
|
||||
} else if (Mouse(LEFT)) { // Uses Alt and shift
|
||||
|
||||
Reference in New Issue
Block a user