Skip to content

fix(wsi): stop mouse events leaking from overview map to tools - #2852

Open
daniel-szabo-dev wants to merge 1 commit into
cornerstonejs:mainfrom
daniel-szabo-dev:fix/wsi-overview-map-interactions-leaking-to-tools
Open

fix(wsi): stop mouse events leaking from overview map to tools#2852
daniel-szabo-dev wants to merge 1 commit into
cornerstonejs:mainfrom
daniel-szabo-dev:fix/wsi-overview-map-interactions-leaking-to-tools

Conversation

@daniel-szabo-dev

@daniel-szabo-dev daniel-szabo-dev commented Aug 10, 2026

Copy link
Copy Markdown

Context

When a WSI viewport is loaded, @cornerstonejs/tools attaches raw DOM listeners (mousedown, dblclick, pointerdown) to the viewport element. The VolumeImageViewer from dicom-microscopy-viewer renders an OpenLayers overview map (minimap) inside that same element. Because the minimap is a child of the viewport element, mouse events on it bubble up and fire CS3D tool handlers (e.g. pan, annotations). This is unwanted behaviour, interaction within the minimap should stay within that container.

Changes & Results

In WSIViewport.setWSI(), immediately after constructing the VolumeImageViewer, attach stopPropagation listeners on the OL overlay container using the public API map.getOverlayContainerStopEvent(). This element is created synchronously in the OL Map constructor, so it is available before viewer.render() is called.

Before: Clicking on the WSI minimap triggers CS3D tool handlers.
After: Interactions with the minimap are contained within the overview map and do not reach the tool handlers.

Testing

  1. Open a WSI image, with the overview minimap visible.
  2. Make sure the minimap overlaps the image within the viewport. Resize the viewport/browser if needed.
  3. Click and drag inside the minimap with the panning tool - the main viewport should not pan.
  4. Place a point annotation within the minimap - no annotation should be created.
  5. Interactions on the main viewport outside the minimap should work as normal.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments, etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API additions or removals.

Tested Environment

  • "OS: Windows 11"
  • "Node version: 24.16.0"
  • "Browser: Chrome 151.0.7922.108"

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 260e5174-613d-4186-a19b-cd7e8e0fc1ab

📥 Commits

Reviewing files that changed from the base of the PR and between 49e9ce3 and bbc94b5.

📒 Files selected for processing (1)
  • packages/core/src/RenderingEngine/WSIViewport.ts

📝 Walkthrough

Walkthrough

WSIViewport.setWSI now stops overview-map pointer, mouse, double-click, and wheel events from propagating to viewport tool handlers.

Changes

WSI overview-map event isolation

Layer / File(s) Summary
Stop overview-map event propagation
packages/core/src/RenderingEngine/WSIViewport.ts
setWSI registers listeners that stop pointerdown, mousedown, dblclick, and wheel events on the overview-map overlay container.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: wayfarer3130

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the fix and follows the repository's semantic-release format.
Description check ✅ Passed The description includes all required sections, explains the issue and change, provides testing steps, and completes the checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant