Commit c9fbfec
Add lasso spatial selection tool to map charts (#354)
* feat: Add lasso select tool button to map controls
Add LassoIcon SVG and lasso toggle button to MapControls component with
onLassoToggle/isLassoActive props. Wire up placeholder handlers in both
the Multi map and standalone GeoSetLayer views.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Wire up lasso select tool with layer picker dropdown
Connect the lasso button in MapControls to actual state management in
Multi.tsx. Clicking the lasso button now opens a dropdown listing all
map layers; selecting a layer activates lasso mode for that layer.
Includes styled dropdown panel with outside-click dismissal.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Increase lasso select icon size for better visibility
Bump LassoIcon SVG dimensions from 16x16 to 18x18 to improve visual
consistency with other map control icons. Update wiki to document the
lasso select tool in the feature comparison table.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add library-based lasso drawing with freehand/polygon modes
Integrate @deck.gl-community/editable-layers for proper lasso polygon
drawing, replacing placeholder wiring. Users can now switch between
freehand (drag) and click-to-draw polygon modes. Multi-layer charts
support checkbox-based layer selection for lasso targets. Adds
MapControls unit tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: Extract useLassoSelection hook and fix lasso/ruler bugs
Extract duplicated lasso state management from GeoSetLayer.tsx and
Multi.tsx into a shared useLassoSelection hook. Fix escape key not
exiting lasso mode in single-layer charts, and add reciprocal mode
deactivation so lasso and ruler can never be active simultaneously.
Replace `any` type on LassoOverlay mode state with explicit union type.
Add tests for useLassoSelection (14) and useLassoLayer (7) hooks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add lasso point-in-polygon selection with CSV/Excel export
Wire up lasso polygon completion to filter features using Turf.js
point-in-polygon queries. Both single-layer and multi-layer charts
now show a results bar with feature count and export options (CSV,
Excel via xlsx). Add lassoPolygon, selectedFeatures, and clearSelection
state to useLassoSelection hook. Update docs with new utility files
and lasso feature in README.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Persist lasso polygon display and improve results bar UX
Keep the completed lasso polygon visible (dashed outline + fill) after
drawing finishes so users can see their selection area. Reposition the
results bar from bottom-center to top-left, refine its styling, and
auto-clear selection after CSV/Excel export. Add debug console logging
for lasso selections.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: Add missing lasso component entries to Development Guide
Add LassoOverlay, LassoResultsBar, and useLassoSelection hook to the
Key Utilities table in the Development Guide wiki page.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Switch lasso to single-layer selection and geometry-aware filtering
Replace multi-layer checkbox selection with single-layer radio selection
for the lasso tool. Upgrade lasso filtering from centroid-based to
geometry-aware intersection — points use direct containment, polygons
are selected when ≥50% of their area overlaps the lasso region via
@turf/intersect. Add @turf/area, @turf/intersect, @turf/boolean-within
dependencies.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: Update lasso documentation for single-layer selection and geometry filtering
Reflect the switch from multi-layer to single-layer selection in the
Development Guide and inline comments. Update lassoSelection.ts
description to mention geometry-aware intersection filtering.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Anchor lasso results bar near end of drawn polygon
Position the LassoResultsBar at the screen coordinates of the last
lasso polygon point instead of a fixed top-left corner. Add
anchorPosition state to useLassoSelection hook, project the final
polygon coordinate via WebMercatorViewport, and pass it through to both
single-layer and multi-layer map components.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Stabilize lasso memoization, fix broken tests, and simplify code
Fix critical memoization cascade where EditableGeoJsonLayer was
reconstructed every render due to unstable onPolygonComplete references.
Update useLassoSelection tests to match current single-select API.
Extract LassoDropdown component, remove debug console statements,
unused deps, and drifting anchor positioning.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Improve lasso UX with dashed outlines, activation flow, and anchored results
- Add dashed stroke styling to lasso polygon and guide lines
- Delay draw mode activation to prevent dropdown close click from placing a vertex
- Reset drawing state when results are cleared for seamless re-lasso
- Activate lasso on outside click when a layer is already selected
- Anchor results bar near the end of the drawn polygon instead of fixed position
- Add defaultLayerName option to auto-select preferred layer
- Preserve selected layer when toggling lasso off
- Rename "Freehand" mode label to "Click-and-drag"
- Remove unused @turf/boolean-within dependency
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: Add LassoDropdown to Development Guide key utilities table
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Highlight lasso-selected features and dim unselected layers
Add a GeoJsonLayer overlay in DeckGLContainer that renders lasso-selected
features with their original colors on top of dimmed data layers (opacity
0.15). Both Multi and GeoSetLayer pass selectedFeatures to the container.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add per-layer lasso-selectable option and improve lasso geometry support
Add a configurable "Lasso Selectable" toggle to the layer settings popover,
letting users control which layers appear in the lasso tool's dropdown.
Also adds LineString/MultiLineString geometry support to lasso selection,
prevents feature popups while lasso is active, removes the disabled
"Download as image" placeholder, and simplifies default layer selection
by removing the hardcoded defaultLayerName preference.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add cursor-following hint tooltip for lasso tool
Shows contextual help text near the cursor when the lasso tool is active
and no features are selected yet — "Double-click or click first point to
close" for polygon mode, "Click and drag to draw selection" for freehand
mode. Tooltip disappears once a selection is made or the mouse leaves
the map.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Simplify lasso logic, fix bugs, and add test coverage
- Consolidate duplicated state resets into shared resetLassoState()
- Fix category key normalization inconsistency between single/multi-layer views
- Fix CSV formula injection by guarding =, +, -, @ prefixes in escapeCSV
- Fix MapControls tests to match actual "Click-and-drag" label
- Fix handleLassoToggle to clear selectedLassoLayerId (matching test intent)
- Suppress feature click popups during lasso mode in GeoSetLayer
- Guard against setState-on-unmount in Excel export async handler
- Extract DASH_PROPS constant in LassoOverlay (eliminates 4x duplication)
- Simplify Multi.tsx to call filterFeaturesInLasso directly (single-layer)
- Remove redundant count prop from LassoResultsBar
- Stabilize selectedFeaturesArr reference in DeckGLContainer with useMemo
- Remove unnecessary transitive deps from root package.json
- Add unit tests for lassoSelection.ts and lassoExport.ts (22 new tests)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: Extract shared hooks, icons, and constants from lasso code
Split useLassoSelection into focused useLassoActivation and
useLassoResults sub-hooks. Extract useClickOutside to deduplicate
outside-click handling. Consolidate SVG icons into shared icons.tsx.
Replace magic color/timing values with named constants. Cache XLSX
dynamic import. Add console.warn to silent catch blocks and expand
test coverage for Polygon/MultiLineString geometry types.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Fix lasso bugs, extract shared helper, and clean up code
- Fix auto-select bug after toggle cycle by adding resetCount dep
- Extract shared buildLassoResult helper to deduplicate onPolygonComplete
- Remove dead code (filterMultiLayerFeaturesInLasso, LassoSelectionResult)
- Add categoryName/strokeColor to GeoJsonFeature type (remove as-any casts)
- Fix LassoOverlay race condition with drawModeRef during activation delay
- Fix CSV formula guard to skip numeric values like -5.2
- Normalize highlight layer colors to 4-element RGBA arrays
- Combine duplicate @deck.gl/layers imports in LassoOverlay
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Fix category normalization bug, replace vulnerable xlsx, and improve lasso code
Normalize category keys in Multi.tsx when building hiddenCategoryKeys so
hidden categories are correctly filtered during multi-layer lasso selection.
Replace xlsx (CVE-2023-30533) with exceljs for Excel export. Extract shared
fullReset in useLassoSelection, stabilize useClickOutside with a callback ref,
add explanatory comments for eslint-disable, and use CloseIcon in LassoDropdown.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add circle and rectangle lasso draw modes, improve spatial accuracy
Add circle and rectangle as new lasso shape options alongside freehand
and polygon. Improve line/multiline selection using geometric intersection
instead of vertex-only checks, handle self-intersecting freehand polygons
via unkinkPolygon, and batch async filtering to avoid UI freezes on large
datasets. Store the results-bar anchor as a geo coordinate so it tracks
pan/zoom. Persist draw mode to sessionStorage, add ARIA attributes for
accessibility, harden Excel export against formula injection, and add
LassoDropdown and LassoResultsBar test coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Remove frozen feature collection, disable lasso tooltips, and fix hook ordering
Remove Object.freeze from EMPTY_FEATURE_COLLECTION to avoid mutation
conflicts with nebula.gl, suppress edit layer tooltips, and reorder
anchorPosition useMemo to correct hook dependency placement.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Preserve layer selection when toggling lasso off
Change handleLassoToggle to only deactivate and clear results instead
of doing a full reset, so the user's layer selection is retained.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Fix TypeScript errors in lasso test files
Remove unused `style` variable in LassoResultsBar test and add explicit
type annotations for `mockLayerCalls` and `props` in useLassoLayer test.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Fix pre-existing TS2352 type error in legacy Contour layer
Cast d.position through unknown before asserting as Position, since
number[] is not directly assignable to readonly [number, number].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Add toast notifications for lasso CSV and Excel exports
Show success/error toasts via useToasts when exporting lasso selections,
replacing silent console.error handling. Add test coverage for all four
toast scenarios.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: Replace exceljs with xlsx for Excel export
Switch back to xlsx for lazy-loaded Excel export in the lasso tool.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Improve lasso results bar positioning, export filtering, and UX
- Clamp results bar within map bounds and flip menu when near edge
- Re-enable map panning after lasso drawing completes
- Use live viewport for anchor projection so bar tracks pan/zoom
- Show results bar with "0 Items Selected" when polygon drawn but
no features matched; hide export menu when count is zero
- Filter internal layer properties (fillColor, strokeColor, etc.)
from CSV/Excel exports
- Add type declarations for turf and editable-layers packages
- Make toast callbacks optional props instead of using useToasts hook
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Guard results bar on anchor position and optimize lasso filtering
Only render LassoResultsBar when anchorPosition is computed to prevent
flash at (0,0). Run spatial filtering synchronously for datasets up to
5000 features to eliminate async overhead; batch with yields above that.
Extract prepareLassoPolygons helper for clarity.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Filter dynamic color_ prefixed keys and pointSize from lasso exports
Add isInternalKey helper that checks both the static INTERNAL_KEYS set
and color_ prefixed keys generated by layer processing. Add pointSize
to the exclusion list. Formatting cleanup in escapeCSV.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Switch lasso export to allowlist of user-configured query columns
Build exportColumnNames in transformProps from dimension, hover, feature
info, color-by, point-size, and text-label columns. Pass allowlist
through to LassoResultsBar and export utilities so only raw data columns
appear in CSV/Excel output. Falls back to all properties when no
allowlist is available.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Update LassoResultsBar tests for prop-based toasts and allowedColumns
Pass toast callbacks as props instead of mocking useToasts hook. Update
export assertions to include the new allowedColumns parameter.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: Simplify export allowlist to hover and feature info columns
Remove dimension, colorByValue, pointSize, and textLabel from export
columns — users only need data columns, not rendering config inputs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: Add lasso select tool user guide to wiki pages
Add a Lasso Select Tool section to GeoSet Map Layer with usage steps,
draw modes, selection behavior by geometry type, export column details,
and per-layer config. Add a shorter reference section to GeoSet Multi
Map. Update Development Guide to note the export allowlist.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: Show lasso polygon area and switch toasts to antd message
Display calculated area (acres/sq mi) on the lasso results bar and
replace prop-based toast callbacks with antd's built-in message API
for simpler, self-contained export notifications.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Suppress hover tooltips during lasso draw mode
Hide hover tooltips while lasso mode is active to prevent them from
flickering over the drawing surface. Clear any visible tooltip on
lasso activation. Also bump the activation delay from 300ms to 450ms
to better prevent the dropdown-close click from placing a vertex.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: lhawkins <lhawkins@teamraft.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent e6a4b25 commit c9fbfec
39 files changed
Lines changed: 6627 additions & 1508 deletions
File tree
- superset-frontend
- plugins
- geoset-map-chart
- src
- GeoSetMultiMap
- components
- hooks
- layers/GeoSetLayer
- utils
- test
- GeoSetMultiMap
- components
- hooks
- utils
- legacy-preset-chart-deckgl/src/layers/Contour
- src/explore/components/controls/DeckSlicesControl
- wiki
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
Lines changed: 130 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
109 | 137 | | |
110 | 138 | | |
111 | 139 | | |
| |||
186 | 214 | | |
187 | 215 | | |
188 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
189 | 221 | | |
190 | 222 | | |
191 | 223 | | |
| |||
369 | 401 | | |
370 | 402 | | |
371 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
372 | 450 | | |
373 | 451 | | |
374 | | - | |
| 452 | + | |
375 | 453 | | |
376 | | - | |
| 454 | + | |
377 | 455 | | |
378 | 456 | | |
379 | 457 | | |
380 | | - | |
381 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
382 | 470 | | |
383 | 471 | | |
384 | 472 | | |
| |||
539 | 627 | | |
540 | 628 | | |
541 | 629 | | |
| 630 | + | |
542 | 631 | | |
543 | 632 | | |
544 | 633 | | |
| |||
551 | 640 | | |
552 | 641 | | |
553 | 642 | | |
| 643 | + | |
| 644 | + | |
554 | 645 | | |
555 | 646 | | |
556 | 647 | | |
| |||
559 | 650 | | |
560 | 651 | | |
561 | 652 | | |
562 | | - | |
| 653 | + | |
563 | 654 | | |
564 | 655 | | |
565 | | - | |
| 656 | + | |
566 | 657 | | |
567 | | - | |
568 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
569 | 665 | | |
570 | 666 | | |
571 | 667 | | |
572 | 668 | | |
573 | 669 | | |
574 | 670 | | |
575 | 671 | | |
576 | | - | |
577 | 672 | | |
578 | 673 | | |
579 | 674 | | |
| |||
584 | 679 | | |
585 | 680 | | |
586 | 681 | | |
587 | | - | |
| 682 | + | |
588 | 683 | | |
589 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
590 | 694 | | |
591 | 695 | | |
592 | 696 | | |
| |||
596 | 700 | | |
597 | 701 | | |
598 | 702 | | |
599 | | - | |
600 | 703 | | |
601 | 704 | | |
602 | 705 | | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
| 706 | + | |
607 | 707 | | |
608 | 708 | | |
609 | 709 | | |
610 | 710 | | |
611 | 711 | | |
612 | 712 | | |
613 | 713 | | |
614 | | - | |
| 714 | + | |
615 | 715 | | |
616 | 716 | | |
617 | 717 | | |
618 | | - | |
619 | 718 | | |
620 | 719 | | |
621 | 720 | | |
622 | | - | |
| 721 | + | |
623 | 722 | | |
624 | 723 | | |
625 | 724 | | |
626 | 725 | | |
627 | 726 | | |
628 | 727 | | |
629 | 728 | | |
630 | | - | |
631 | 729 | | |
632 | 730 | | |
633 | 731 | | |
| |||
639 | 737 | | |
640 | 738 | | |
641 | 739 | | |
642 | | - | |
643 | 740 | | |
644 | 741 | | |
645 | 742 | | |
646 | 743 | | |
647 | 744 | | |
648 | 745 | | |
649 | | - | |
650 | | - | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
651 | 751 | | |
652 | 752 | | |
653 | 753 | | |
| |||
740 | 840 | | |
741 | 841 | | |
742 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
743 | 850 | | |
744 | 851 | | |
745 | 852 | | |
| |||
0 commit comments