Drawing Revision Comparison and Alignment SDK
Build an NPM workflow that compares two drawing versions or aligns them first, with event-confirmed progress, results, errors, and saved comparison output.
Use the NPM SDK to compare drawing revisions with an older background drawing and a newer overlay drawing, or align the drawings first when their coordinates differ. The operator should always know whether Canvas is ready, processing, waiting for alignment points, complete, failed, or saving output.
The reference UI is a dark engineering workspace: a small application header, a persistent action ribbon, a collapsible sidebar, a large Canvas viewport, and a footer status area. Preserve that information hierarchy in host UI while using only NPM SDK methods and events.
- Ribbon: Compare Documents, Align Drawings, Save Comparison, and a compact status badge.
- Sidebar: background and overlay sources, DPI, background/overlay/equal colors, output name, and result metadata after completion.
- Canvas viewport: normal drawing surface, processing overlay, and a focused instruction while the operator picks interactive alignment points.
- Footer or live region: current operation message and error feedback that remains available when the sidebar is collapsed.
The host UI should advance only on documented events, not when a command has been clicked.
- 1Mount the NPM viewer and register compare listeners.
- 2Collect and validate distinct background and overlay sources plus rendering options.
- 3Use Compare when the source coordinates already match.
- 4Use interactive Align when the drawings are shifted, rotated, scaled, cropped, scanned, or exported differently.
- 5Keep actions locked while Canvas processes or waits for point selection.
- 6Show result metadata and enable Save after a result payload confirms completion.
- 7Use error and save-complete events to unlock retry or show saved confirmation.
- 8Unsubscribe and destroy the viewer when the route is left.
Coordinate agreement is the decision point. Direct compare can complete on offset drawings, but it creates a misleading diff because unchanged geometry appears changed.
- Compare directly when page size, orientation, scale, margins, and layout coordinates are already equivalent.
- Align interactively when the drawings do not share coordinates and an operator can select matching points in Canvas.
- Do not call direct compare merely because both URLs are valid; visually verify whether the sources share the same coordinate system.
The revision setup is a stateful workspace. These states make the real operator workflow understandable and prevent premature success feedback.
- 1Ready: Compare and Align are enabled; Save is disabled.
- 2Processing: show
progressStartmessage over Canvas and lock the action ribbon. - 3Pick points: an empty
comparisonCompletefrom interactive align tells the operator to select matching points; remain locked. - 4Complete: a result payload shows metadata and enables Save.
- 5Error:
comparisonErrordisplays recoverable feedback and returns Compare and Align to an enabled state. - 6Saved:
compareSaveCompleteconfirms the output name; the completed result remains available.
React Setup
Copy the NPM React Compare and Align workspace, lifecycle hook, event states, and responsive UI.
Angular Setup
Mount and clean up the viewer through Angular lifecycle hooks.
Prepare Revisions
Validate sources and decide whether their coordinates permit direct comparison.
Align Revisions
Guide the operator through the intermediate point-picking state and final alignment result.
Compare Revisions
Run direct comparison and render event-confirmed progress, result, and retry states.
Error Handling
Map NPM comparison failures to visible and recoverable host UI states.
Verification Checklist
Verify progress, point selection, result confirmation, saving, error recovery, and cleanup.
Use these pages to implement and verify the workflow.
Use component documentation for exact payload fields and event types.
