Skip to main content
Lasso is a common selection interaction in NOTE/DOC. After the user draws a region on the page, the system computes the selected element set and shows the lasso toolbar. Plugins can display their registered buttons in the lasso toolbar. After the user taps a plugin button and enters the plugin UI, the plugin can read and modify data based on the current lasso context.

Workflow

  1. User completes a lasso selection on the page
  2. The system shows the lasso toolbar (plugin-registered buttons may appear)
  3. User taps a plugin button and enters the plugin UI
  4. The plugin reads the lasso rectangle and selected elements, then runs business logic (e.g., modify selected TextBox elements, titles, geometries, stars, etc.)
  5. The plugin can show/hide/remove the lasso box as needed

Data Model

The selected element list can be obtained via PluginCommAPI.getLassoElements(). The return value is Element[].
  • Use Element.type to distinguish element categories (constants: ElementType)
  • For large point datasets (e.g., angle points, contour points), Element fields are provided as accessors (ElementDataAccessor) to avoid transferring large point sets to RN at once

Common APIs

The lasso rectangle is a UI interaction rectangle and is typically expressed in the pixel coordinate system, while stroke point data uses the EMR coordinate system. If you need to align them, confirm the coordinate systems first and convert as needed. See Coordinate System.

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

  • resizeLassoRect currently only supports proportional scaling: call getLassoRect first, scale around the center, then submit the resize
  • getLassoElements may return elements with accessor fields: do not assume point sets are fully in JS; use accessors to fetch data on demand
  • setLassoBoxState(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
  • setLassoBoxState(3) fully hides the lasso box (including lasso elements): typically used for custom toolbars/UI so the plugin can control the presentation