Workflow
- User completes a lasso selection on the page
- The system shows the lasso toolbar (plugin-registered buttons may appear)
- User taps a plugin button and enters the plugin UI
- The plugin reads the lasso rectangle and selected elements, then runs business logic (e.g., modify selected TextBox elements, titles, geometries, stars, etc.)
- The plugin can show/hide/remove the lasso box as needed
Data Model
The selected element list can be obtained viaPluginCommAPI.getLassoElements(). The return value is Element[].
- Use
Element.typeto distinguish element categories (constants:ElementType) - For large point datasets (e.g., angle points, contour points),
Elementfields are provided as accessors (ElementDataAccessor) to avoid transferring large point sets to RN at once
Common APIs
| Goal | API | Description |
|---|---|---|
| Get lasso rectangle | getLassoRect() | Returns lasso rectangle (Rect) |
| Create lasso selection | lassoElements(rect) | Creates a lasso selection from a rectangle (pixel coordinates) |
| Resize lasso rectangle | resizeLassoRect(rect) | Resizes the lasso rectangle. Currently only proportional scaling is supported |
| Get selected elements | getLassoElements() | Returns Element[] (accessor fields are filled on success) |
| Control lasso box | setLassoBoxState(state) | 0 show, 1 hide, 2 remove completely |
Example
The example below shows how to, within a plugin UI:- Get the lasso rectangle
- Update the lasso rectangle by proportional scaling
- Get selected elements and filter by type
- Show/hide/remove the lasso box
Constraints and Recommendations
resizeLassoRectcurrently only supports proportional scaling: callgetLassoRectfirst, scale around the center, then submit the resizegetLassoElementsmay return elements with accessor fields: do not assume point sets are fully in JS; use accessors to fetch data on demandsetLassoBoxState(2)removes the lasso state completely: typically used at the end of an operation; after removal, the lasso toolbar will close on the user side