@accelint/map-toolkit 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/catalog-info.yaml +5 -3
- package/dist/camera/use-camera-state.js +1 -2
- package/dist/camera/use-camera-state.js.map +1 -1
- package/dist/deckgl/base-map/constants.d.ts +9 -2
- package/dist/deckgl/base-map/constants.js +9 -2
- package/dist/deckgl/base-map/constants.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +4 -2
- package/dist/deckgl/base-map/index.js +5 -6
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/types.d.ts +6 -1
- package/dist/deckgl/index.d.ts +8 -2
- package/dist/deckgl/index.js +6 -2
- package/dist/deckgl/saved-viewports/index.d.ts +1 -1
- package/dist/deckgl/saved-viewports/index.js +1 -2
- package/dist/deckgl/saved-viewports/index.js.map +1 -1
- package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +44 -0
- package/dist/deckgl/shapes/display-shape-layer/constants.js +61 -0
- package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js → deckgl/shapes/display-shape-layer/fiber.d.ts} +11 -7
- package/dist/{packages/hotkey-manager/dist/lib/is-client/index.js → deckgl/shapes/display-shape-layer/fiber.js} +6 -7
- package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/index.d.ts +206 -0
- package/dist/deckgl/shapes/display-shape-layer/index.js +416 -0
- package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +66 -0
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +116 -0
- package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/store.d.ts +87 -0
- package/dist/deckgl/shapes/display-shape-layer/store.js +316 -0
- package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/types.d.ts +115 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fly-to-viewport.js → deckgl/shapes/display-shape-layer/types.js} +0 -2
- package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.d.ts +89 -0
- package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js +88 -0
- package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +61 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +111 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +196 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +368 -0
- package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -0
- package/dist/deckgl/shapes/index.d.ts +20 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js → deckgl/shapes/index.js} +6 -11
- package/dist/deckgl/shapes/shared/constants.d.ts +78 -0
- package/dist/deckgl/shapes/shared/constants.js +109 -0
- package/dist/deckgl/shapes/shared/constants.js.map +1 -0
- package/dist/deckgl/shapes/shared/events.d.ts +73 -0
- package/dist/deckgl/shapes/shared/events.js +58 -0
- package/dist/deckgl/shapes/shared/events.js.map +1 -0
- package/dist/deckgl/shapes/shared/types.d.ts +158 -0
- package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js → deckgl/shapes/shared/types.js} +13 -4
- package/dist/deckgl/shapes/shared/types.js.map +1 -0
- package/dist/deckgl/symbol-layer/index.d.ts +1 -1
- package/dist/viewport/viewport-size.d.ts +2 -2
- package/package.json +36 -20
- package/dist/_virtual/rolldown_runtime.js +0 -22
- package/dist/decorators/deckgl.d.ts +0 -19
- package/dist/decorators/deckgl.js +0 -32
- package/dist/decorators/deckgl.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js +0 -63
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/index.js +0 -19
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/normalize-viewport-props.js +0 -14
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js +0 -59
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-viewport.js +0 -16
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +0 -54
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/layer.js +0 -15
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js +0 -91
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +0 -88
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +0 -69
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +0 -35
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/source.js +0 -15
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +0 -29
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +0 -40
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +0 -23
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/index.js +0 -27
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +0 -57
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +0 -343
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +0 -28
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +0 -31
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +0 -57
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +0 -30
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +0 -53
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +0 -52
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +0 -1
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +0 -22
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js +0 -812
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js.map +0 -1
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js +0 -35
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js +0 -195
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js +0 -76
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js.map +0 -1
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js +0 -39
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js.map +0 -1
- package/dist/node_modules/.pnpm/react-map-gl@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-map-gl/dist/maplibre.js +0 -16
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js +0 -27
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js.map +0 -1
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +0 -45
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js +0 -78
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/constants.js +0 -47
- package/dist/packages/hotkey-manager/dist/constants.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/enums/keycode.js +0 -130
- package/dist/packages/hotkey-manager/dist/enums/keycode.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/is-client/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js +0 -24
- package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js +0 -39
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js +0 -27
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js.map +0 -1
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js +0 -95
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js.map +0 -1
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { DisplayShapeLayerProps } from "./types.js";
|
|
13
14
|
|
|
14
|
-
//#region
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
//#region src/deckgl/shapes/display-shape-layer/fiber.d.ts
|
|
16
|
+
declare global {
|
|
17
|
+
namespace React {
|
|
18
|
+
namespace JSX {
|
|
19
|
+
interface IntrinsicElements {
|
|
20
|
+
displayShapeLayer: DisplayShapeLayerProps;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { assert };
|
|
21
|
-
//# sourceMappingURL=assert.js.map
|
|
25
|
+
//# sourceMappingURL=fiber.d.ts.map
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
import { DisplayShapeLayer } from "./index.js";
|
|
15
|
+
import { extend } from "@deckgl-fiber-renderer/dom";
|
|
16
|
+
|
|
17
|
+
//#region src/deckgl/shapes/display-shape-layer/fiber.ts
|
|
18
|
+
extend({ DisplayShapeLayer });
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=fiber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fiber.js","names":[],"sources":["../../../../src/deckgl/shapes/display-shape-layer/fiber.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { extend } from '@deckgl-fiber-renderer/dom';\nimport { DisplayShapeLayer } from './index';\nimport type { DisplayShapeLayerProps } from './types';\n\nextend({ DisplayShapeLayer });\n\ndeclare global {\n namespace React {\n // biome-ignore lint/style/useNamingConvention: Built-in React namespace.\n namespace JSX {\n interface IntrinsicElements {\n displayShapeLayer: DisplayShapeLayerProps;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,OAAO,EAAE,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { ShapeId } from "../shared/types.js";
|
|
14
|
+
import { DisplayShapeLayerProps } from "./types.js";
|
|
15
|
+
import * as _deck_gl_core0 from "@deck.gl/core";
|
|
16
|
+
import { CompositeLayer, Layer, PickingInfo } from "@deck.gl/core";
|
|
17
|
+
|
|
18
|
+
//#region src/deckgl/shapes/display-shape-layer/index.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* State interface for DisplayShapeLayer
|
|
21
|
+
*/
|
|
22
|
+
interface DisplayShapeLayerState {
|
|
23
|
+
/** Index of currently hovered shape, undefined when not hovering */
|
|
24
|
+
hoverIndex?: number;
|
|
25
|
+
/** ID of the last hovered shape for event deduplication */
|
|
26
|
+
lastHoveredId?: ShapeId | null;
|
|
27
|
+
/** Allow additional properties from base layer state */
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* DisplayShapeLayer - Read-only shapes visualization layer
|
|
32
|
+
*
|
|
33
|
+
* A composite deck.gl layer for displaying geographic shapes with interactive features.
|
|
34
|
+
* Ideal for rendering shapes from external APIs or displaying read-only geographic data.
|
|
35
|
+
*
|
|
36
|
+
* ## Features
|
|
37
|
+
* - **Multiple geometry types**: Point, LineString, Polygon, and Circle
|
|
38
|
+
* - **Icon support**: Custom icons for Point geometries via icon atlases
|
|
39
|
+
* - **Interactive selection**: Click handling with dotted border and optional highlight
|
|
40
|
+
* - **Hover effects**: Line width increases on hover for better UX
|
|
41
|
+
* - **Customizable labels**: Flexible label positioning with per-shape or global options
|
|
42
|
+
* - **Style properties**: Full control over colors, stroke patterns, and opacity
|
|
43
|
+
* - **Event bus integration**: Automatically emits shape events via @accelint/bus
|
|
44
|
+
* - **Multi-map support**: Events include map instance ID for isolation
|
|
45
|
+
*
|
|
46
|
+
* ## Selection Visual Feedback
|
|
47
|
+
* When a shape is selected via `selectedShapeId`:
|
|
48
|
+
* - The shape's stroke pattern changes to dotted
|
|
49
|
+
* - An optional highlight renders underneath (controlled by `showHighlight` prop)
|
|
50
|
+
*
|
|
51
|
+
* ## Layer Structure
|
|
52
|
+
* Renders up to four sublayers (in order, bottom to top):
|
|
53
|
+
* 1. **Highlight layer**: Selection highlight effect for non-icon-Point shapes (if showHighlight=true)
|
|
54
|
+
* 2. **Coffin corners layer**: Selection/hover feedback for Point shapes with icons
|
|
55
|
+
* 3. **Main GeoJsonLayer**: Shape geometries with styling and interaction
|
|
56
|
+
* 4. **Label layer**: Text labels (if showLabels enabled)
|
|
57
|
+
*
|
|
58
|
+
* ## Icon Atlas Constraint
|
|
59
|
+
* When using icons for Point geometries, all shapes in a single layer must share the
|
|
60
|
+
* same icon atlas. The layer uses the first atlas found across all features. If you
|
|
61
|
+
* need icons from different atlases, use separate DisplayShapeLayer instances.
|
|
62
|
+
*
|
|
63
|
+
* ## Event Bus Integration
|
|
64
|
+
* Automatically emits shape events that can be consumed anywhere in your app:
|
|
65
|
+
* - `shapes:selected` - Emitted when a shape is clicked (includes mapId)
|
|
66
|
+
* - `shapes:hovered` - Emitted when the hovered shape changes (deduplicated, includes mapId)
|
|
67
|
+
*
|
|
68
|
+
* For selection with auto-deselection, use the companion `useShapeSelection` hook which handles
|
|
69
|
+
* all the event wiring automatically. See the example below.
|
|
70
|
+
*
|
|
71
|
+
* @example Basic usage with useShapeSelection hook (recommended)
|
|
72
|
+
* ```tsx
|
|
73
|
+
* import '@accelint/map-toolkit/deckgl/shapes/display-shape-layer/fiber';
|
|
74
|
+
* import { useShapeSelection } from '@accelint/map-toolkit/deckgl/shapes';
|
|
75
|
+
* import { uuid } from '@accelint/core';
|
|
76
|
+
*
|
|
77
|
+
* const MAP_ID = uuid();
|
|
78
|
+
*
|
|
79
|
+
* function MapWithShapes() {
|
|
80
|
+
* const { selectedId } = useShapeSelection(MAP_ID);
|
|
81
|
+
*
|
|
82
|
+
* return (
|
|
83
|
+
* <BaseMap id={MAP_ID}>
|
|
84
|
+
* <displayShapeLayer
|
|
85
|
+
* id="my-shapes"
|
|
86
|
+
* mapId={MAP_ID}
|
|
87
|
+
* data={shapes}
|
|
88
|
+
* selectedShapeId={selectedId}
|
|
89
|
+
* showLabels={true}
|
|
90
|
+
* pickable={true}
|
|
91
|
+
* />
|
|
92
|
+
* </BaseMap>
|
|
93
|
+
* );
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example With custom label positioning
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <displayShapeLayer
|
|
100
|
+
* id="my-shapes"
|
|
101
|
+
* data={shapes}
|
|
102
|
+
* showLabels={true}
|
|
103
|
+
* labelOptions={{
|
|
104
|
+
* // Position circle labels at the top
|
|
105
|
+
* circleLabelCoordinateAnchor: 'top',
|
|
106
|
+
* circleLabelVerticalAnchor: 'bottom',
|
|
107
|
+
* circleLabelOffset: [0, -10],
|
|
108
|
+
* // Position line labels at the middle
|
|
109
|
+
* lineStringLabelCoordinateAnchor: 'middle',
|
|
110
|
+
* }}
|
|
111
|
+
* />
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
declare class DisplayShapeLayer extends CompositeLayer<DisplayShapeLayerProps> {
|
|
115
|
+
state: DisplayShapeLayerState;
|
|
116
|
+
/** Cache for transformed features to avoid recreating objects on every render */
|
|
117
|
+
private featuresCache;
|
|
118
|
+
static layerName: string;
|
|
119
|
+
static defaultProps: {
|
|
120
|
+
pickable: boolean;
|
|
121
|
+
showLabels: boolean;
|
|
122
|
+
showHighlight: boolean;
|
|
123
|
+
applyBaseOpacity: boolean;
|
|
124
|
+
highlightColor: [number, number, number, number];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Clean up state and caches when layer is destroyed
|
|
128
|
+
*/
|
|
129
|
+
finalizeState(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Override getPickingInfo to handle events from sublayers
|
|
132
|
+
* This is the correct pattern for CompositeLayer event handling
|
|
133
|
+
*/
|
|
134
|
+
getPickingInfo({
|
|
135
|
+
info,
|
|
136
|
+
mode,
|
|
137
|
+
sourceLayer
|
|
138
|
+
}: {
|
|
139
|
+
info: PickingInfo;
|
|
140
|
+
mode?: string;
|
|
141
|
+
sourceLayer?: any;
|
|
142
|
+
}): {
|
|
143
|
+
color: Uint8Array | null;
|
|
144
|
+
layer: Layer | null;
|
|
145
|
+
sourceLayer?: Layer | null;
|
|
146
|
+
viewport?: _deck_gl_core0.Viewport;
|
|
147
|
+
index: number;
|
|
148
|
+
picked: boolean;
|
|
149
|
+
object?: any;
|
|
150
|
+
x: number;
|
|
151
|
+
y: number;
|
|
152
|
+
pixel?: [number, number];
|
|
153
|
+
coordinate?: number[];
|
|
154
|
+
devicePixel?: [number, number];
|
|
155
|
+
pixelRatio: number;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Convert shapes to GeoJSON features with shapeId in properties.
|
|
159
|
+
* Uses caching to avoid recreating objects on every render cycle.
|
|
160
|
+
*/
|
|
161
|
+
private getFeaturesWithId;
|
|
162
|
+
/**
|
|
163
|
+
* Look up a shape by ID from the data prop.
|
|
164
|
+
* Used by event handlers to get full shape without storing in feature properties.
|
|
165
|
+
*/
|
|
166
|
+
private getShapeById;
|
|
167
|
+
/**
|
|
168
|
+
* Handle shape click
|
|
169
|
+
*/
|
|
170
|
+
private handleShapeClick;
|
|
171
|
+
/**
|
|
172
|
+
* Handle shape hover
|
|
173
|
+
*/
|
|
174
|
+
private handleShapeHover;
|
|
175
|
+
/**
|
|
176
|
+
* Render highlight sublayer (underneath main layer)
|
|
177
|
+
* Note: Points with icons use coffin corners instead of highlight layer
|
|
178
|
+
*/
|
|
179
|
+
private renderHighlightLayer;
|
|
180
|
+
/**
|
|
181
|
+
* Render coffin corners layer for Point geometries that have icons on hover/select
|
|
182
|
+
* Coffin corners provide visual feedback for points instead of highlight layer
|
|
183
|
+
*/
|
|
184
|
+
private renderCoffinCornersLayer;
|
|
185
|
+
/**
|
|
186
|
+
* Extract icon configuration from features in a single pass.
|
|
187
|
+
* Returns the first icon's atlas and mapping (all shapes share the same atlas).
|
|
188
|
+
* Uses early return for O(1) best case when first feature has icons.
|
|
189
|
+
*/
|
|
190
|
+
private getIconConfig;
|
|
191
|
+
/**
|
|
192
|
+
* Render main shapes layer
|
|
193
|
+
*/
|
|
194
|
+
private renderMainLayer;
|
|
195
|
+
/**
|
|
196
|
+
* Render labels layer
|
|
197
|
+
*/
|
|
198
|
+
private renderLabelsLayer;
|
|
199
|
+
/**
|
|
200
|
+
* Render all sublayers
|
|
201
|
+
*/
|
|
202
|
+
renderLayers(): Layer[];
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { DisplayShapeLayer };
|
|
206
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'use client';
|
|
15
|
+
|
|
16
|
+
import { DASH_ARRAYS, SHAPE_LAYER_IDS } from "../shared/constants.js";
|
|
17
|
+
import { ShapeEvents } from "../shared/events.js";
|
|
18
|
+
import { COFFIN_CORNERS, DEFAULT_DISPLAY_PROPS, MAP_INTERACTION } from "./constants.js";
|
|
19
|
+
import { createShapeLabelLayer } from "./shape-label-layer.js";
|
|
20
|
+
import { getDashArray, getFillColor, getHighlightColor, getHighlightLineWidth, getHoverLineWidth, getStrokeColor } from "./utils/display-style.js";
|
|
21
|
+
import { Broadcast } from "@accelint/bus";
|
|
22
|
+
import { CompositeLayer } from "@deck.gl/core";
|
|
23
|
+
import { PathStyleExtension } from "@deck.gl/extensions";
|
|
24
|
+
import { GeoJsonLayer, IconLayer } from "@deck.gl/layers";
|
|
25
|
+
|
|
26
|
+
//#region src/deckgl/shapes/display-shape-layer/index.ts
|
|
27
|
+
/**
|
|
28
|
+
* Typed event bus instance for shape events.
|
|
29
|
+
* Provides type-safe event emission for shape interactions.
|
|
30
|
+
*/
|
|
31
|
+
const shapeBus = Broadcast.getInstance();
|
|
32
|
+
/**
|
|
33
|
+
* DisplayShapeLayer - Read-only shapes visualization layer
|
|
34
|
+
*
|
|
35
|
+
* A composite deck.gl layer for displaying geographic shapes with interactive features.
|
|
36
|
+
* Ideal for rendering shapes from external APIs or displaying read-only geographic data.
|
|
37
|
+
*
|
|
38
|
+
* ## Features
|
|
39
|
+
* - **Multiple geometry types**: Point, LineString, Polygon, and Circle
|
|
40
|
+
* - **Icon support**: Custom icons for Point geometries via icon atlases
|
|
41
|
+
* - **Interactive selection**: Click handling with dotted border and optional highlight
|
|
42
|
+
* - **Hover effects**: Line width increases on hover for better UX
|
|
43
|
+
* - **Customizable labels**: Flexible label positioning with per-shape or global options
|
|
44
|
+
* - **Style properties**: Full control over colors, stroke patterns, and opacity
|
|
45
|
+
* - **Event bus integration**: Automatically emits shape events via @accelint/bus
|
|
46
|
+
* - **Multi-map support**: Events include map instance ID for isolation
|
|
47
|
+
*
|
|
48
|
+
* ## Selection Visual Feedback
|
|
49
|
+
* When a shape is selected via `selectedShapeId`:
|
|
50
|
+
* - The shape's stroke pattern changes to dotted
|
|
51
|
+
* - An optional highlight renders underneath (controlled by `showHighlight` prop)
|
|
52
|
+
*
|
|
53
|
+
* ## Layer Structure
|
|
54
|
+
* Renders up to four sublayers (in order, bottom to top):
|
|
55
|
+
* 1. **Highlight layer**: Selection highlight effect for non-icon-Point shapes (if showHighlight=true)
|
|
56
|
+
* 2. **Coffin corners layer**: Selection/hover feedback for Point shapes with icons
|
|
57
|
+
* 3. **Main GeoJsonLayer**: Shape geometries with styling and interaction
|
|
58
|
+
* 4. **Label layer**: Text labels (if showLabels enabled)
|
|
59
|
+
*
|
|
60
|
+
* ## Icon Atlas Constraint
|
|
61
|
+
* When using icons for Point geometries, all shapes in a single layer must share the
|
|
62
|
+
* same icon atlas. The layer uses the first atlas found across all features. If you
|
|
63
|
+
* need icons from different atlases, use separate DisplayShapeLayer instances.
|
|
64
|
+
*
|
|
65
|
+
* ## Event Bus Integration
|
|
66
|
+
* Automatically emits shape events that can be consumed anywhere in your app:
|
|
67
|
+
* - `shapes:selected` - Emitted when a shape is clicked (includes mapId)
|
|
68
|
+
* - `shapes:hovered` - Emitted when the hovered shape changes (deduplicated, includes mapId)
|
|
69
|
+
*
|
|
70
|
+
* For selection with auto-deselection, use the companion `useShapeSelection` hook which handles
|
|
71
|
+
* all the event wiring automatically. See the example below.
|
|
72
|
+
*
|
|
73
|
+
* @example Basic usage with useShapeSelection hook (recommended)
|
|
74
|
+
* ```tsx
|
|
75
|
+
* import '@accelint/map-toolkit/deckgl/shapes/display-shape-layer/fiber';
|
|
76
|
+
* import { useShapeSelection } from '@accelint/map-toolkit/deckgl/shapes';
|
|
77
|
+
* import { uuid } from '@accelint/core';
|
|
78
|
+
*
|
|
79
|
+
* const MAP_ID = uuid();
|
|
80
|
+
*
|
|
81
|
+
* function MapWithShapes() {
|
|
82
|
+
* const { selectedId } = useShapeSelection(MAP_ID);
|
|
83
|
+
*
|
|
84
|
+
* return (
|
|
85
|
+
* <BaseMap id={MAP_ID}>
|
|
86
|
+
* <displayShapeLayer
|
|
87
|
+
* id="my-shapes"
|
|
88
|
+
* mapId={MAP_ID}
|
|
89
|
+
* data={shapes}
|
|
90
|
+
* selectedShapeId={selectedId}
|
|
91
|
+
* showLabels={true}
|
|
92
|
+
* pickable={true}
|
|
93
|
+
* />
|
|
94
|
+
* </BaseMap>
|
|
95
|
+
* );
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example With custom label positioning
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <displayShapeLayer
|
|
102
|
+
* id="my-shapes"
|
|
103
|
+
* data={shapes}
|
|
104
|
+
* showLabels={true}
|
|
105
|
+
* labelOptions={{
|
|
106
|
+
* // Position circle labels at the top
|
|
107
|
+
* circleLabelCoordinateAnchor: 'top',
|
|
108
|
+
* circleLabelVerticalAnchor: 'bottom',
|
|
109
|
+
* circleLabelOffset: [0, -10],
|
|
110
|
+
* // Position line labels at the middle
|
|
111
|
+
* lineStringLabelCoordinateAnchor: 'middle',
|
|
112
|
+
* }}
|
|
113
|
+
* />
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
var DisplayShapeLayer = class extends CompositeLayer {
|
|
117
|
+
/** Cache for transformed features to avoid recreating objects on every render */
|
|
118
|
+
featuresCache = null;
|
|
119
|
+
static layerName = "DisplayShapeLayer";
|
|
120
|
+
static defaultProps = { ...DEFAULT_DISPLAY_PROPS };
|
|
121
|
+
/**
|
|
122
|
+
* Clean up state and caches when layer is destroyed
|
|
123
|
+
*/
|
|
124
|
+
finalizeState() {
|
|
125
|
+
if (this.state?.hoverIndex !== void 0) this.setState({
|
|
126
|
+
hoverIndex: void 0,
|
|
127
|
+
lastHoveredId: void 0
|
|
128
|
+
});
|
|
129
|
+
this.featuresCache = null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Override getPickingInfo to handle events from sublayers
|
|
133
|
+
* This is the correct pattern for CompositeLayer event handling
|
|
134
|
+
*/
|
|
135
|
+
getPickingInfo({ info, mode, sourceLayer }) {
|
|
136
|
+
if (sourceLayer?.id === `${this.props.id}-${SHAPE_LAYER_IDS.DISPLAY}`) {
|
|
137
|
+
if (mode === "query") this.handleShapeClick(info);
|
|
138
|
+
if (mode === "hover" || !mode) {
|
|
139
|
+
if (info.index !== void 0 && info.index !== this.state?.hoverIndex) this.setState({ hoverIndex: info.index });
|
|
140
|
+
else if (info.index === void 0 && this.state?.hoverIndex !== void 0) this.setState({ hoverIndex: void 0 });
|
|
141
|
+
this.handleShapeHover(info);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return info;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Convert shapes to GeoJSON features with shapeId in properties.
|
|
148
|
+
* Uses caching to avoid recreating objects on every render cycle.
|
|
149
|
+
*/
|
|
150
|
+
getFeaturesWithId() {
|
|
151
|
+
const { data } = this.props;
|
|
152
|
+
if (this.featuresCache?.data === data) return this.featuresCache.features;
|
|
153
|
+
const features = data.map((shape) => ({
|
|
154
|
+
...shape.feature,
|
|
155
|
+
properties: {
|
|
156
|
+
...shape.feature.properties,
|
|
157
|
+
shapeId: shape.id
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
this.featuresCache = {
|
|
161
|
+
data,
|
|
162
|
+
features
|
|
163
|
+
};
|
|
164
|
+
return features;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Look up a shape by ID from the data prop.
|
|
168
|
+
* Used by event handlers to get full shape without storing in feature properties.
|
|
169
|
+
*/
|
|
170
|
+
getShapeById(shapeId) {
|
|
171
|
+
return this.props.data.find((shape) => shape.id === shapeId);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Handle shape click
|
|
175
|
+
*/
|
|
176
|
+
handleShapeClick = (info) => {
|
|
177
|
+
const { onShapeClick, mapId } = this.props;
|
|
178
|
+
if (!info.object) return;
|
|
179
|
+
const shapeId = info.object.properties?.shapeId;
|
|
180
|
+
if (!shapeId) return;
|
|
181
|
+
const shape = this.getShapeById(shapeId);
|
|
182
|
+
if (!shape) return;
|
|
183
|
+
shapeBus.emit(ShapeEvents.selected, {
|
|
184
|
+
shapeId: shape.id,
|
|
185
|
+
mapId
|
|
186
|
+
});
|
|
187
|
+
if (onShapeClick) onShapeClick(shape);
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Handle shape hover
|
|
191
|
+
*/
|
|
192
|
+
handleShapeHover = (info) => {
|
|
193
|
+
const { onShapeHover, mapId } = this.props;
|
|
194
|
+
const shapeId = info.object?.properties?.shapeId ?? null;
|
|
195
|
+
const shape = shapeId ? this.getShapeById(shapeId) ?? null : null;
|
|
196
|
+
if (shapeId !== this.state?.lastHoveredId) {
|
|
197
|
+
this.setState({ lastHoveredId: shapeId });
|
|
198
|
+
shapeBus.emit(ShapeEvents.hovered, {
|
|
199
|
+
shapeId,
|
|
200
|
+
mapId
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (onShapeHover) onShapeHover(shape);
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Render highlight sublayer (underneath main layer)
|
|
207
|
+
* Note: Points with icons use coffin corners instead of highlight layer
|
|
208
|
+
*/
|
|
209
|
+
renderHighlightLayer(features) {
|
|
210
|
+
const { selectedShapeId, showHighlight, highlightColor } = this.props;
|
|
211
|
+
if (!selectedShapeId || showHighlight === false) return null;
|
|
212
|
+
const selectedFeature = features.find((f) => f.properties?.shapeId === selectedShapeId);
|
|
213
|
+
if (!selectedFeature) return null;
|
|
214
|
+
if (selectedFeature.geometry.type === "Point") {
|
|
215
|
+
if (!!selectedFeature.properties?.styleProperties?.icon) return null;
|
|
216
|
+
}
|
|
217
|
+
return new GeoJsonLayer({
|
|
218
|
+
id: `${this.props.id}-${SHAPE_LAYER_IDS.DISPLAY_HIGHLIGHT}`,
|
|
219
|
+
data: [selectedFeature],
|
|
220
|
+
filled: true,
|
|
221
|
+
stroked: true,
|
|
222
|
+
lineWidthUnits: "pixels",
|
|
223
|
+
lineWidthMinPixels: MAP_INTERACTION.LINE_WIDTH_MIN_PIXELS,
|
|
224
|
+
getFillColor: () => [
|
|
225
|
+
0,
|
|
226
|
+
0,
|
|
227
|
+
0,
|
|
228
|
+
0
|
|
229
|
+
],
|
|
230
|
+
getLineColor: () => highlightColor || getHighlightColor(),
|
|
231
|
+
getLineWidth: getHighlightLineWidth,
|
|
232
|
+
pickable: false,
|
|
233
|
+
updateTriggers: {
|
|
234
|
+
getLineColor: [highlightColor],
|
|
235
|
+
getLineWidth: [selectedShapeId, features]
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Render coffin corners layer for Point geometries that have icons on hover/select
|
|
241
|
+
* Coffin corners provide visual feedback for points instead of highlight layer
|
|
242
|
+
*/
|
|
243
|
+
renderCoffinCornersLayer(features) {
|
|
244
|
+
const { selectedShapeId } = this.props;
|
|
245
|
+
const pointFeatures = features.filter((f) => {
|
|
246
|
+
if (f.geometry.type !== "Point") return false;
|
|
247
|
+
if (!!!f.properties?.styleProperties?.icon) return false;
|
|
248
|
+
const isSelected = f.properties?.shapeId === selectedShapeId;
|
|
249
|
+
const isHovered = this.state?.hoverIndex !== void 0 && features.indexOf(f) === this.state.hoverIndex;
|
|
250
|
+
return isSelected || isHovered;
|
|
251
|
+
});
|
|
252
|
+
if (pointFeatures.length === 0) return null;
|
|
253
|
+
const firstPointIcon = pointFeatures[0]?.properties?.styleProperties?.icon;
|
|
254
|
+
const iconAtlas = firstPointIcon?.atlas;
|
|
255
|
+
const iconMapping = firstPointIcon?.mapping;
|
|
256
|
+
if (!iconAtlas) return null;
|
|
257
|
+
if (!iconMapping) return null;
|
|
258
|
+
const extendedMapping = {
|
|
259
|
+
...iconMapping,
|
|
260
|
+
[COFFIN_CORNERS.HOVER_ICON]: {
|
|
261
|
+
x: 0,
|
|
262
|
+
y: 0,
|
|
263
|
+
width: 76,
|
|
264
|
+
height: 76,
|
|
265
|
+
mask: false
|
|
266
|
+
},
|
|
267
|
+
[COFFIN_CORNERS.SELECTED_ICON]: {
|
|
268
|
+
x: 76,
|
|
269
|
+
y: 0,
|
|
270
|
+
width: 76,
|
|
271
|
+
height: 76,
|
|
272
|
+
mask: false
|
|
273
|
+
},
|
|
274
|
+
[COFFIN_CORNERS.SELECTED_HOVER_ICON]: {
|
|
275
|
+
x: 152,
|
|
276
|
+
y: 0,
|
|
277
|
+
width: 76,
|
|
278
|
+
height: 76,
|
|
279
|
+
mask: false
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
return new IconLayer({
|
|
283
|
+
id: `${this.props.id}-${SHAPE_LAYER_IDS.DISPLAY}-coffin-corners`,
|
|
284
|
+
data: pointFeatures,
|
|
285
|
+
iconAtlas,
|
|
286
|
+
iconMapping: extendedMapping,
|
|
287
|
+
getIcon: (d) => {
|
|
288
|
+
const isSelected = d.properties?.shapeId === selectedShapeId;
|
|
289
|
+
const isHovered = this.state?.hoverIndex !== void 0 && features.indexOf(d) === this.state.hoverIndex;
|
|
290
|
+
if (isSelected && isHovered) return COFFIN_CORNERS.SELECTED_HOVER_ICON;
|
|
291
|
+
if (isSelected) return COFFIN_CORNERS.SELECTED_ICON;
|
|
292
|
+
return COFFIN_CORNERS.HOVER_ICON;
|
|
293
|
+
},
|
|
294
|
+
getSize: COFFIN_CORNERS.SIZE,
|
|
295
|
+
getPosition: (d) => {
|
|
296
|
+
return d.geometry.type === "Point" ? d.geometry.coordinates : [0, 0];
|
|
297
|
+
},
|
|
298
|
+
getPixelOffset: (d) => {
|
|
299
|
+
return [-1, -(d.properties?.styleProperties?.icon?.size ?? MAP_INTERACTION.ICON_SIZE) / 2];
|
|
300
|
+
},
|
|
301
|
+
billboard: false,
|
|
302
|
+
pickable: false,
|
|
303
|
+
updateTriggers: {
|
|
304
|
+
getIcon: [selectedShapeId, this.state?.hoverIndex],
|
|
305
|
+
data: [
|
|
306
|
+
features,
|
|
307
|
+
selectedShapeId,
|
|
308
|
+
this.state?.hoverIndex
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Extract icon configuration from features in a single pass.
|
|
315
|
+
* Returns the first icon's atlas and mapping (all shapes share the same atlas).
|
|
316
|
+
* Uses early return for O(1) best case when first feature has icons.
|
|
317
|
+
*/
|
|
318
|
+
getIconConfig(features) {
|
|
319
|
+
for (const f of features) {
|
|
320
|
+
const icon = f.properties?.styleProperties?.icon;
|
|
321
|
+
if (icon) return {
|
|
322
|
+
hasIcons: true,
|
|
323
|
+
atlas: icon.atlas,
|
|
324
|
+
mapping: icon.mapping
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
return { hasIcons: false };
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Render main shapes layer
|
|
331
|
+
*/
|
|
332
|
+
renderMainLayer(features) {
|
|
333
|
+
const { pickable, applyBaseOpacity, selectedShapeId } = this.props;
|
|
334
|
+
const { hasIcons, atlas: iconAtlas, mapping: iconMapping } = this.getIconConfig(features);
|
|
335
|
+
return new GeoJsonLayer({
|
|
336
|
+
id: `${this.props.id}-${SHAPE_LAYER_IDS.DISPLAY}`,
|
|
337
|
+
data: features,
|
|
338
|
+
filled: true,
|
|
339
|
+
stroked: true,
|
|
340
|
+
getFillColor: (d) => getFillColor(d, applyBaseOpacity),
|
|
341
|
+
getLineColor: getStrokeColor,
|
|
342
|
+
getLineWidth: (d, info) => {
|
|
343
|
+
return getHoverLineWidth(d, info?.index === this.state?.hoverIndex);
|
|
344
|
+
},
|
|
345
|
+
lineWidthUnits: "pixels",
|
|
346
|
+
lineWidthMinPixels: MAP_INTERACTION.LINE_WIDTH_MIN_PIXELS,
|
|
347
|
+
lineWidthMaxPixels: 20,
|
|
348
|
+
pointType: hasIcons ? "icon" : "circle",
|
|
349
|
+
getPointRadius: (d) => {
|
|
350
|
+
return d.properties?.styleProperties?.icon?.size ?? 2;
|
|
351
|
+
},
|
|
352
|
+
pointRadiusUnits: "pixels",
|
|
353
|
+
...hasIcons && iconAtlas ? { iconAtlas } : {},
|
|
354
|
+
...hasIcons && iconMapping ? { iconMapping } : {},
|
|
355
|
+
...hasIcons ? {
|
|
356
|
+
getIcon: (d) => d.properties?.styleProperties?.icon?.name ?? "marker",
|
|
357
|
+
getIconSize: (d) => {
|
|
358
|
+
return d.properties?.styleProperties?.icon?.size ?? MAP_INTERACTION.ICON_SIZE;
|
|
359
|
+
},
|
|
360
|
+
getIconColor: getStrokeColor,
|
|
361
|
+
getIconPixelOffset: (d) => {
|
|
362
|
+
return [-1, -(d.properties?.styleProperties?.icon?.size ?? MAP_INTERACTION.ICON_SIZE) / 2];
|
|
363
|
+
},
|
|
364
|
+
iconBillboard: false
|
|
365
|
+
} : {},
|
|
366
|
+
extensions: [new PathStyleExtension({ dash: true })],
|
|
367
|
+
getDashArray: (d) => {
|
|
368
|
+
if (d.properties?.shapeId === selectedShapeId) return DASH_ARRAYS.dotted;
|
|
369
|
+
return getDashArray(d);
|
|
370
|
+
},
|
|
371
|
+
pickable,
|
|
372
|
+
autoHighlight: false,
|
|
373
|
+
updateTriggers: {
|
|
374
|
+
getFillColor: [features, applyBaseOpacity],
|
|
375
|
+
getLineColor: [features],
|
|
376
|
+
getLineWidth: [features, this.state?.hoverIndex],
|
|
377
|
+
getDashArray: [features, selectedShapeId],
|
|
378
|
+
getPointRadius: [features],
|
|
379
|
+
...hasIcons ? {
|
|
380
|
+
getIcon: [features],
|
|
381
|
+
getIconSize: [features],
|
|
382
|
+
getIconColor: [features],
|
|
383
|
+
getIconPixelOffset: [features]
|
|
384
|
+
} : {}
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Render labels layer
|
|
390
|
+
*/
|
|
391
|
+
renderLabelsLayer() {
|
|
392
|
+
const { showLabels, data, labelOptions } = this.props;
|
|
393
|
+
if (!showLabels) return null;
|
|
394
|
+
return createShapeLabelLayer({
|
|
395
|
+
id: `${this.props.id}-${SHAPE_LAYER_IDS.DISPLAY_LABELS}`,
|
|
396
|
+
data,
|
|
397
|
+
labelOptions
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Render all sublayers
|
|
402
|
+
*/
|
|
403
|
+
renderLayers() {
|
|
404
|
+
const features = this.getFeaturesWithId();
|
|
405
|
+
return [
|
|
406
|
+
this.renderHighlightLayer(features),
|
|
407
|
+
this.renderCoffinCornersLayer(features),
|
|
408
|
+
this.renderMainLayer(features),
|
|
409
|
+
this.renderLabelsLayer()
|
|
410
|
+
].filter(Boolean);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
//#endregion
|
|
415
|
+
export { DisplayShapeLayer };
|
|
416
|
+
//# sourceMappingURL=index.js.map
|