Skip to content

Apply visualizer mouse display scaling once - #3245

Merged
breiler merged 2 commits into
winder:masterfrom
mvanhorn:fix/3241-ugs-visualizer-mouse-scaling
Nov 5, 2026
Merged

breiler merged 2 commits into
winder:masterfrom
mvanhorn:fix/3241-ugs-visualizer-mouse-scaling

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Background

On scaled displays, the visualizer’s mouse cone can drift from the cursor and report incorrect coordinates.

Mouse coordinates were scaled in RendererInputHandler, then scaled again during projection. The first conversion also used the default screen’s scale instead of the event component’s display scale.

Summary of the fix

Apply the component’s display scale once for mouse movement and dragging, with an identity fallback when no graphics configuration is available. Projection now accepts drawable pixel coordinates directly.

Verification

./mvnw -B -ntp -pl ugs-platform/ugs-platform-visualizer -am test -Dtest=RendererInputHandlerTest,MouseProjectionUtilsTest -Dsurefire.failIfNoSpecifiedTests=false passed both regression tests. The tests in ugs-platform/ugs-platform-visualizer/src/test/java/com/willwinder/ugs/nbm/visualizer/RendererInputHandlerTest.java and ugs-platform/ugs-platform-visualizer/src/test/java/com/willwinder/ugs/nbm/visualizer/shared/MouseProjectionUtilsTest.java fail without the fix in the Universal-G-Code-Sender RendererInputHandler change (checked by reverting the source changes).

Fixes #3241

Apply the component’s display scale once for mouse movement and
dragging, with an identity fallback when no graphics configuration is
available. Projection now accepts drawable pixel coordinates directly.

Fixes winder#3241
@breiler
breiler merged commit ac5e3be into winder:master Nov 5, 2026
1 of 2 checks passed
@mvanhorn

mvanhorn commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging this @breiler. Applying the display scale once should keep the visualizer's mouse cone lined up with the cursor on scaled displays.

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.

Mac: Offset between Mouse cursor and Vizualizer position

2 participants