@deck.gl-community/editable-layers 9.0.0-alpha.1 → 9.0.3
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/LICENSE +19 -0
- package/README.md +2 -81
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -1
- package/dist/edit-modes/composite-mode.d.ts +4 -3
- package/dist/edit-modes/composite-mode.d.ts.map +1 -0
- package/dist/edit-modes/composite-mode.js +5 -2
- package/dist/edit-modes/draw-90degree-polygon-mode.d.ts +4 -3
- package/dist/edit-modes/draw-90degree-polygon-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-90degree-polygon-mode.js +30 -25
- package/dist/edit-modes/draw-circle-by-diameter-mode.d.ts +4 -3
- package/dist/edit-modes/draw-circle-by-diameter-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-circle-by-diameter-mode.js +9 -6
- package/dist/edit-modes/draw-circle-from-center-mode.d.ts +4 -3
- package/dist/edit-modes/draw-circle-from-center-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-circle-from-center-mode.js +8 -5
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.d.ts +3 -2
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.js +5 -2
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.d.ts +3 -2
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.js +5 -2
- package/dist/edit-modes/draw-line-string-mode.d.ts +4 -3
- package/dist/edit-modes/draw-line-string-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-line-string-mode.js +21 -18
- package/dist/edit-modes/draw-point-mode.d.ts +4 -3
- package/dist/edit-modes/draw-point-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-point-mode.js +8 -5
- package/dist/edit-modes/draw-polygon-by-dragging-mode.d.ts +4 -3
- package/dist/edit-modes/draw-polygon-by-dragging-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-polygon-by-dragging-mode.js +12 -7
- package/dist/edit-modes/draw-polygon-mode.d.ts +4 -3
- package/dist/edit-modes/draw-polygon-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-polygon-mode.js +22 -18
- package/dist/edit-modes/draw-rectangle-from-center-mode.d.ts +3 -2
- package/dist/edit-modes/draw-rectangle-from-center-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-rectangle-from-center-mode.js +4 -1
- package/dist/edit-modes/draw-rectangle-mode.d.ts +3 -2
- package/dist/edit-modes/draw-rectangle-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-rectangle-mode.js +4 -1
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.d.ts +3 -2
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.js +10 -7
- package/dist/edit-modes/draw-square-from-center-mode.d.ts +3 -2
- package/dist/edit-modes/draw-square-from-center-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-square-from-center-mode.js +4 -1
- package/dist/edit-modes/draw-square-mode.d.ts +3 -2
- package/dist/edit-modes/draw-square-mode.d.ts.map +1 -0
- package/dist/edit-modes/draw-square-mode.js +4 -1
- package/dist/edit-modes/duplicate-mode.d.ts +4 -3
- package/dist/edit-modes/duplicate-mode.d.ts.map +1 -0
- package/dist/edit-modes/duplicate-mode.js +4 -1
- package/dist/edit-modes/edit-mode.d.ts +2 -1
- package/dist/edit-modes/edit-mode.d.ts.map +1 -0
- package/dist/edit-modes/edit-mode.js +3 -1
- package/dist/edit-modes/elevation-mode.d.ts +5 -4
- package/dist/edit-modes/elevation-mode.d.ts.map +1 -0
- package/dist/edit-modes/elevation-mode.js +10 -7
- package/dist/edit-modes/extend-line-string-mode.d.ts +4 -3
- package/dist/edit-modes/extend-line-string-mode.d.ts.map +1 -0
- package/dist/edit-modes/extend-line-string-mode.js +11 -8
- package/dist/edit-modes/extrude-mode.d.ts +4 -3
- package/dist/edit-modes/extrude-mode.d.ts.map +1 -0
- package/dist/edit-modes/extrude-mode.js +12 -9
- package/dist/edit-modes/geojson-edit-mode.d.ts +4 -3
- package/dist/edit-modes/geojson-edit-mode.d.ts.map +1 -0
- package/dist/edit-modes/geojson-edit-mode.js +20 -17
- package/dist/edit-modes/immutable-feature-collection.d.ts +3 -1
- package/dist/edit-modes/immutable-feature-collection.d.ts.map +1 -0
- package/dist/edit-modes/immutable-feature-collection.js +25 -20
- package/dist/edit-modes/measure-angle-mode.d.ts +4 -3
- package/dist/edit-modes/measure-angle-mode.d.ts.map +1 -0
- package/dist/edit-modes/measure-angle-mode.js +9 -9
- package/dist/edit-modes/measure-area-mode.d.ts +4 -3
- package/dist/edit-modes/measure-area-mode.d.ts.map +1 -0
- package/dist/edit-modes/measure-area-mode.js +8 -6
- package/dist/edit-modes/measure-distance-mode.d.ts +4 -3
- package/dist/edit-modes/measure-distance-mode.d.ts.map +1 -0
- package/dist/edit-modes/measure-distance-mode.js +19 -16
- package/dist/edit-modes/modify-mode.d.ts +5 -4
- package/dist/edit-modes/modify-mode.d.ts.map +1 -0
- package/dist/edit-modes/modify-mode.js +19 -16
- package/dist/edit-modes/resize-circle-mode.d.ts +6 -5
- package/dist/edit-modes/resize-circle-mode.d.ts.map +1 -0
- package/dist/edit-modes/resize-circle-mode.js +6 -4
- package/dist/edit-modes/rotate-mode.d.ts +4 -3
- package/dist/edit-modes/rotate-mode.d.ts.map +1 -0
- package/dist/edit-modes/rotate-mode.js +11 -8
- package/dist/edit-modes/scale-mode.d.ts +4 -3
- package/dist/edit-modes/scale-mode.d.ts.map +1 -0
- package/dist/edit-modes/scale-mode.js +11 -8
- package/dist/edit-modes/snappable-mode.d.ts +4 -3
- package/dist/edit-modes/snappable-mode.d.ts.map +1 -0
- package/dist/edit-modes/snappable-mode.js +9 -6
- package/dist/edit-modes/split-polygon-mode.d.ts +4 -3
- package/dist/edit-modes/split-polygon-mode.d.ts.map +1 -0
- package/dist/edit-modes/split-polygon-mode.js +15 -12
- package/dist/edit-modes/three-click-polygon-mode.d.ts +4 -3
- package/dist/edit-modes/three-click-polygon-mode.d.ts.map +1 -0
- package/dist/edit-modes/three-click-polygon-mode.js +10 -7
- package/dist/edit-modes/transform-mode.d.ts +4 -3
- package/dist/edit-modes/transform-mode.d.ts.map +1 -0
- package/dist/edit-modes/transform-mode.js +8 -5
- package/dist/edit-modes/translate-mode.d.ts +4 -3
- package/dist/edit-modes/translate-mode.d.ts.map +1 -0
- package/dist/edit-modes/translate-mode.js +10 -7
- package/dist/edit-modes/two-click-polygon-mode.d.ts +4 -3
- package/dist/edit-modes/two-click-polygon-mode.d.ts.map +1 -0
- package/dist/edit-modes/two-click-polygon-mode.js +10 -7
- package/dist/edit-modes/types.d.ts +2 -1
- package/dist/edit-modes/types.d.ts.map +1 -0
- package/dist/edit-modes/types.js +3 -0
- package/dist/edit-modes/utils.d.ts +3 -2
- package/dist/edit-modes/utils.d.ts.map +1 -0
- package/dist/edit-modes/utils.js +22 -19
- package/dist/edit-modes/view-mode.d.ts +2 -1
- package/dist/edit-modes/view-mode.d.ts.map +1 -0
- package/dist/edit-modes/view-mode.js +4 -1
- package/dist/editable-layers/editable-geojson-layer.d.ts +7 -6
- package/dist/editable-layers/editable-geojson-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-geojson-layer.js +53 -52
- package/dist/editable-layers/editable-h3-cluster-layer.d.ts +3 -2
- package/dist/editable-layers/editable-h3-cluster-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-h3-cluster-layer.js +8 -5
- package/dist/editable-layers/editable-layer.d.ts +7 -6
- package/dist/editable-layers/editable-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-layer.js +18 -15
- package/dist/editable-layers/editable-path-layer.d.ts +2 -1
- package/dist/editable-layers/editable-path-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-path-layer.js +10 -7
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts +2 -1
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts.map +1 -0
- package/dist/editable-layers/elevated-edit-handle-layer.js +6 -3
- package/dist/editable-layers/junction-scatterplot-layer.d.ts +3 -2
- package/dist/editable-layers/junction-scatterplot-layer.d.ts.map +1 -0
- package/dist/editable-layers/junction-scatterplot-layer.js +10 -7
- package/dist/editable-layers/selection-layer.d.ts +2 -1
- package/dist/editable-layers/selection-layer.d.ts.map +1 -0
- package/dist/editable-layers/selection-layer.js +8 -5
- package/dist/index.cjs +70 -542
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +59 -59
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -54
- package/dist/lib/constants.d.ts +1 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +3 -0
- package/dist/lib/deck-renderer/deck-cache.d.ts +2 -1
- package/dist/lib/deck-renderer/deck-cache.d.ts.map +1 -0
- package/dist/lib/deck-renderer/deck-cache.js +1 -1
- package/dist/lib/deck-renderer/deck-drawer.d.ts +3 -3
- package/dist/lib/deck-renderer/deck-drawer.d.ts.map +1 -0
- package/dist/lib/deck-renderer/deck-drawer.js +12 -12
- package/dist/lib/feature.d.ts +5 -4
- package/dist/lib/feature.d.ts.map +1 -0
- package/dist/lib/feature.js +4 -1
- package/dist/lib/layer-mouse-event.d.ts +3 -2
- package/dist/lib/layer-mouse-event.d.ts.map +1 -0
- package/dist/lib/layer-mouse-event.js +4 -1
- package/dist/lib/layers/junctions-layer.d.ts +5 -4
- package/dist/lib/layers/junctions-layer.d.ts.map +1 -0
- package/dist/lib/layers/junctions-layer.js +10 -7
- package/dist/lib/layers/segments-layer.d.ts +5 -4
- package/dist/lib/layers/segments-layer.d.ts.map +1 -0
- package/dist/lib/layers/segments-layer.js +12 -9
- package/dist/lib/layers/texts-layer.d.ts +4 -3
- package/dist/lib/layers/texts-layer.d.ts.map +1 -0
- package/dist/lib/layers/texts-layer.js +9 -6
- package/dist/lib/math.d.ts +2 -1
- package/dist/lib/math.d.ts.map +1 -0
- package/dist/lib/math.js +3 -0
- package/dist/lib/{nebula.d.ts → nebula-core.d.ts} +3 -2
- package/dist/lib/nebula-core.d.ts.map +1 -0
- package/dist/lib/{nebula.js → nebula-core.js} +7 -4
- package/dist/lib/nebula-layer.d.ts +3 -2
- package/dist/lib/nebula-layer.d.ts.map +1 -0
- package/dist/lib/nebula-layer.js +4 -1
- package/dist/lib/style.d.ts +1 -0
- package/dist/lib/style.d.ts.map +1 -0
- package/dist/lib/style.js +5 -2
- package/dist/mode-handlers/composite-mode-handler.d.ts +4 -3
- package/dist/mode-handlers/composite-mode-handler.d.ts.map +1 -0
- package/dist/mode-handlers/composite-mode-handler.js +1 -1
- package/dist/mode-handlers/draw-90degree-polygon-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-90degree-polygon-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-90degree-polygon-handler.js +13 -10
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.js +5 -2
- package/dist/mode-handlers/draw-circle-from-center-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-circle-from-center-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-circle-from-center-handler.js +4 -1
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.js +5 -2
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.js +7 -4
- package/dist/mode-handlers/draw-line-string-handler.d.ts +3 -2
- package/dist/mode-handlers/draw-line-string-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-line-string-handler.js +8 -5
- package/dist/mode-handlers/draw-point-handler.d.ts +3 -2
- package/dist/mode-handlers/draw-point-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-point-handler.js +5 -2
- package/dist/mode-handlers/draw-polygon-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-polygon-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-polygon-handler.js +10 -7
- package/dist/mode-handlers/draw-rectangle-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-rectangle-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-rectangle-handler.js +4 -1
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.d.ts +4 -3
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.d.ts.map +1 -0
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.js +12 -9
- package/dist/mode-handlers/duplicate-handler.d.ts +4 -3
- package/dist/mode-handlers/duplicate-handler.d.ts.map +1 -0
- package/dist/mode-handlers/duplicate-handler.js +4 -1
- package/dist/mode-handlers/elevation-handler.d.ts +6 -5
- package/dist/mode-handlers/elevation-handler.d.ts.map +1 -0
- package/dist/mode-handlers/elevation-handler.js +10 -7
- package/dist/mode-handlers/extrude-handler.d.ts +4 -3
- package/dist/mode-handlers/extrude-handler.d.ts.map +1 -0
- package/dist/mode-handlers/extrude-handler.js +12 -9
- package/dist/mode-handlers/mode-handler.d.ts +4 -3
- package/dist/mode-handlers/mode-handler.d.ts.map +1 -0
- package/dist/mode-handlers/mode-handler.js +18 -15
- package/dist/mode-handlers/modify-handler.d.ts +5 -4
- package/dist/mode-handlers/modify-handler.d.ts.map +1 -0
- package/dist/mode-handlers/modify-handler.js +18 -15
- package/dist/mode-handlers/rotate-handler.d.ts +4 -3
- package/dist/mode-handlers/rotate-handler.d.ts.map +1 -0
- package/dist/mode-handlers/rotate-handler.js +5 -2
- package/dist/mode-handlers/scale-handler.d.ts +4 -3
- package/dist/mode-handlers/scale-handler.d.ts.map +1 -0
- package/dist/mode-handlers/scale-handler.js +6 -3
- package/dist/mode-handlers/snappable-handler.d.ts +4 -3
- package/dist/mode-handlers/snappable-handler.d.ts.map +1 -0
- package/dist/mode-handlers/snappable-handler.js +6 -3
- package/dist/mode-handlers/split-polygon-handler.d.ts +3 -2
- package/dist/mode-handlers/split-polygon-handler.d.ts.map +1 -0
- package/dist/mode-handlers/split-polygon-handler.js +12 -9
- package/dist/mode-handlers/three-click-polygon-handler.d.ts +3 -2
- package/dist/mode-handlers/three-click-polygon-handler.d.ts.map +1 -0
- package/dist/mode-handlers/three-click-polygon-handler.js +4 -1
- package/dist/mode-handlers/translate-handler.d.ts +4 -3
- package/dist/mode-handlers/translate-handler.d.ts.map +1 -0
- package/dist/mode-handlers/translate-handler.js +5 -2
- package/dist/mode-handlers/two-click-polygon-handler.d.ts +3 -2
- package/dist/mode-handlers/two-click-polygon-handler.d.ts.map +1 -0
- package/dist/mode-handlers/two-click-polygon-handler.js +4 -1
- package/dist/mode-handlers/view-handler.d.ts +3 -2
- package/dist/mode-handlers/view-handler.d.ts.map +1 -0
- package/dist/mode-handlers/view-handler.js +4 -1
- package/dist/shaderlib/color/color.d.ts +8 -6
- package/dist/shaderlib/color/color.d.ts.map +1 -0
- package/dist/shaderlib/color/color.js +7 -4
- package/dist/shaderlib/utils/utils.d.ts +3 -2
- package/dist/shaderlib/utils/utils.d.ts.map +1 -0
- package/dist/shaderlib/utils/utils.js +5 -2
- package/dist/{curve-utils.d.ts → utils/curve-utils.d.ts} +1 -0
- package/dist/utils/curve-utils.d.ts.map +1 -0
- package/dist/{curve-utils.js → utils/curve-utils.js} +7 -4
- package/dist/{geojson-types.d.ts → utils/geojson-types.d.ts} +3 -25
- package/dist/utils/geojson-types.d.ts.map +1 -0
- package/dist/utils/geojson-types.js +4 -0
- package/dist/{memoize.d.ts → utils/memoize.d.ts} +2 -1
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/{memoize.js → utils/memoize.js} +4 -1
- package/dist/{translateFromCenter.d.ts → utils/translate-from-center.d.ts} +1 -0
- package/dist/utils/translate-from-center.d.ts.map +1 -0
- package/dist/{translateFromCenter.js → utils/translate-from-center.js} +7 -4
- package/dist/{types.d.ts → utils/types.d.ts} +1 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +4 -0
- package/dist/{utils.d.ts → utils/utils.d.ts} +5 -4
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/{utils.js → utils/utils.js} +11 -9
- package/package.json +11 -10
- package/src/constants.ts +5 -1
- package/src/edit-modes/composite-mode.ts +9 -5
- package/src/edit-modes/draw-90degree-polygon-mode.ts +38 -34
- package/src/edit-modes/draw-circle-by-diameter-mode.ts +16 -12
- package/src/edit-modes/draw-circle-from-center-mode.ts +15 -11
- package/src/edit-modes/draw-ellipse-by-bounding-box-mode.ts +8 -4
- package/src/edit-modes/draw-ellipse-using-three-points-mode.ts +9 -5
- package/src/edit-modes/draw-line-string-mode.ts +29 -25
- package/src/edit-modes/draw-point-mode.ts +13 -9
- package/src/edit-modes/draw-polygon-by-dragging-mode.ts +16 -16
- package/src/edit-modes/draw-polygon-mode.ts +28 -23
- package/src/edit-modes/draw-rectangle-from-center-mode.ts +6 -2
- package/src/edit-modes/draw-rectangle-mode.ts +6 -2
- package/src/edit-modes/draw-rectangle-using-three-points-mode.ts +12 -8
- package/src/edit-modes/draw-square-from-center-mode.ts +7 -3
- package/src/edit-modes/draw-square-mode.ts +7 -3
- package/src/edit-modes/duplicate-mode.ts +7 -3
- package/src/edit-modes/edit-mode.ts +5 -1
- package/src/edit-modes/elevation-mode.ts +13 -9
- package/src/edit-modes/extend-line-string-mode.ts +16 -12
- package/src/edit-modes/extrude-mode.ts +22 -18
- package/src/edit-modes/geojson-edit-mode.ts +37 -33
- package/src/edit-modes/immutable-feature-collection.ts +28 -22
- package/src/edit-modes/measure-angle-mode.ts +66 -59
- package/src/edit-modes/measure-area-mode.ts +13 -10
- package/src/edit-modes/measure-distance-mode.ts +37 -33
- package/src/edit-modes/modify-mode.ts +36 -32
- package/src/edit-modes/resize-circle-mode.ts +8 -5
- package/src/edit-modes/rotate-mode.ts +22 -18
- package/src/edit-modes/scale-mode.ts +29 -23
- package/src/edit-modes/snappable-mode.ts +19 -15
- package/src/edit-modes/split-polygon-mode.ts +25 -21
- package/src/edit-modes/three-click-polygon-mode.ts +15 -11
- package/src/edit-modes/transform-mode.ts +15 -11
- package/src/edit-modes/translate-mode.ts +15 -11
- package/src/edit-modes/two-click-polygon-mode.ts +15 -11
- package/src/edit-modes/types.ts +5 -1
- package/src/edit-modes/utils.ts +35 -30
- package/src/edit-modes/view-mode.ts +5 -1
- package/src/editable-layers/editable-geojson-layer.ts +44 -41
- package/src/editable-layers/editable-h3-cluster-layer.ts +17 -14
- package/src/editable-layers/editable-layer.ts +42 -32
- package/src/editable-layers/editable-path-layer.ts +12 -8
- package/src/editable-layers/elevated-edit-handle-layer.ts +11 -7
- package/src/editable-layers/junction-scatterplot-layer.ts +15 -11
- package/src/editable-layers/selection-layer.ts +11 -7
- package/src/index.ts +68 -65
- package/src/lib/constants.ts +4 -0
- package/src/lib/deck-renderer/deck-cache.ts +1 -1
- package/src/lib/deck-renderer/deck-drawer.ts +28 -28
- package/src/lib/feature.ts +7 -3
- package/src/lib/layer-mouse-event.ts +7 -6
- package/src/lib/layers/junctions-layer.ts +14 -10
- package/src/lib/layers/segments-layer.ts +24 -20
- package/src/lib/layers/texts-layer.ts +18 -14
- package/src/lib/math.ts +5 -1
- package/src/lib/{nebula.ts → nebula-core.ts} +8 -4
- package/src/lib/nebula-layer.ts +9 -5
- package/src/lib/style.ts +6 -2
- package/src/mode-handlers/composite-mode-handler.ts +6 -6
- package/src/mode-handlers/draw-90degree-polygon-handler.ts +22 -18
- package/src/mode-handlers/draw-circle-by-bounding-box-handler.ts +10 -6
- package/src/mode-handlers/draw-circle-from-center-handler.ts +10 -6
- package/src/mode-handlers/draw-ellipse-by-bounding-box-handler.ts +9 -5
- package/src/mode-handlers/draw-ellipse-using-three-points-handler.ts +12 -8
- package/src/mode-handlers/draw-line-string-handler.ts +12 -8
- package/src/mode-handlers/draw-point-handler.ts +9 -5
- package/src/mode-handlers/draw-polygon-handler.ts +16 -12
- package/src/mode-handlers/draw-rectangle-handler.ts +8 -4
- package/src/mode-handlers/draw-rectangle-using-three-points-handler.ts +17 -13
- package/src/mode-handlers/duplicate-handler.ts +8 -4
- package/src/mode-handlers/elevation-handler.ts +14 -10
- package/src/mode-handlers/extrude-handler.ts +15 -11
- package/src/mode-handlers/mode-handler.ts +26 -28
- package/src/mode-handlers/modify-handler.ts +29 -25
- package/src/mode-handlers/rotate-handler.ts +13 -17
- package/src/mode-handlers/scale-handler.ts +13 -13
- package/src/mode-handlers/snappable-handler.ts +28 -24
- package/src/mode-handlers/split-polygon-handler.ts +22 -18
- package/src/mode-handlers/three-click-polygon-handler.ts +6 -2
- package/src/mode-handlers/translate-handler.ts +12 -8
- package/src/mode-handlers/two-click-polygon-handler.ts +6 -2
- package/src/mode-handlers/view-handler.ts +7 -3
- package/src/shaderlib/color/color.ts +10 -5
- package/src/shaderlib/utils/utils.ts +6 -2
- package/src/{curve-utils.ts → utils/curve-utils.ts} +11 -7
- package/src/{geojson-types.ts → utils/geojson-types.ts} +16 -31
- package/src/{memoize.ts → utils/memoize.ts} +5 -1
- package/src/{translateFromCenter.ts → utils/translate-from-center.ts} +12 -8
- package/src/{types.ts → utils/types.ts} +4 -0
- package/src/{utils.ts → utils/utils.ts} +17 -14
- package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.d.ts +0 -4
- package/dist/editable-layers/path-marker-layer/arrow-2d-geometry.js +0 -55
- package/dist/editable-layers/path-marker-layer/create-path-markers.d.ts +0 -16
- package/dist/editable-layers/path-marker-layer/create-path-markers.js +0 -75
- package/dist/editable-layers/path-marker-layer/path-marker-layer.d.ts +0 -40
- package/dist/editable-layers/path-marker-layer/path-marker-layer.js +0 -121
- package/dist/editable-layers/path-marker-layer/polyline.d.ts +0 -18
- package/dist/editable-layers/path-marker-layer/polyline.js +0 -37
- package/dist/editable-layers/path-outline-layer/path-outline-layer.d.ts +0 -26
- package/dist/editable-layers/path-outline-layer/path-outline-layer.js +0 -106
- package/dist/geojson-types.js +0 -2
- package/dist/shaderlib/outline/outline.d.ts +0 -8
- package/dist/shaderlib/outline/outline.js +0 -97
- package/dist/types.js +0 -1
- package/src/editable-layers/path-marker-layer/arrow-2d-geometry.ts +0 -61
- package/src/editable-layers/path-marker-layer/create-path-markers.ts +0 -107
- package/src/editable-layers/path-marker-layer/path-marker-layer.ts +0 -179
- package/src/editable-layers/path-marker-layer/polyline.ts +0 -40
- package/src/editable-layers/path-outline-layer/path-outline-layer.ts +0 -147
- package/src/shaderlib/outline/outline.ts +0 -101
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import turfCentroid from '@turf/centroid';
|
|
2
6
|
import turfBearing from '@turf/bearing';
|
|
3
7
|
import turfTransformRotate from '@turf/transform-rotate';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import {FeatureCollection, Position} from '../utils/geojson-types';
|
|
9
|
+
import {PointerMoveEvent, StartDraggingEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
10
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
7
11
|
|
|
8
12
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
9
13
|
export class RotateHandler extends ModeHandler {
|
|
@@ -20,19 +24,15 @@ export class RotateHandler extends ModeHandler {
|
|
|
20
24
|
|
|
21
25
|
if (!this._isRotatable || !event.pointerDownMapCoords) {
|
|
22
26
|
// Nothing to do
|
|
23
|
-
return {
|
|
27
|
+
return {editAction: null, cancelMapPan: false};
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
if (event.isDragging && this._geometryBeingRotated) {
|
|
27
31
|
// Rotate the geometry
|
|
28
|
-
editAction = this.getRotateAction(
|
|
29
|
-
event.pointerDownMapCoords,
|
|
30
|
-
event.mapCoords,
|
|
31
|
-
'rotating'
|
|
32
|
-
);
|
|
32
|
+
editAction = this.getRotateAction(event.pointerDownMapCoords, event.mapCoords, 'rotating');
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return {
|
|
35
|
+
return {editAction, cancelMapPan: true};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
handleStartDragging(event: StartDraggingEvent): EditAction | null | undefined {
|
|
@@ -49,18 +49,14 @@ export class RotateHandler extends ModeHandler {
|
|
|
49
49
|
|
|
50
50
|
if (this._geometryBeingRotated) {
|
|
51
51
|
// Rotate the geometry
|
|
52
|
-
editAction = this.getRotateAction(
|
|
53
|
-
event.pointerDownMapCoords,
|
|
54
|
-
event.mapCoords,
|
|
55
|
-
'rotated'
|
|
56
|
-
);
|
|
52
|
+
editAction = this.getRotateAction(event.pointerDownMapCoords, event.mapCoords, 'rotated');
|
|
57
53
|
this._geometryBeingRotated = null;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
return editAction;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
getCursor({
|
|
59
|
+
getCursor({isDragging}: {isDragging: boolean}): string {
|
|
64
60
|
if (this._isRotatable) {
|
|
65
61
|
// TODO: look at doing SVG cursors to get a better "rotate" cursor
|
|
66
62
|
return 'move';
|
|
@@ -95,7 +91,7 @@ export class RotateHandler extends ModeHandler {
|
|
|
95
91
|
updatedData: updatedData.getObject(),
|
|
96
92
|
editType,
|
|
97
93
|
featureIndexes: selectedIndexes,
|
|
98
|
-
editContext: null
|
|
94
|
+
editContext: null
|
|
99
95
|
};
|
|
100
96
|
}
|
|
101
97
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import turfCentroid from '@turf/centroid';
|
|
2
6
|
import turfDistance from '@turf/distance';
|
|
3
7
|
import turfTransformScale from '@turf/transform-scale';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import {FeatureCollection, Position} from '../utils/geojson-types';
|
|
9
|
+
import {PointerMoveEvent, StartDraggingEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
10
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
7
11
|
|
|
8
12
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
9
13
|
export class ScaleHandler extends ModeHandler {
|
|
@@ -20,19 +24,15 @@ export class ScaleHandler extends ModeHandler {
|
|
|
20
24
|
|
|
21
25
|
if (!this._isScalable || !event.pointerDownMapCoords) {
|
|
22
26
|
// Nothing to do
|
|
23
|
-
return {
|
|
27
|
+
return {editAction: null, cancelMapPan: false};
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
if (event.isDragging && this._geometryBeingScaled) {
|
|
27
31
|
// Scale the geometry
|
|
28
|
-
editAction = this.getScaleAction(
|
|
29
|
-
event.pointerDownMapCoords,
|
|
30
|
-
event.mapCoords,
|
|
31
|
-
'scaling'
|
|
32
|
-
);
|
|
32
|
+
editAction = this.getScaleAction(event.pointerDownMapCoords, event.mapCoords, 'scaling');
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return {
|
|
35
|
+
return {editAction, cancelMapPan: true};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
handleStartDragging(event: StartDraggingEvent): EditAction | null | undefined {
|
|
@@ -56,7 +56,7 @@ export class ScaleHandler extends ModeHandler {
|
|
|
56
56
|
return editAction;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
getCursor({
|
|
59
|
+
getCursor({isDragging}: {isDragging: boolean}): string {
|
|
60
60
|
if (this._isScalable) {
|
|
61
61
|
// TODO: look at doing SVG cursors to get a better "scale" cursor
|
|
62
62
|
return 'move';
|
|
@@ -76,7 +76,7 @@ export class ScaleHandler extends ModeHandler {
|
|
|
76
76
|
this._geometryBeingScaled,
|
|
77
77
|
factor,
|
|
78
78
|
{
|
|
79
|
-
origin: centroid
|
|
79
|
+
origin: centroid
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ export class ScaleHandler extends ModeHandler {
|
|
|
93
93
|
updatedData: updatedData.getObject(),
|
|
94
94
|
editType,
|
|
95
95
|
featureIndexes: selectedIndexes,
|
|
96
|
-
editContext: null
|
|
96
|
+
editContext: null
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Feature, FeatureCollection, Position} from '../utils/geojson-types';
|
|
6
|
+
import {PointerMoveEvent, StartDraggingEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
3
7
|
import {
|
|
4
8
|
EditHandle,
|
|
5
9
|
EditAction,
|
|
6
10
|
ModeHandler,
|
|
7
11
|
getPickedEditHandle,
|
|
8
|
-
getEditHandlesForGeometry
|
|
12
|
+
getEditHandlesForGeometry
|
|
9
13
|
} from './mode-handler';
|
|
10
14
|
|
|
11
|
-
type HandlePicks = {
|
|
15
|
+
type HandlePicks = {pickedHandle?: EditHandle; potentialSnapHandle?: EditHandle};
|
|
12
16
|
|
|
13
17
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
14
18
|
export class SnappableHandler extends ModeHandler {
|
|
@@ -38,39 +42,39 @@ export class SnappableHandler extends ModeHandler {
|
|
|
38
42
|
// @ts-expect-error narrow event type
|
|
39
43
|
return Object.assign({}, event, {
|
|
40
44
|
mapCoords: snapPoint,
|
|
41
|
-
pointerDownMapCoords: this._startDragSnapHandlePosition
|
|
45
|
+
pointerDownMapCoords: this._startDragSnapHandlePosition
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
_getEditHandlePicks(event: PointerMoveEvent): HandlePicks {
|
|
46
|
-
const {
|
|
50
|
+
const {picks} = event;
|
|
47
51
|
|
|
48
52
|
const potentialSnapHandle = picks.find(
|
|
49
53
|
(pick) => pick.object && pick.object.type === 'intermediate'
|
|
50
54
|
);
|
|
51
|
-
const handles = {
|
|
55
|
+
const handles = {potentialSnapHandle: potentialSnapHandle && potentialSnapHandle.object};
|
|
52
56
|
|
|
53
57
|
const pickedHandle = getPickedEditHandle(event.pointerDownPicks);
|
|
54
58
|
if (pickedHandle) {
|
|
55
|
-
return {
|
|
59
|
+
return {...handles, pickedHandle};
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
return handles;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
_updatePickedHandlePosition(editAction: EditAction) {
|
|
62
|
-
const {
|
|
66
|
+
const {pickedHandle = {} as EditHandle} = this._editHandlePicks || {};
|
|
63
67
|
|
|
64
68
|
if (pickedHandle && editAction) {
|
|
65
|
-
const {
|
|
69
|
+
const {featureIndexes, updatedData} = editAction;
|
|
66
70
|
|
|
67
71
|
for (let i = 0; i < featureIndexes.length; i++) {
|
|
68
72
|
const selectedIndex = featureIndexes[i];
|
|
69
73
|
const updatedFeature = updatedData.features[selectedIndex];
|
|
70
74
|
|
|
71
|
-
const {
|
|
75
|
+
const {positionIndexes, featureIndex} = pickedHandle;
|
|
72
76
|
if (selectedIndex >= 0 && featureIndex === selectedIndex) {
|
|
73
|
-
const {
|
|
77
|
+
const {coordinates} = updatedFeature.geometry;
|
|
74
78
|
pickedHandle.position = positionIndexes.reduce(
|
|
75
79
|
(a: any[], b: number) => a[b],
|
|
76
80
|
coordinates
|
|
@@ -85,12 +89,12 @@ export class SnappableHandler extends ModeHandler {
|
|
|
85
89
|
// that live in the current layer. Otherwise, this method will simply return the
|
|
86
90
|
// features from the current layer
|
|
87
91
|
_getSnapTargets(): Feature[] {
|
|
88
|
-
let {
|
|
92
|
+
let {additionalSnapTargets} = this.getModeConfig() || {};
|
|
89
93
|
additionalSnapTargets = additionalSnapTargets || [];
|
|
90
94
|
|
|
91
95
|
const features = [
|
|
92
96
|
...this._handler.featureCollection.getObject().features,
|
|
93
|
-
...additionalSnapTargets
|
|
97
|
+
...additionalSnapTargets
|
|
94
98
|
];
|
|
95
99
|
return features;
|
|
96
100
|
}
|
|
@@ -105,7 +109,7 @@ export class SnappableHandler extends ModeHandler {
|
|
|
105
109
|
i < features.length && !this._handler.getSelectedFeatureIndexes().includes(i);
|
|
106
110
|
|
|
107
111
|
if (isCurrentIndexFeatureNotSelected) {
|
|
108
|
-
const {
|
|
112
|
+
const {geometry} = features[i];
|
|
109
113
|
handles.push(...getEditHandlesForGeometry(geometry, i, 'intermediate'));
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -116,21 +120,21 @@ export class SnappableHandler extends ModeHandler {
|
|
|
116
120
|
// selected feature. If a snap handle has been picked, display said snap handle
|
|
117
121
|
// along with all snappable points on all non-selected features.
|
|
118
122
|
getEditHandles(picks?: Array<Record<string, any>>, mapCoords?: Position): any[] {
|
|
119
|
-
const {
|
|
123
|
+
const {enableSnapping} = this._modeConfig || {};
|
|
120
124
|
const handles = this._handler.getEditHandles(picks, mapCoords);
|
|
121
125
|
|
|
122
126
|
if (!enableSnapping) return handles;
|
|
123
|
-
const {
|
|
127
|
+
const {pickedHandle} = this._editHandlePicks || {};
|
|
124
128
|
|
|
125
129
|
if (pickedHandle) {
|
|
126
130
|
handles.push(...this._getNonPickedIntermediateHandles(), pickedHandle);
|
|
127
131
|
return handles;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
const {
|
|
134
|
+
const {features} = this._handler.featureCollection.getObject();
|
|
131
135
|
for (const index of this._handler.getSelectedFeatureIndexes()) {
|
|
132
136
|
if (index < features.length) {
|
|
133
|
-
const {
|
|
137
|
+
const {geometry} = features[index];
|
|
134
138
|
handles.push(...getEditHandlesForGeometry(geometry, index, 'snap'));
|
|
135
139
|
}
|
|
136
140
|
}
|
|
@@ -139,7 +143,7 @@ export class SnappableHandler extends ModeHandler {
|
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
_getSnapAwareEvent(event: Record<string, any>): Record<string, any> {
|
|
142
|
-
const {
|
|
146
|
+
const {potentialSnapHandle} = this._editHandlePicks || {};
|
|
143
147
|
|
|
144
148
|
return potentialSnapHandle && potentialSnapHandle.position
|
|
145
149
|
? this._getSnappedMouseEvent(event, potentialSnapHandle.position)
|
|
@@ -147,7 +151,7 @@ export class SnappableHandler extends ModeHandler {
|
|
|
147
151
|
}
|
|
148
152
|
|
|
149
153
|
handleStartDragging(event: StartDraggingEvent): EditAction | null | undefined {
|
|
150
|
-
this._startDragSnapHandlePosition = (getPickedEditHandle(event.picks) || {}).position
|
|
154
|
+
this._startDragSnapHandlePosition = (getPickedEditHandle(event.picks) || {}).position;
|
|
151
155
|
return this._handler.handleStartDragging(event);
|
|
152
156
|
}
|
|
153
157
|
|
|
@@ -159,7 +163,7 @@ export class SnappableHandler extends ModeHandler {
|
|
|
159
163
|
return modeActionSummary;
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
getCursor(event: {
|
|
166
|
+
getCursor(event: {isDragging: boolean}): string {
|
|
163
167
|
return this._handler.getCursor(event);
|
|
164
168
|
}
|
|
165
169
|
|
|
@@ -167,14 +171,14 @@ export class SnappableHandler extends ModeHandler {
|
|
|
167
171
|
editAction: EditAction | null | undefined;
|
|
168
172
|
cancelMapPan: boolean;
|
|
169
173
|
} {
|
|
170
|
-
const {
|
|
174
|
+
const {enableSnapping} = this._handler.getModeConfig() || {};
|
|
171
175
|
|
|
172
176
|
if (enableSnapping) {
|
|
173
177
|
this._editHandlePicks = this._getEditHandlePicks(event);
|
|
174
178
|
}
|
|
175
179
|
// @ts-expect-error narrow event type
|
|
176
180
|
const modeActionSummary = this._handler.handlePointerMove(this._getSnapAwareEvent(event));
|
|
177
|
-
const {
|
|
181
|
+
const {editAction} = modeActionSummary;
|
|
178
182
|
if (editAction) {
|
|
179
183
|
this._updatePickedHandlePosition(editAction);
|
|
180
184
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
|
|
2
6
|
import turfDifference from '@turf/difference';
|
|
3
7
|
import turfBuffer from '@turf/buffer';
|
|
4
8
|
import lineIntersect from '@turf/line-intersect';
|
|
5
|
-
import {
|
|
9
|
+
import {lineString} from '@turf/helpers';
|
|
6
10
|
import turfBearing from '@turf/bearing';
|
|
7
11
|
import turfDistance from '@turf/distance';
|
|
8
12
|
import turfDestination from '@turf/destination';
|
|
9
13
|
import turfPolygonToLine from '@turf/polygon-to-line';
|
|
10
|
-
import nearestPointOnLine, {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
+
import nearestPointOnLine, {NearestPointOnLine} from '@turf/nearest-point-on-line';
|
|
15
|
+
import {generatePointsParallelToLinePoints} from '../utils/utils';
|
|
16
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
17
|
+
import {ClickEvent, PointerMoveEvent} from '../edit-modes/types';
|
|
14
18
|
|
|
15
19
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
16
20
|
export class SplitPolygonHandler extends ModeHandler {
|
|
@@ -42,9 +46,9 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
42
46
|
if (closestPoint) {
|
|
43
47
|
// closest point is used as 90degree entry to the polygon
|
|
44
48
|
const lastBearing = turfBearing(firstPoint, closestPoint);
|
|
45
|
-
const currentDistance = turfDistance(firstPoint, mapCoords, {
|
|
49
|
+
const currentDistance = turfDistance(firstPoint, mapCoords, {units: 'meters'});
|
|
46
50
|
return turfDestination(firstPoint, currentDistance, lastBearing, {
|
|
47
|
-
units: 'meters'
|
|
51
|
+
units: 'meters'
|
|
48
52
|
}).geometry.coordinates;
|
|
49
53
|
}
|
|
50
54
|
return mapCoords;
|
|
@@ -65,7 +69,7 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
65
69
|
handleClick(event: ClickEvent): EditAction | null | undefined {
|
|
66
70
|
super.handleClick({
|
|
67
71
|
...event,
|
|
68
|
-
mapCoords: this.calculateMapCoords(this.getClickSequence(), event.mapCoords)
|
|
72
|
+
mapCoords: this.calculateMapCoords(this.getClickSequence(), event.mapCoords)
|
|
69
73
|
});
|
|
70
74
|
const editAction: EditAction | null | undefined = null;
|
|
71
75
|
const tentativeFeature = this.getTentativeFeature();
|
|
@@ -80,7 +84,7 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
80
84
|
}
|
|
81
85
|
const pt = {
|
|
82
86
|
type: 'Point',
|
|
83
|
-
coordinates: clickSequence[clickSequence.length - 1]
|
|
87
|
+
coordinates: clickSequence[clickSequence.length - 1]
|
|
84
88
|
};
|
|
85
89
|
// @ts-expect-error turf type diff
|
|
86
90
|
const isPointInPolygon = booleanPointInPolygon(pt, selectedGeometry);
|
|
@@ -98,12 +102,12 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
98
102
|
return editAction;
|
|
99
103
|
}
|
|
100
104
|
|
|
101
|
-
handlePointerMove({
|
|
105
|
+
handlePointerMove({mapCoords}: PointerMoveEvent): {
|
|
102
106
|
editAction: EditAction | null | undefined;
|
|
103
107
|
cancelMapPan: boolean;
|
|
104
108
|
} {
|
|
105
109
|
const clickSequence = this.getClickSequence();
|
|
106
|
-
const result = {
|
|
110
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
107
111
|
|
|
108
112
|
if (clickSequence.length === 0) {
|
|
109
113
|
// nothing to do yet
|
|
@@ -114,8 +118,8 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
114
118
|
type: 'Feature',
|
|
115
119
|
geometry: {
|
|
116
120
|
type: 'LineString',
|
|
117
|
-
coordinates: [...clickSequence, this.calculateMapCoords(clickSequence, mapCoords)]
|
|
118
|
-
}
|
|
121
|
+
coordinates: [...clickSequence, this.calculateMapCoords(clickSequence, mapCoords)]
|
|
122
|
+
}
|
|
119
123
|
});
|
|
120
124
|
|
|
121
125
|
return result;
|
|
@@ -128,13 +132,13 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
128
132
|
const modeConfig = this.getModeConfig() || {};
|
|
129
133
|
|
|
130
134
|
// Default gap in between the polygon
|
|
131
|
-
let {
|
|
135
|
+
let {gap = 0.1, units = 'centimeters'} = modeConfig;
|
|
132
136
|
if (gap === 0) {
|
|
133
137
|
gap = 0.1;
|
|
134
138
|
units = 'centimeters';
|
|
135
139
|
}
|
|
136
140
|
// @ts-expect-error turf type diff
|
|
137
|
-
const buffer = turfBuffer(tentativeFeature, gap, {
|
|
141
|
+
const buffer = turfBuffer(tentativeFeature, gap, {units});
|
|
138
142
|
// @ts-expect-error turf type diff
|
|
139
143
|
const updatedGeometry = turfDifference(selectedGeometry, buffer);
|
|
140
144
|
this._setTentativeFeature(null);
|
|
@@ -144,7 +148,7 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
144
148
|
return null;
|
|
145
149
|
}
|
|
146
150
|
|
|
147
|
-
const {
|
|
151
|
+
const {type, coordinates} = updatedGeometry.geometry;
|
|
148
152
|
let updatedCoordinates: any[] = []; // TODO
|
|
149
153
|
if (type === 'Polygon') {
|
|
150
154
|
// Update the coordinates as per Multipolygon
|
|
@@ -162,14 +166,14 @@ export class SplitPolygonHandler extends ModeHandler {
|
|
|
162
166
|
// Update the type to Mulitpolygon
|
|
163
167
|
const updatedData = this.getImmutableFeatureCollection().replaceGeometry(featureIndex, {
|
|
164
168
|
type: 'MultiPolygon',
|
|
165
|
-
coordinates: updatedCoordinates
|
|
169
|
+
coordinates: updatedCoordinates
|
|
166
170
|
});
|
|
167
171
|
|
|
168
172
|
const editAction: EditAction = {
|
|
169
173
|
updatedData: updatedData.getObject(),
|
|
170
174
|
editType: 'split',
|
|
171
175
|
featureIndexes: [featureIndex],
|
|
172
|
-
editContext: null
|
|
176
|
+
editContext: null
|
|
173
177
|
};
|
|
174
178
|
|
|
175
179
|
return editAction;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {ClickEvent} from '../edit-modes/types';
|
|
6
|
+
import {ModeHandler, EditAction} from './mode-handler';
|
|
3
7
|
|
|
4
8
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
5
9
|
export class ThreeClickPolygonHandler extends ModeHandler {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import turfBearing from '@turf/bearing';
|
|
2
6
|
import turfDistance from '@turf/distance';
|
|
3
7
|
import turfTransformTranslate from '@turf/transform-translate';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import {point} from '@turf/helpers';
|
|
9
|
+
import {FeatureCollection, Position} from '../utils/geojson-types';
|
|
10
|
+
import {PointerMoveEvent, StartDraggingEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
11
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
8
12
|
|
|
9
13
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
10
14
|
export class TranslateHandler extends ModeHandler {
|
|
@@ -22,7 +26,7 @@ export class TranslateHandler extends ModeHandler {
|
|
|
22
26
|
|
|
23
27
|
if (!this._isTranslatable || !event.pointerDownMapCoords) {
|
|
24
28
|
// Nothing to do
|
|
25
|
-
return {
|
|
29
|
+
return {editAction: null, cancelMapPan: false};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
if (event.isDragging && this._geometryBeforeTranslate) {
|
|
@@ -34,7 +38,7 @@ export class TranslateHandler extends ModeHandler {
|
|
|
34
38
|
);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
return {
|
|
41
|
+
return {editAction, cancelMapPan: true};
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
handleStartDragging(event: StartDraggingEvent): EditAction | null | undefined {
|
|
@@ -62,7 +66,7 @@ export class TranslateHandler extends ModeHandler {
|
|
|
62
66
|
return editAction;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
getCursor({
|
|
69
|
+
getCursor({isDragging}: {isDragging: boolean}): string {
|
|
66
70
|
if (this._isTranslatable) {
|
|
67
71
|
return 'move';
|
|
68
72
|
}
|
|
@@ -104,7 +108,7 @@ export class TranslateHandler extends ModeHandler {
|
|
|
104
108
|
updatedData: updatedData.getObject(),
|
|
105
109
|
editType,
|
|
106
110
|
featureIndexes: selectedIndexes,
|
|
107
|
-
editContext: null
|
|
111
|
+
editContext: null
|
|
108
112
|
};
|
|
109
113
|
}
|
|
110
114
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {ClickEvent} from '../edit-modes/types';
|
|
6
|
+
import {ModeHandler, EditAction} from './mode-handler';
|
|
3
7
|
|
|
4
8
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
5
9
|
export class TwoClickPolygonHandler extends ModeHandler {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Position} from '../utils/geojson-types';
|
|
6
|
+
import {EditHandle, ModeHandler} from './mode-handler';
|
|
3
7
|
|
|
4
8
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
5
9
|
export class ViewHandler extends ModeHandler {
|
|
6
|
-
getCursor({
|
|
10
|
+
getCursor({isDragging}: {isDragging: boolean}): string {
|
|
7
11
|
return isDragging ? 'grabbing' : 'grab';
|
|
8
12
|
}
|
|
9
13
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
//
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
2
6
|
|
|
3
7
|
/* eslint-disable camelcase */
|
|
4
8
|
const INITIAL_STATE: Record<string, number> = {
|
|
5
9
|
color_uOpacity: 1.0,
|
|
6
10
|
color_uDesaturate: 0.0,
|
|
7
|
-
color_uBrightness: 1.0
|
|
11
|
+
color_uBrightness: 1.0
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
function getUniforms(opts = INITIAL_STATE) {
|
|
@@ -48,9 +52,10 @@ vec4 color_filterColor(vec4 color) {
|
|
|
48
52
|
}
|
|
49
53
|
`;
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
/** Shader module that implements desaturation. @note still WIP */
|
|
56
|
+
export const color = {
|
|
52
57
|
name: 'color',
|
|
53
58
|
vs,
|
|
54
59
|
fs,
|
|
55
|
-
getUniforms
|
|
56
|
-
};
|
|
60
|
+
getUniforms
|
|
61
|
+
} as const satisfies ShaderModule;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
// TODO - this module is a WIP
|
|
2
6
|
|
|
3
7
|
/* eslint-disable camelcase */
|
|
@@ -25,9 +29,9 @@ vec2 project_clipspace_to_projective_uv(vec4 position) {
|
|
|
25
29
|
|
|
26
30
|
const fs = vs;
|
|
27
31
|
|
|
28
|
-
export
|
|
32
|
+
export const utils = {
|
|
29
33
|
name: 'outline',
|
|
30
34
|
vs,
|
|
31
35
|
fs,
|
|
32
|
-
getUniforms
|
|
36
|
+
getUniforms
|
|
33
37
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import hermite from 'cubic-hermite-spline';
|
|
2
6
|
import turfDistance from '@turf/distance';
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
7
|
+
import {lineString} from '@turf/helpers';
|
|
8
|
+
import type {Feature, MultiLineString, LineString, Position} from '@turf/helpers';
|
|
5
9
|
|
|
6
10
|
const INTERPOLATION_INTERVAL = 0.005;
|
|
7
11
|
const INTERPOLATION_THRESHOLD = 0.001;
|
|
@@ -21,7 +25,7 @@ export function generateCurveFromControlPoints(
|
|
|
21
25
|
let prev: Position[] | null = null;
|
|
22
26
|
let totalDistance = 0;
|
|
23
27
|
|
|
24
|
-
const {
|
|
28
|
+
const {coordinates: coords} = line.geometry;
|
|
25
29
|
|
|
26
30
|
for (let i = 0; i < coords.length; i++) {
|
|
27
31
|
const cur = coords[i];
|
|
@@ -37,14 +41,14 @@ export function generateCurveFromControlPoints(
|
|
|
37
41
|
const tangents: number[][] = [];
|
|
38
42
|
|
|
39
43
|
// first tangent
|
|
40
|
-
// @ts-
|
|
44
|
+
// @ts-expect-error TODO
|
|
41
45
|
tangents.push(calculateSingleTangent(coords[0], coords[1], knots[1] - knots[0]));
|
|
42
46
|
|
|
43
47
|
// second to before last
|
|
44
48
|
for (let i = 1; i < coords.length - 1; i++) {
|
|
45
|
-
// @ts-
|
|
49
|
+
// @ts-expect-error TODO
|
|
46
50
|
const A = calculateSingleTangent(coords[i], coords[i + 1], knots[i + 1] - knots[i]);
|
|
47
|
-
// @ts-
|
|
51
|
+
// @ts-expect-error TODO
|
|
48
52
|
const B = calculateSingleTangent(coords[i - 1], coords[i], knots[i] - knots[i - 1]);
|
|
49
53
|
const x = (A[0] + B[0]) / 2.0;
|
|
50
54
|
const y = (A[1] + B[1]) / 2.0;
|
|
@@ -54,7 +58,7 @@ export function generateCurveFromControlPoints(
|
|
|
54
58
|
// last tangent
|
|
55
59
|
const last = coords.length - 1;
|
|
56
60
|
tangents.push(
|
|
57
|
-
// @ts-
|
|
61
|
+
// @ts-expect-error TODO
|
|
58
62
|
calculateSingleTangent(coords[last - 1], coords[last], knots[last] - knots[last - 1])
|
|
59
63
|
);
|
|
60
64
|
|