NPM Package/docs/components/revision/align
Align
Align two file overlays before comparison using the SDK compare/align interface.
Use viewer.compare.align(...) to align two files before generating a visual comparison.
Align commands are available after the viewer is mounted and Canvas is ready.
typescript
Overview
Subscribe to compare event channels before executing an alignment task:
align(...)returnsvoid. Progress, success, interactive-ready state, and failure details arrive through these events.
typescript
Event Subscriptions
Omit alignArray when the user needs to select matching points interactively in the viewer window:
- Interactive alignment fires two
comparisonCompleteevents: first with no payload (Canvas ready for points selection), and a second with payload (generation complete).
typescript
Interactive Align
Provide custom coordinate offsets if your application already has defined point mappings:
- The SDK validates that
alignArraycontains no more than two point coordinate mapping structures.
typescript
Align With Existing Points
Compare & align model definitions:
typescript
Types Reference
The SDK rejects invalid align inputs before communicating with Canvas:
- Payload must be a valid object configuration.
- Background source (
backgroundUrlorbackgroundFileName) is required. - Overlay source (
overlayUrloroverlayFileName) is required. - Background and overlay values must not be identical.
dpimust be a positive finite number if provided.backgroundColor,overlayColor, andequalColormust be valid color strings.alignArraymust contain no more than two point mappings if provided.
Complete integration code setup for Vanilla HTML/JS environments:
Vanilla Example
Broker message mapping for alignment workflows:
viewer.compare.align(...)maps toalign.viewer.compare.on("progressStart", ...)listens toprogressStart.viewer.compare.on("progressEnd", ...)listens toprogressEnd.viewer.compare.on("comparisonComplete", ...)listens tocomparisonComplete.viewer.compare.on("comparisonError", ...)listens tocomparisonError.
