Skip to content

Fix scroll-wheel zoom-in blocked on Linux in Network Diagram#56

Merged
mcgivrer merged 2 commits into
mainfrom
copilot/fix-wheelmouse-zoom-linux
Mar 21, 2026
Merged

Fix scroll-wheel zoom-in blocked on Linux in Network Diagram#56
mcgivrer merged 2 commits into
mainfrom
copilot/fix-wheelmouse-zoom-linux

Conversation

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

On Linux (GTK/X11/Wayland), ScrollEvent.getDeltaY() returns 0.0 for physical mouse-wheel events. The old handler used getDeltaY() > 0 ? zoomIn : zoomOut, so every zero-delta event unconditionally applied the zoom-out factor — making zoom-in nearly impossible after zooming out.

Changes

  • ui/ZoomCalculator (new) — pure-Java, no JavaFX, stateless helper:
    • Holds canonical zoom constants (ZOOM_FACTOR = 1.15, ZOOM_MIN = 0.1, ZOOM_MAX = 8.0)
    • computeNewZoom(deltaY, textDeltaY, ...) falls back to getTextDeltaY() when getDeltaY() == 0; returns currentZoom unchanged when both are zero (true no-op)
// Before
double factor = e.getDeltaY() > 0 ? 1.15 : 1.0 / 1.15; // 0.0 always zooms out on Linux

// After
double newZoom = ZoomCalculator.computeNewZoom(
        e.getDeltaY(), e.getTextDeltaY(), zoom,
        ZoomCalculator.ZOOM_FACTOR, ZoomCalculator.ZOOM_MIN, ZoomCalculator.ZOOM_MAX);
  • VisualLinkPanel.handleZoomScroll — delegates to ZoomCalculator; Javadoc updated with Linux context
  • VisualLinkPanel.zoomToFit / zoomToComponent — hardcoded 0.1/8.0 literals replaced with ZoomCalculator.ZOOM_MIN/MAX
  • VisualLinkPanelZoomTest (new) — 12 JUnit 5 tests (pure Java, no JavaFX runtime): normal scroll, Linux getDeltaY()==0 fallback, min/max clamping, zoom-in↔out round-trip symmetry
  • user-guide-en.md — scroll-wheel entry updated to document factor (1.15×) and cross-platform support
Original prompt

This section details on the original issue you should resolve

<issue_title>the WheelMouse Zoom feature does not work under Linux</issue_title>
<issue_description>Zoom out is working fine, but Zoom in is early blocked. You can easily zoom out, but zooming in seems to be very limited.

  1. Default Zoom level after computing the graph:
Image
  1. Zoom out done :
Image
  1. Zoom in max (buggy !)
Image

</issue_description>

<agent_instructions>- Use JDK 25 only.

  • Fix the bug.
  • Create a unit test with Junit-platform-console-standalone 6.0.1 only.
  • Update the Javadoc.
  • Update the feature in src/docs/user-guide-en.md if the process design has changed. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Fix WheelMouse Zoom feature not working under Linux Fix scroll-wheel zoom-in blocked on Linux in Network Diagram Mar 20, 2026
Copilot AI requested a review from mcgivrer March 20, 2026 18:32
@mcgivrer mcgivrer marked this pull request as ready for review March 21, 2026 00:13
@mcgivrer mcgivrer merged commit 1955ee0 into main Mar 21, 2026
1 check passed
@mcgivrer mcgivrer deleted the copilot/fix-wheelmouse-zoom-linux branch March 22, 2026 16:38
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.

the WheelMouse Zoom feature does not work under Linux

2 participants