Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch tabs using Ctrl+PgUp/Down, reorder tabs using Ctrl+Sh+PgUp/Down #236

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
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
32 changes: 23 additions & 9 deletions Yafc.UI/ImGui/ScrollArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,43 @@ public float scrollX {
protected abstract Vector2 MeasureContent(float width, ImGui gui);

public bool KeyDown(SDL.SDL_Keysym key) {
switch (key.scancode) {
case SDL.SDL_Scancode.SDL_SCANCODE_UP:
bool ctrl = InputSystem.Instance.control;
bool shift = InputSystem.Instance.shift;
switch ((ctrl, shift, key.scancode)) {
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_UP):
scrollY -= 3;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_DOWN:
case (true, false, SDL.SDL_Scancode.SDL_SCANCODE_UP):
scrollY = 0; // ctrl+up = home
return true;
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_DOWN):
scrollY += 3;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_LEFT:
case (true, false, SDL.SDL_Scancode.SDL_SCANCODE_DOWN):
scrollY = maxScroll.Y; // ctrl+down = end
return true;
shpaass marked this conversation as resolved.
Show resolved Hide resolved
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_LEFT):
scrollX -= 3;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_RIGHT:
case (true, false, SDL.SDL_Scancode.SDL_SCANCODE_LEFT):
scrollX = 0;
return true;
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_RIGHT):
scrollX += 3;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN:
case (true, false, SDL.SDL_Scancode.SDL_SCANCODE_RIGHT):
scrollX = maxScroll.X;
return true;
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN):
scrollY += contentRect.Height;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP:
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP):
scrollY -= contentRect.Height;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_HOME:
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_HOME):
scrollY = 0;
return true;
case SDL.SDL_Scancode.SDL_SCANCODE_END:
case (false, false, SDL.SDL_Scancode.SDL_SCANCODE_END):
scrollY = maxScroll.Y;
return true;
default:
Expand Down