Skip to content

Rework widget scrolling to support x+y scrolling#198

Open
MichaelHillcox wants to merge 3 commits into
1.21.1/devfrom
feature/xy-scrolling
Open

Rework widget scrolling to support x+y scrolling#198
MichaelHillcox wants to merge 3 commits into
1.21.1/devfrom
feature/xy-scrolling

Conversation

@MichaelHillcox

Copy link
Copy Markdown
Member

This shouldn't break anything with existing mods but I could have missed something. This is a required change to allow FTB Quests and other related panels that use scrolling as a pan method to work with trackpads, ball scrolling, etc

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates FTB Library’s UI scrolling pipeline to accept both horizontal and vertical scroll deltas (trackpads / “free” scrolling), while keeping a deprecated single-axis scroll API for transitional compatibility.

Changes:

  • Introduces a new mouseScrolled(mouseX, mouseY, scrollHorizontal, scrollVertical) API on Widget and propagates it through screens/panels.
  • Updates several widgets/panels to consume the new vertical delta (and prepares for horizontal support).
  • Updates Gradle’s mod-publish plugin version.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
common/src/main/java/dev/ftb/mods/ftblibrary/ui/Widget.java Adds new 2D scroll method and deprecates old 1D method.
common/src/main/java/dev/ftb/mods/ftblibrary/ui/ScrollBar.java Migrates scrollbar scrolling to the new 2D scroll signature.
common/src/main/java/dev/ftb/mods/ftblibrary/ui/ScreenWrapper.java Routes Minecraft Screen scroll events into the wrapped GUI (with temporary legacy fallback).
common/src/main/java/dev/ftb/mods/ftblibrary/ui/Panel.java Propagates 2D scroll into child widgets and panel scrolling.
common/src/main/java/dev/ftb/mods/ftblibrary/ui/IntTextBox.java Updates scroll-to-increment behavior to use the vertical delta.
common/src/main/java/dev/ftb/mods/ftblibrary/ui/DropDownMenu.java Removes redundant scrollPanel override (now handled by base behavior).
common/src/main/java/dev/ftb/mods/ftblibrary/ui/BaseScreen.java Updates focused-widget and modal-panel scroll dispatch to 2D scroll.
common/src/main/java/dev/ftb/mods/ftblibrary/config/ui/resource/ResourceSelectorScreen.java Updates scroll adjustments to use the vertical delta.
common/src/main/java/dev/ftb/mods/ftblibrary/config/ui/EditStringConfigOverlay.java Updates scroll-to-cycle behavior to use the vertical delta and new signature.
build.gradle Bumps me.modmuss50.mod-publish-plugin version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread common/src/main/java/dev/ftb/mods/ftblibrary/ui/Widget.java Outdated
Comment thread common/src/main/java/dev/ftb/mods/ftblibrary/ui/Panel.java Outdated
Comment thread common/src/main/java/dev/ftb/mods/ftblibrary/ui/ScrollBar.java Outdated
@MichaelHillcox

Copy link
Copy Markdown
Member Author

Updated the logic to be more consistent with a standard operating system scroll.

If shift is applied, attempt to apply either delta to the X axis
If shift isn't applied use the user provided delta

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Comment thread common/src/main/java/dev/ftb/mods/ftblibrary/ui/Panel.java Outdated
Comment thread common/src/main/java/dev/ftb/mods/ftblibrary/ui/IntTextBox.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants