đŽ Interaction Guide
Paint Modeâ
- đ Initial Carousel: After regions are ready, each region's dashed outline flashes sequentially per
initRegionFlashMs(default 1s); stops on first user touch. - đ Preview (no brush selected): Long-press a region to show dashed outline for the connected component under the touch point; tapping a black area shows no outline.
- đ¨ Paint (brush selected): Tap a color in the bottom color bar or call
ref.setPaintColor(or preselect viainitialPaintColor), then tap a region to paint; tapping the same region again overwrites the color. - đŦ Tap without brush: No paint is performed;
onPaintCallbackfires withkind: 'brush_required', carrying ahintand target region info for the host to show a toast/modal prompting color selection. - âŠī¸ Undo: Bottom-left button or
ref.reset(); steps backward through paint history one action at a time. - đī¸ Compare with Origin: Bottom-right button or
ref.swap(); hides the paint layer to show the original image.
Lasso Mode (Manual Wall Split)â
When manualSplitWalls is enabled and lasso mode is active:
- 𧲠Enter Lasso: Call
ref.startLasso()to activate lasso mode. The lasso polygon overlay (orange) appears. - đ Place Vertices: Tap on wall areas to place polygon vertices. Vertices snap to wall-mask edges/corners automatically.
- 𧲠Magnetic Lasso (when
magneticLasso: true): Paths between taps automatically follow strong image edges (green path overlay) via Sobel gradient + Dijkstra shortest-path. - đ Close Polygon: Tap near the first vertex to close the polygon. A closed polygon is outlined in orange.
- â Drag Vertices: Touch and drag an existing vertex to reposition it. The vertex snaps to wall boundary/corner points, or stays within the wall mask for interior positions.
- â
End Lasso: Call
ref.endLasso()to convert all closed polygons intowall-Nsub-regions ready for painting. - đī¸ Cancel Lasso: Call
ref.cancelLasso()to discard all in-progress lasso polygons without saving. - đī¸ Delete Lasso: Call
ref.deleteLasso(id)to remove a previously committed lasso polygon and its associatedwall-Nregion.
Active Contour Refinementâ
When activeContourRefine: true, the closed lasso polygon is automatically refined after endLasso():
- Each vertex samples positions along its outward normal direction
- Vertices expand to the nearest wall-mask boundary edge (balloon force)
- Douglas-Peucker simplification removes redundant vertices
- Result: the polygon hugs the true wall outline rather than the raw tap positions