Skip to content

Commit

Permalink
feat: Make scrolling consistent and only mark as consumed when actual…
Browse files Browse the repository at this point in the history
…ly consumed

Removes the 'fallback' of horizontal scrolling without CTRL
when the vertical scrollbar is not present. It is confusing and breaking
underlying panels (as they won't receive (expected) events.
  • Loading branch information
veger authored and shpaass committed Oct 29, 2024
1 parent c2e4cc5 commit 2c96482
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Yafc.UI/ImGui/ScrollArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,11 @@ public void Build(ImGui gui, float availableHeight, bool useBottomPadding = fals
}

if (gui.action == ImGuiAction.MouseScroll) {
if (gui.ConsumeEvent(rect)) {
if (vertical && (!horizontal || !InputSystem.Instance.control)) {
scrollY += gui.actionParameter * 3f;
}
else {
scrollX += gui.actionParameter * 3f;
}
}
if (vertical && !InputSystem.Instance.control && gui.ConsumeEvent(rect))
scrollY += gui.actionParameter * 3f;

else if (horizontal && InputSystem.Instance.control && gui.ConsumeEvent(rect))
scrollX += gui.actionParameter * 3f;
}
else {
if (horizontal && maxScroll.X > 0f) {
Expand Down

0 comments on commit 2c96482

Please sign in to comment.