feat: implement programmatic lasso selection #236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds
scatterplot.lassoSelect(vertices, options)method to enable automated point selection without manual interaction. Vertices can be specified in data space (using xScale/yScale) or GL space (isGl: true). This provides a programmatic alternative to the interactive lasso tool.What was changed in this pull request?
New API:
lassoSelect(vertices, { merge, remove, isGl })- dedicated method for programmatic lassovertices- array of[x, y]coordinates (minimum 3 vertices)isGl: false(default) - vertices in data space, requires xScale/yScaleisGl: true- vertices in GL space, works without scalesHelper functions:
isVertices()- validates all vertices are valid[x, y]pairsverticesToPolygon()- auto-closes polygons if first/last vertices differverticesFromDataToGl()- converts data space → GL space coordinatesExample
Why is this PR necessary?
Checklist
CHANGELOG.mdupdatedREADME.mdadded or updated