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

Globally fix slow mousewheeling issues, with scaling! #5103

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

WeaverThree
Copy link
Contributor

JScrollPane. They're everywhere. Sometimes the mousewheel scrolling works fine with them, sometimes it doesn't. There doesn't seem to be any pattern to when it works.

MegaMek and MegaMekLab already control their JScrollPanes with get*ScrollBar().setUnitIncrement(int), seemingly doing it for each one separately. HQ only does it for the StratCon map.

Something like two-thirds of HQ's are anonymous, which makes setting properties on them a bother.

This implements a drop-in replacement for JScrollPane, JScrollPaneWithSpeed, which sets its own increment modified by the GUI scale factor, and replaces all uses of JScrollPane with it. (Except that Stratcon Map one.) This provides a single point for tuning and would allow for customization down the line.

@@ -285,7 +286,7 @@

/* ATB */
panLanceAssignment = new LanceAssignmentView(getCampaign());
JScrollPane paneLanceDeployment = new JScrollPane(panLanceAssignment);
JScrollPane paneLanceDeployment = new JScrollPaneWithSpeed(panLanceAssignment);

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'JScrollPane paneLanceDeployment' is never read.
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.54%. Comparing base (39d3485) to head (b21cd0f).
Report is 129 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5103      +/-   ##
============================================
+ Coverage     10.42%   10.54%   +0.11%     
- Complexity     6035     6038       +3     
============================================
  Files           953      956       +3     
  Lines        134268   134164     -104     
  Branches      19456    19472      +16     
============================================
+ Hits          14003    14142     +139     
+ Misses       118922   118673     -249     
- Partials       1343     1349       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@IllianiCBT IllianiCBT left a comment

Choose a reason for hiding this comment

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

LGTM

@HammerGS HammerGS merged commit c331749 into MegaMek:master Oct 21, 2024
4 checks passed
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.

4 participants