Skip to content

feat: add SVGController skeleton and InteractionMode#91

Open
jwindhager wants to merge 4 commits intodevelopmentfrom
feat/svg-controller
Open

feat: add SVGController skeleton and InteractionMode#91
jwindhager wants to merge 4 commits intodevelopmentfrom
feat/svg-controller

Conversation

@jwindhager
Copy link
Member

This PR adds an SVGController skeleton to @tissuumaps/core for managing the drawing of SVG shapes

Specifically, the SVGController manages an <svg> element that is overlayed on top of the OpenSeadragon drawer and the WebGL canvas elements. Depending on the newly introduced InteractionMode, the controller is supposed to handle mouse events for drawing Shapes. Currently, the only InteractionMode is "pan" (i.e., no drawing), but this may be extended as needed (e.g. by adding "drawRectangle"). Corresponding interactionMode adapters (in @tissuumaps/viewer) and interactionMode/setInteractionMode() application states/actions were added and wired up.

Importantly, all shapes are supposed to be added under the transformNode SVG group element, which transforms internal world coordinates to viewport coordinates in screen space, and is reactively synchronized to the current OpenSeadragon/WebGL viewport using the setViewport(), resizeContainer() and updateTransformNode() methods (already implemented and wired up in the @tissuumaps/viewer React component). Any cleanup code may be added to the destroy() method.

A React component skeleton for controlling the application's interactionMode will be added in a separate PR.

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (ca88f16) to head (dac787b).

Additional details and impacted files
@@             Coverage Diff              @@
##           development      #91   +/-   ##
============================================
  Coverage        99.78%   99.78%           
============================================
  Files                9        9           
  Lines              459      459           
  Branches           115      115           
============================================
  Hits               458      458           
  Misses               1        1           
Flag Coverage Δ
unittests 99.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jwindhager jwindhager requested a review from cavenel March 25, 2026 16:16
Copy link
Contributor

Copilot AI left a comment

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 introduces an SVG overlay pipeline alongside the existing OpenSeadragon + WebGL viewer stack by adding a core-level SVGController and wiring a new interactionMode state through the app store into the viewer, so future shape-drawing modes can be implemented on top of a synchronized SVG transform layer.

Changes:

  • Add SVGController (core) and a new InteractionMode type ("pan" for now).
  • Add a useSVG hook and integrate it into the viewer to keep the SVG overlay viewport/size synchronized with OpenSeadragon.
  • Add interactionMode state + setInteractionMode() action to the app store and plumb it into the viewer adapter/context.

Reviewed changes

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

Show a summary per file
File Description
packages/@tissuumaps-viewer/src/hooks/useSVG.ts New hook that mounts an SVG overlay and forwards resize/viewport updates to SVGController.
packages/@tissuumaps-viewer/src/context.ts Extends viewer adapter to include interactionMode and optional onShapeAdded.
packages/@tissuumaps-viewer/src/components/Viewer/index.tsx Wires SVG overlay lifecycle and keeps it in sync with container resize + viewport changes.
packages/@tissuumaps-core/src/types.ts Adds InteractionMode type.
packages/@tissuumaps-core/src/index.ts Exports SVGController from core public API.
packages/@tissuumaps-core/src/controllers/SVGController.ts Adds SVG overlay controller with transform-node synchronization methods.
apps/tissuumaps/src/store/slices/app.ts Adds interactionMode state and setInteractionMode action with default "pan".
apps/tissuumaps/src/App.tsx Passes interactionMode from Zustand store into the viewer adapter.

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

@jwindhager jwindhager changed the title feat: add SVGController and InteractionMode feat: add SVGController skeleton and InteractionMode Mar 25, 2026
@jwindhager jwindhager self-assigned this Mar 25, 2026
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