@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,7 +1,10 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import bearing from '@turf/bearing';
|
|
2
|
-
import { generatePointsParallelToLinePoints, getPickedEditHandle, getPickedIntermediateEditHandle
|
|
3
|
-
import { ModifyMode } from
|
|
4
|
-
import { ImmutableFeatureCollection } from
|
|
5
|
+
import { generatePointsParallelToLinePoints, getPickedEditHandle, getPickedIntermediateEditHandle } from "./utils.js";
|
|
6
|
+
import { ModifyMode } from "./modify-mode.js";
|
|
7
|
+
import { ImmutableFeatureCollection } from "./immutable-feature-collection.js";
|
|
5
8
|
export class ExtrudeMode extends ModifyMode {
|
|
6
9
|
// this mode is busted =(
|
|
7
10
|
isPointAdded = false;
|
|
@@ -30,8 +33,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
30
33
|
editContext: {
|
|
31
34
|
featureIndexes: [featureIndex],
|
|
32
35
|
positionIndexes: this.nextPositionIndexes(positionIndexes, size),
|
|
33
|
-
position: p3
|
|
34
|
-
}
|
|
36
|
+
position: p3
|
|
37
|
+
}
|
|
35
38
|
});
|
|
36
39
|
event.cancelPan();
|
|
37
40
|
}
|
|
@@ -61,8 +64,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
61
64
|
editContext: {
|
|
62
65
|
featureIndexes: [featureIndex],
|
|
63
66
|
positionIndexes,
|
|
64
|
-
position: p1
|
|
65
|
-
}
|
|
67
|
+
position: p1
|
|
68
|
+
}
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -93,8 +96,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
93
96
|
editContext: {
|
|
94
97
|
featureIndexes: [featureIndex],
|
|
95
98
|
positionIndexes,
|
|
96
|
-
position: p3
|
|
97
|
-
}
|
|
99
|
+
position: p3
|
|
100
|
+
}
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EditAction, ClickEvent, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, Pick, Tooltip, ModeProps, GuideFeatureCollection, TentativeFeature } from
|
|
2
|
-
import { FeatureCollection, Feature, Polygon, Geometry, Position } from
|
|
3
|
-
import { EditMode } from
|
|
1
|
+
import { EditAction, ClickEvent, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, Pick, Tooltip, ModeProps, GuideFeatureCollection, TentativeFeature } from "./types.js";
|
|
2
|
+
import { FeatureCollection, Feature, Polygon, Geometry, Position } from "../utils/geojson-types.js";
|
|
3
|
+
import { EditMode } from "./edit-mode.js";
|
|
4
4
|
export type GeoJsonEditAction = EditAction<FeatureCollection>;
|
|
5
5
|
export type GeoJsonEditModeType = EditMode<FeatureCollection, FeatureCollection>;
|
|
6
6
|
export interface GeoJsonEditModeConstructor {
|
|
@@ -31,3 +31,4 @@ export declare class GeoJsonEditMode implements EditMode<FeatureCollection, Guid
|
|
|
31
31
|
handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>): void;
|
|
32
32
|
}
|
|
33
33
|
export declare function getIntermediatePosition(position1: Position, position2: Position): Position;
|
|
34
|
+
//# sourceMappingURL=geojson-edit-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geojson-edit-mode.d.ts","sourceRoot":"","sources":["../../src/edit-modes/geojson-edit-mode.ts"],"names":[],"mappings":"AASA,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,gBAAgB,EACjB,mBAAgB;AACjB,OAAO,EAAC,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,kCAA+B;AAE/F,OAAO,EAAC,QAAQ,EAAC,uBAAoB;AAGrC,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAS9D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAEjF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,mBAAmB,CAAC;CAC7B;AAED,qBAAa,eAAgB,YAAW,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IACzF,cAAc,EAAE,QAAQ,EAAE,CAAM;IAEhC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,sBAAsB;IAItE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO,EAAE;IAI3D,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS;IAOnF,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS;IAQrF,sCAAsC,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,iBAAiB;IAS9F,gBAAgB,IAAI,QAAQ,EAAE;IAI9B,gBAAgB,CAAC,EAAC,SAAS,EAAC,EAAE,UAAU,GAAG,IAAI;IAI/C,kBAAkB,IAAI,IAAI;IAI1B,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,gBAAgB,GAAG,IAAI,GAAG,SAAS;IAO3F,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO;IAU9E,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAYxC,mBAAmB,CACjB,iBAAiB,EAAE,QAAQ,GAAG,OAAO,EACrC,QAAQ,EAAE,iBAAiB,GAC1B,iBAAiB;IA2BpB,wBAAwB,CACtB,EAAC,QAAQ,EAAE,aAAa,EAAC,EAAE,iBAAiB,EAC5C,QAAQ,EAAE,iBAAiB,GAC1B,iBAAiB;IAwBpB,mCAAmC,CACjC,iBAAiB,EAAE,OAAO,GAAG,OAAO,EACpC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAClC,iBAAiB,GAAG,IAAI,GAAG,SAAS;IAmEvC,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,gBAAgB,GAAG,IAAI;IAIpF,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IACzE,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAYrF,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IACzF,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IACvF,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAE/E,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;CAW7E;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAO1F"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import turfUnion from '@turf/union';
|
|
2
5
|
import turfDifference from '@turf/difference';
|
|
3
6
|
import turfIntersect from '@turf/intersect';
|
|
4
7
|
import rewind from '@turf/rewind';
|
|
5
|
-
import { getPickedEditHandles, getNonGuidePicks } from
|
|
6
|
-
import { ImmutableFeatureCollection } from
|
|
8
|
+
import { getPickedEditHandles, getNonGuidePicks } from "./utils.js";
|
|
9
|
+
import { ImmutableFeatureCollection } from "./immutable-feature-collection.js";
|
|
7
10
|
const DEFAULT_GUIDES = {
|
|
8
11
|
type: 'FeatureCollection',
|
|
9
|
-
features: []
|
|
12
|
+
features: []
|
|
10
13
|
};
|
|
11
14
|
const DEFAULT_TOOLTIPS = [];
|
|
12
15
|
export class GeoJsonEditMode {
|
|
@@ -35,7 +38,7 @@ export class GeoJsonEditMode {
|
|
|
35
38
|
const selectedFeatures = props.selectedIndexes.map((selectedIndex) => features[selectedIndex]);
|
|
36
39
|
return {
|
|
37
40
|
type: 'FeatureCollection',
|
|
38
|
-
features: selectedFeatures
|
|
41
|
+
features: selectedFeatures
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
getClickSequence() {
|
|
@@ -76,7 +79,7 @@ export class GeoJsonEditMode {
|
|
|
76
79
|
: {
|
|
77
80
|
type: 'Feature',
|
|
78
81
|
properties: {},
|
|
79
|
-
geometry: featureOrGeometryAsAny
|
|
82
|
+
geometry: featureOrGeometryAsAny
|
|
80
83
|
};
|
|
81
84
|
const rewindFeature = this.rewindPolygon(feature);
|
|
82
85
|
const updatedData = new ImmutableFeatureCollection(features)
|
|
@@ -86,8 +89,8 @@ export class GeoJsonEditMode {
|
|
|
86
89
|
updatedData,
|
|
87
90
|
editType: 'addFeature',
|
|
88
91
|
editContext: {
|
|
89
|
-
featureIndexes: [updatedData.features.length - 1]
|
|
90
|
-
}
|
|
92
|
+
featureIndexes: [updatedData.features.length - 1]
|
|
93
|
+
}
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
getAddManyFeaturesAction({ features: featuresToAdd }, features) {
|
|
@@ -100,7 +103,7 @@ export class GeoJsonEditMode {
|
|
|
100
103
|
updatedData = updatedData.addFeature({
|
|
101
104
|
type: 'Feature',
|
|
102
105
|
properties,
|
|
103
|
-
geometry: geometryAsAny
|
|
106
|
+
geometry: geometryAsAny
|
|
104
107
|
});
|
|
105
108
|
updatedIndexes.push(initialIndex + updatedIndexes.length);
|
|
106
109
|
}
|
|
@@ -108,8 +111,8 @@ export class GeoJsonEditMode {
|
|
|
108
111
|
updatedData: updatedData.getObject(),
|
|
109
112
|
editType: 'addFeature',
|
|
110
113
|
editContext: {
|
|
111
|
-
featureIndexes: updatedIndexes
|
|
112
|
-
}
|
|
114
|
+
featureIndexes: updatedIndexes
|
|
115
|
+
}
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
118
|
getAddFeatureOrBooleanPolygonAction(featureOrGeometry, props) {
|
|
@@ -128,7 +131,7 @@ export class GeoJsonEditMode {
|
|
|
128
131
|
? featureOrGeometryAsAny
|
|
129
132
|
: {
|
|
130
133
|
type: 'Feature',
|
|
131
|
-
geometry: featureOrGeometryAsAny
|
|
134
|
+
geometry: featureOrGeometryAsAny
|
|
132
135
|
};
|
|
133
136
|
let updatedGeometry;
|
|
134
137
|
if (modeConfig.booleanOperation === 'union') {
|
|
@@ -161,8 +164,8 @@ export class GeoJsonEditMode {
|
|
|
161
164
|
updatedData,
|
|
162
165
|
editType: 'unionGeometry',
|
|
163
166
|
editContext: {
|
|
164
|
-
featureIndexes: [featureIndex]
|
|
165
|
-
}
|
|
167
|
+
featureIndexes: [featureIndex]
|
|
168
|
+
}
|
|
166
169
|
};
|
|
167
170
|
return editAction;
|
|
168
171
|
}
|
|
@@ -179,8 +182,8 @@ export class GeoJsonEditMode {
|
|
|
179
182
|
updatedData: props.data,
|
|
180
183
|
editType: 'updateTentativeFeature',
|
|
181
184
|
editContext: {
|
|
182
|
-
feature: tentativeFeature
|
|
183
|
-
}
|
|
185
|
+
feature: tentativeFeature
|
|
186
|
+
}
|
|
184
187
|
});
|
|
185
188
|
}
|
|
186
189
|
}
|
|
@@ -194,7 +197,7 @@ export class GeoJsonEditMode {
|
|
|
194
197
|
// Because the new drawing feature is dropped, so the data will keep as the same.
|
|
195
198
|
updatedData: props.data,
|
|
196
199
|
editType: 'cancelFeature',
|
|
197
|
-
editContext: {}
|
|
200
|
+
editContext: {}
|
|
198
201
|
});
|
|
199
202
|
}
|
|
200
203
|
}
|
|
@@ -202,7 +205,7 @@ export class GeoJsonEditMode {
|
|
|
202
205
|
export function getIntermediatePosition(position1, position2) {
|
|
203
206
|
const intermediatePosition = [
|
|
204
207
|
(position1[0] + position2[0]) / 2.0,
|
|
205
|
-
(position1[1] + position2[1]) / 2.0
|
|
208
|
+
(position1[1] + position2[1]) / 2.0
|
|
206
209
|
];
|
|
207
210
|
return intermediatePosition;
|
|
208
211
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature, FeatureCollection, Geometry, Position } from
|
|
1
|
+
import { Feature, FeatureCollection, Geometry, Position } from "../utils/geojson-types.js";
|
|
2
2
|
export declare class ImmutableFeatureCollection {
|
|
3
3
|
featureCollection: FeatureCollection;
|
|
4
4
|
constructor(featureCollection: FeatureCollection);
|
|
@@ -22,6 +22,7 @@ export declare class ImmutableFeatureCollection {
|
|
|
22
22
|
* @param positionIndexes An array containing the indexes of the postion to remove
|
|
23
23
|
*
|
|
24
24
|
* @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.
|
|
25
|
+
*
|
|
25
26
|
*/
|
|
26
27
|
removePosition(featureIndex: number, positionIndexes: number[] | null | undefined): ImmutableFeatureCollection;
|
|
27
28
|
/**
|
|
@@ -41,3 +42,4 @@ export declare class ImmutableFeatureCollection {
|
|
|
41
42
|
deleteFeature(featureIndex: number): ImmutableFeatureCollection;
|
|
42
43
|
deleteFeatures(featureIndexes: number[]): ImmutableFeatureCollection;
|
|
43
44
|
}
|
|
45
|
+
//# sourceMappingURL=immutable-feature-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable-feature-collection.d.ts","sourceRoot":"","sources":["../../src/edit-modes/immutable-feature-collection.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,QAAQ,EAIR,QAAQ,EAET,kCAA+B;AAEhC,qBAAa,0BAA0B;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;gBAEzB,iBAAiB,EAAE,iBAAiB;IAIhD,SAAS;IAIT;;;;;;;;;OASG;IACH,eAAe,CACb,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,EAC5C,eAAe,EAAE,QAAQ,GACxB,0BAA0B;IAiB7B;;;;;;;;;OASG;IAEH,cAAc,CACZ,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAC3C,0BAA0B;IA0D7B;;;;;;;;;OASG;IACH,WAAW,CACT,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,EAC5C,aAAa,EAAE,QAAQ,GACtB,0BAA0B;IAqB7B,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,0BAA0B;IAkBrF,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,0BAA0B;IAIxD,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,0BAA0B;IAS5D,aAAa,CAAC,YAAY,EAAE,MAAM;IAIlC,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE;CAiBxC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
export class ImmutableFeatureCollection {
|
|
2
5
|
featureCollection;
|
|
3
6
|
constructor(featureCollection) {
|
|
@@ -21,7 +24,7 @@ export class ImmutableFeatureCollection {
|
|
|
21
24
|
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
22
25
|
const updatedGeometry = {
|
|
23
26
|
...geometry,
|
|
24
|
-
coordinates: immutablyReplacePosition(geometry.coordinates, positionIndexes, updatedPosition, isPolygonal)
|
|
27
|
+
coordinates: immutablyReplacePosition(geometry.coordinates, positionIndexes, updatedPosition, isPolygonal)
|
|
25
28
|
};
|
|
26
29
|
return this.replaceGeometry(featureIndex, updatedGeometry);
|
|
27
30
|
}
|
|
@@ -33,30 +36,32 @@ export class ImmutableFeatureCollection {
|
|
|
33
36
|
* @param positionIndexes An array containing the indexes of the postion to remove
|
|
34
37
|
*
|
|
35
38
|
* @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.
|
|
39
|
+
*
|
|
36
40
|
*/
|
|
41
|
+
// eslint-disable-next-line complexity
|
|
37
42
|
removePosition(featureIndex, positionIndexes) {
|
|
38
43
|
const geometry = this.featureCollection.features[featureIndex].geometry;
|
|
39
44
|
if (geometry.type === 'Point') {
|
|
40
|
-
throw Error(
|
|
45
|
+
throw Error("Can't remove a position from a Point or there'd be nothing left");
|
|
41
46
|
}
|
|
42
47
|
if (geometry.type === 'MultiPoint' && // only 1 point left
|
|
43
48
|
geometry.coordinates.length < 2) {
|
|
44
|
-
throw Error(
|
|
49
|
+
throw Error("Can't remove the last point of a MultiPoint or there'd be nothing left");
|
|
45
50
|
}
|
|
46
51
|
if (geometry.type === 'LineString' && // only 2 positions
|
|
47
52
|
geometry.coordinates.length < 3) {
|
|
48
|
-
throw Error(
|
|
53
|
+
throw Error("Can't remove position. LineString must have at least two positions");
|
|
49
54
|
}
|
|
50
55
|
if (geometry.type === 'Polygon' && // outer ring is a triangle
|
|
51
56
|
geometry.coordinates[0].length < 5 &&
|
|
52
57
|
Array.isArray(positionIndexes) && // trying to remove from outer ring
|
|
53
58
|
positionIndexes[0] === 0) {
|
|
54
|
-
throw Error(
|
|
59
|
+
throw Error("Can't remove position. Polygon's outer ring must have at least four positions");
|
|
55
60
|
}
|
|
56
61
|
if (geometry.type === 'MultiLineString' && // only 1 LineString left
|
|
57
62
|
geometry.coordinates.length === 1 && // only 2 positions
|
|
58
63
|
geometry.coordinates[0].length < 3) {
|
|
59
|
-
throw Error(
|
|
64
|
+
throw Error("Can't remove position. MultiLineString must have at least two positions");
|
|
60
65
|
}
|
|
61
66
|
if (geometry.type === 'MultiPolygon' && // only 1 polygon left
|
|
62
67
|
geometry.coordinates.length === 1 && // outer ring is a triangle
|
|
@@ -64,12 +69,12 @@ export class ImmutableFeatureCollection {
|
|
|
64
69
|
Array.isArray(positionIndexes) && // trying to remove from first polygon
|
|
65
70
|
positionIndexes[0] === 0 && // trying to remove from outer ring
|
|
66
71
|
positionIndexes[1] === 0) {
|
|
67
|
-
throw Error(
|
|
72
|
+
throw Error("Can't remove position. MultiPolygon's outer ring must have at least four positions");
|
|
68
73
|
}
|
|
69
74
|
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
70
75
|
const updatedGeometry = {
|
|
71
76
|
...geometry,
|
|
72
|
-
coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)
|
|
77
|
+
coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)
|
|
73
78
|
};
|
|
74
79
|
// Handle cases where incomplete geometries need pruned (e.g. holes that were triangles)
|
|
75
80
|
pruneGeometryIfNecessary(updatedGeometry);
|
|
@@ -93,22 +98,22 @@ export class ImmutableFeatureCollection {
|
|
|
93
98
|
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
94
99
|
const updatedGeometry = {
|
|
95
100
|
...geometry,
|
|
96
|
-
coordinates: immutablyAddPosition(geometry.coordinates, positionIndexes, positionToAdd, isPolygonal)
|
|
101
|
+
coordinates: immutablyAddPosition(geometry.coordinates, positionIndexes, positionToAdd, isPolygonal)
|
|
97
102
|
};
|
|
98
103
|
return this.replaceGeometry(featureIndex, updatedGeometry);
|
|
99
104
|
}
|
|
100
105
|
replaceGeometry(featureIndex, geometry) {
|
|
101
106
|
const updatedFeature = {
|
|
102
107
|
...this.featureCollection.features[featureIndex],
|
|
103
|
-
geometry
|
|
108
|
+
geometry
|
|
104
109
|
};
|
|
105
110
|
const updatedFeatureCollection = {
|
|
106
111
|
...this.featureCollection,
|
|
107
112
|
features: [
|
|
108
113
|
...this.featureCollection.features.slice(0, featureIndex),
|
|
109
114
|
updatedFeature,
|
|
110
|
-
...this.featureCollection.features.slice(featureIndex + 1)
|
|
111
|
-
]
|
|
115
|
+
...this.featureCollection.features.slice(featureIndex + 1)
|
|
116
|
+
]
|
|
112
117
|
};
|
|
113
118
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
114
119
|
}
|
|
@@ -118,7 +123,7 @@ export class ImmutableFeatureCollection {
|
|
|
118
123
|
addFeatures(features) {
|
|
119
124
|
const updatedFeatureCollection = {
|
|
120
125
|
...this.featureCollection,
|
|
121
|
-
features: [...this.featureCollection.features, ...features]
|
|
126
|
+
features: [...this.featureCollection.features, ...features]
|
|
122
127
|
};
|
|
123
128
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
124
129
|
}
|
|
@@ -136,7 +141,7 @@ export class ImmutableFeatureCollection {
|
|
|
136
141
|
}
|
|
137
142
|
const updatedFeatureCollection = {
|
|
138
143
|
...this.featureCollection,
|
|
139
|
-
features
|
|
144
|
+
features
|
|
140
145
|
};
|
|
141
146
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
142
147
|
}
|
|
@@ -161,7 +166,7 @@ function immutablyReplacePosition(coordinates, positionIndexes, updatedPosition,
|
|
|
161
166
|
const updated = [
|
|
162
167
|
...coordinates.slice(0, positionIndexes[0]),
|
|
163
168
|
getUpdatedPosition(updatedPosition, coordinates[positionIndexes[0]]),
|
|
164
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
169
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
165
170
|
];
|
|
166
171
|
if (isPolygonal &&
|
|
167
172
|
(positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)) {
|
|
@@ -176,7 +181,7 @@ function immutablyReplacePosition(coordinates, positionIndexes, updatedPosition,
|
|
|
176
181
|
return [
|
|
177
182
|
...coordinates.slice(0, positionIndexes[0]),
|
|
178
183
|
immutablyReplacePosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), updatedPosition, isPolygonal),
|
|
179
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
184
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
180
185
|
];
|
|
181
186
|
}
|
|
182
187
|
function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
|
|
@@ -189,7 +194,7 @@ function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
|
|
|
189
194
|
if (positionIndexes.length === 1) {
|
|
190
195
|
const updated = [
|
|
191
196
|
...coordinates.slice(0, positionIndexes[0]),
|
|
192
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
197
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
193
198
|
];
|
|
194
199
|
if (isPolygonal &&
|
|
195
200
|
(positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)) {
|
|
@@ -210,7 +215,7 @@ function immutablyRemovePosition(coordinates, positionIndexes, isPolygonal) {
|
|
|
210
215
|
return [
|
|
211
216
|
...coordinates.slice(0, positionIndexes[0]),
|
|
212
217
|
immutablyRemovePosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), isPolygonal),
|
|
213
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
218
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
214
219
|
];
|
|
215
220
|
}
|
|
216
221
|
function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPolygonal) {
|
|
@@ -224,7 +229,7 @@ function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPol
|
|
|
224
229
|
const updated = [
|
|
225
230
|
...coordinates.slice(0, positionIndexes[0]),
|
|
226
231
|
positionToAdd,
|
|
227
|
-
...coordinates.slice(positionIndexes[0])
|
|
232
|
+
...coordinates.slice(positionIndexes[0])
|
|
228
233
|
];
|
|
229
234
|
return updated;
|
|
230
235
|
}
|
|
@@ -232,7 +237,7 @@ function immutablyAddPosition(coordinates, positionIndexes, positionToAdd, isPol
|
|
|
232
237
|
return [
|
|
233
238
|
...coordinates.slice(0, positionIndexes[0]),
|
|
234
239
|
immutablyAddPosition(coordinates[positionIndexes[0]], positionIndexes.slice(1, positionIndexes.length), positionToAdd, isPolygonal),
|
|
235
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
240
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
236
241
|
];
|
|
237
242
|
}
|
|
238
243
|
function pruneGeometryIfNecessary(geometry) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClickEvent, PointerMoveEvent, Tooltip, ModeProps, GuideFeatureCollection } from
|
|
2
|
-
import { FeatureCollection, Position } from
|
|
3
|
-
import { GeoJsonEditMode } from
|
|
1
|
+
import { ClickEvent, PointerMoveEvent, Tooltip, ModeProps, GuideFeatureCollection } from "./types.js";
|
|
2
|
+
import { FeatureCollection, Position } from "../utils/geojson-types.js";
|
|
3
|
+
import { GeoJsonEditMode } from "./geojson-edit-mode.js";
|
|
4
4
|
export declare class MeasureAngleMode extends GeoJsonEditMode {
|
|
5
5
|
_getTooltips: (args: any) => any;
|
|
6
6
|
handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void;
|
|
@@ -9,3 +9,4 @@ export declare class MeasureAngleMode extends GeoJsonEditMode {
|
|
|
9
9
|
getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection;
|
|
10
10
|
getTooltips(props: ModeProps<FeatureCollection>): Tooltip[];
|
|
11
11
|
}
|
|
12
|
+
//# sourceMappingURL=measure-angle-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-angle-mode.d.ts","sourceRoot":"","sources":["../../src/edit-modes/measure-angle-mode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAC,mBAAgB;AACjG,OAAO,EAAC,iBAAiB,EAAE,QAAQ,EAAC,kCAA+B;AACnE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AAIpD,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,YAAY,qBAuDV;IAEF,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IASzE,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAIrF,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,QAAQ,EAAE;IAa1D,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,sBAAsB;IA6BtE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO,EAAE;CAU5D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import turfBearing from '@turf/bearing';
|
|
2
2
|
import turfCenter from '@turf/center';
|
|
3
|
-
import memoize from
|
|
4
|
-
import { GeoJsonEditMode } from
|
|
3
|
+
import { memoize } from "../utils/memoize.js";
|
|
4
|
+
import { GeoJsonEditMode } from "./geojson-edit-mode.js";
|
|
5
5
|
const DEFAULT_TOOLTIPS = [];
|
|
6
6
|
export class MeasureAngleMode extends GeoJsonEditMode {
|
|
7
7
|
_getTooltips = memoize(({ modeConfig, vertex, point1, point2 }) => {
|
|
@@ -33,10 +33,10 @@ export class MeasureAngleMode extends GeoJsonEditMode {
|
|
|
33
33
|
type: 'Feature',
|
|
34
34
|
geometry: {
|
|
35
35
|
type: 'Point',
|
|
36
|
-
coordinates: p
|
|
36
|
+
coordinates: p
|
|
37
37
|
},
|
|
38
38
|
properties: {}
|
|
39
|
-
}))
|
|
39
|
+
}))
|
|
40
40
|
}).geometry.coordinates;
|
|
41
41
|
tooltips = [{ position, text }];
|
|
42
42
|
}
|
|
@@ -71,8 +71,8 @@ export class MeasureAngleMode extends GeoJsonEditMode {
|
|
|
71
71
|
properties: { guideType: 'tentative' },
|
|
72
72
|
geometry: {
|
|
73
73
|
type: 'LineString',
|
|
74
|
-
coordinates: [points[1], points[0], points[2]]
|
|
75
|
-
}
|
|
74
|
+
coordinates: [points[1], points[0], points[2]]
|
|
75
|
+
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
else if (points.length > 1) {
|
|
@@ -81,8 +81,8 @@ export class MeasureAngleMode extends GeoJsonEditMode {
|
|
|
81
81
|
properties: { guideType: 'tentative' },
|
|
82
82
|
geometry: {
|
|
83
83
|
type: 'LineString',
|
|
84
|
-
coordinates: [points[1], points[0]]
|
|
85
|
-
}
|
|
84
|
+
coordinates: [points[1], points[0]]
|
|
85
|
+
}
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
return guides;
|
|
@@ -93,7 +93,7 @@ export class MeasureAngleMode extends GeoJsonEditMode {
|
|
|
93
93
|
modeConfig: props.modeConfig,
|
|
94
94
|
vertex: points[0],
|
|
95
95
|
point1: points[1],
|
|
96
|
-
point2: points[2]
|
|
96
|
+
point2: points[2]
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ClickEvent, Tooltip, ModeProps } from
|
|
2
|
-
import { FeatureCollection } from
|
|
3
|
-
import { DrawPolygonMode } from
|
|
1
|
+
import { ClickEvent, Tooltip, ModeProps } from "./types.js";
|
|
2
|
+
import { FeatureCollection } from "../utils/geojson-types.js";
|
|
3
|
+
import { DrawPolygonMode } from "./draw-polygon-mode.js";
|
|
4
4
|
export declare class MeasureAreaMode extends DrawPolygonMode {
|
|
5
5
|
handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void;
|
|
6
6
|
handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>): void;
|
|
7
7
|
getTooltips(props: ModeProps<FeatureCollection>): Tooltip[];
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=measure-area-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-area-mode.d.ts","sourceRoot":"","sources":["../../src/edit-modes/measure-area-mode.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAC,mBAAgB;AACvD,OAAO,EAAC,iBAAiB,EAAC,kCAA+B;AACzD,OAAO,EAAC,eAAe,EAAC,+BAA4B;AAIpD,qBAAa,eAAgB,SAAQ,eAAe;IAClD,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IASlE,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAS5E,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO,EAAE;CAiC5D"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import turfArea from '@turf/area';
|
|
2
5
|
import turfCentroid from '@turf/centroid';
|
|
3
|
-
import { DrawPolygonMode } from
|
|
6
|
+
import { DrawPolygonMode } from "./draw-polygon-mode.js";
|
|
4
7
|
const DEFAULT_TOOLTIPS = [];
|
|
5
8
|
export class MeasureAreaMode extends DrawPolygonMode {
|
|
6
9
|
handleClick(event, props) {
|
|
7
10
|
const propsWithoutEdit = {
|
|
8
11
|
...props,
|
|
9
|
-
onEdit: () => { }
|
|
12
|
+
onEdit: () => { }
|
|
10
13
|
};
|
|
11
14
|
super.handleClick(event, propsWithoutEdit);
|
|
12
15
|
}
|
|
13
16
|
handleKeyUp(event, props) {
|
|
14
17
|
const propsWithoutEdit = {
|
|
15
18
|
...props,
|
|
16
|
-
onEdit: () => { }
|
|
19
|
+
onEdit: () => { }
|
|
17
20
|
};
|
|
18
21
|
super.handleKeyUp(event, propsWithoutEdit);
|
|
19
22
|
}
|
|
@@ -39,10 +42,9 @@ export class MeasureAreaMode extends DrawPolygonMode {
|
|
|
39
42
|
}
|
|
40
43
|
return [
|
|
41
44
|
{
|
|
42
|
-
// @ts-expect-error turf types diff
|
|
43
45
|
position: centroid.geometry.coordinates,
|
|
44
|
-
text
|
|
45
|
-
}
|
|
46
|
+
text
|
|
47
|
+
}
|
|
46
48
|
];
|
|
47
49
|
}
|
|
48
50
|
return DEFAULT_TOOLTIPS;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FeatureCollection } from
|
|
2
|
-
import { ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection, Tooltip } from
|
|
3
|
-
import { GeoJsonEditMode } from
|
|
1
|
+
import { FeatureCollection } from "../utils/geojson-types.js";
|
|
2
|
+
import { ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection, Tooltip } from "./types.js";
|
|
3
|
+
import { GeoJsonEditMode } from "./geojson-edit-mode.js";
|
|
4
4
|
export declare class MeasureDistanceMode extends GeoJsonEditMode {
|
|
5
5
|
_isMeasuringSessionFinished: boolean;
|
|
6
6
|
_currentTooltips: Tooltip[];
|
|
@@ -17,3 +17,4 @@ export declare class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
17
17
|
handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void;
|
|
18
18
|
getTooltips(props: ModeProps<FeatureCollection>): Tooltip[];
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=measure-distance-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-distance-mode.d.ts","sourceRoot":"","sources":["../../src/edit-modes/measure-distance-mode.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iBAAiB,EAAW,kCAA+B;AACnE,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,OAAO,EAER,mBAAgB;AAEjB,OAAO,EAAC,eAAe,EAAC,+BAA4B;AAEpD,qBAAa,mBAAoB,SAAQ,eAAe;IACtD,2BAA2B,UAAS;IACpC,gBAAgB,EAAE,OAAO,EAAE,CAAM;IACjC,gBAAgB,SAAK;IAErB,4BAA4B;;;;iBAS1B;IAEF,cAAc,CAAC,QAAQ,KAAA,EAAE,UAAU,CAAC,KAAA;IAepC,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAgElE,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IA2BrE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,sBAAsB;IA8CtE,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAI9E,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,OAAO,EAAE;CA4B5D"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import turfDistance from '@turf/distance';
|
|
2
5
|
import turfMidpoint from '@turf/midpoint';
|
|
3
|
-
import { getPickedEditHandle } from
|
|
4
|
-
import { GeoJsonEditMode } from
|
|
6
|
+
import { getPickedEditHandle } from "./utils.js";
|
|
7
|
+
import { GeoJsonEditMode } from "./geojson-edit-mode.js";
|
|
5
8
|
export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
6
9
|
_isMeasuringSessionFinished = false;
|
|
7
10
|
_currentTooltips = [];
|
|
@@ -58,14 +61,14 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
58
61
|
this._currentDistance += this._calculateDistanceForTooltip({
|
|
59
62
|
positionA: clickSequence[clickSequence.length - 2],
|
|
60
63
|
positionB: clickSequence[clickSequence.length - 1],
|
|
61
|
-
modeConfig
|
|
64
|
+
modeConfig
|
|
62
65
|
});
|
|
63
66
|
const tooltipPosition = centerTooltipsOnLine
|
|
64
67
|
? turfMidpoint(clickSequence[clickSequence.length - 2], clickSequence[clickSequence.length - 1]).geometry.coordinates
|
|
65
68
|
: event.mapCoords;
|
|
66
69
|
this._currentTooltips.push({
|
|
67
70
|
position: tooltipPosition,
|
|
68
|
-
text: this._formatTooltip(this._currentDistance, modeConfig)
|
|
71
|
+
text: this._formatTooltip(this._currentDistance, modeConfig)
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
74
|
// new tentative point
|
|
@@ -74,8 +77,8 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
74
77
|
updatedData: data,
|
|
75
78
|
editType: 'addTentativePosition',
|
|
76
79
|
editContext: {
|
|
77
|
-
position: event.mapCoords
|
|
78
|
-
}
|
|
80
|
+
position: event.mapCoords
|
|
81
|
+
}
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
}
|
|
@@ -111,18 +114,18 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
111
114
|
: [];
|
|
112
115
|
const guides = {
|
|
113
116
|
type: 'FeatureCollection',
|
|
114
|
-
features: []
|
|
117
|
+
features: []
|
|
115
118
|
};
|
|
116
119
|
if (clickSequence.length > 0) {
|
|
117
120
|
guides.features.push({
|
|
118
121
|
type: 'Feature',
|
|
119
122
|
properties: {
|
|
120
|
-
guideType: 'tentative'
|
|
123
|
+
guideType: 'tentative'
|
|
121
124
|
},
|
|
122
125
|
geometry: {
|
|
123
126
|
type: 'LineString',
|
|
124
|
-
coordinates: [...clickSequence, ...lastCoords]
|
|
125
|
-
}
|
|
127
|
+
coordinates: [...clickSequence, ...lastCoords]
|
|
128
|
+
}
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
const editHandles = clickSequence.map((clickedCoord, index) => ({
|
|
@@ -131,12 +134,12 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
131
134
|
guideType: 'editHandle',
|
|
132
135
|
editHandleType: 'existing',
|
|
133
136
|
featureIndex: -1,
|
|
134
|
-
positionIndexes: [index]
|
|
137
|
+
positionIndexes: [index]
|
|
135
138
|
},
|
|
136
139
|
geometry: {
|
|
137
140
|
type: 'Point',
|
|
138
|
-
coordinates: clickedCoord
|
|
139
|
-
}
|
|
141
|
+
coordinates: clickedCoord
|
|
142
|
+
}
|
|
140
143
|
}));
|
|
141
144
|
guides.features.push(...editHandles);
|
|
142
145
|
return guides;
|
|
@@ -152,7 +155,7 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
152
155
|
const distance = this._calculateDistanceForTooltip({
|
|
153
156
|
positionA: positions[positions.length - 1],
|
|
154
157
|
positionB: lastPointerMoveEvent.mapCoords,
|
|
155
|
-
modeConfig: props.modeConfig
|
|
158
|
+
modeConfig: props.modeConfig
|
|
156
159
|
});
|
|
157
160
|
const tooltipPosition = centerTooltipsOnLine
|
|
158
161
|
? turfMidpoint(positions[positions.length - 1], lastPointerMoveEvent.mapCoords).geometry
|
|
@@ -162,8 +165,8 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
|
|
|
162
165
|
...this._currentTooltips,
|
|
163
166
|
{
|
|
164
167
|
position: tooltipPosition,
|
|
165
|
-
text: this._formatTooltip(this._currentDistance + distance, modeConfig)
|
|
166
|
-
}
|
|
168
|
+
text: this._formatTooltip(this._currentDistance + distance, modeConfig)
|
|
169
|
+
}
|
|
167
170
|
];
|
|
168
171
|
}
|
|
169
172
|
return this._currentTooltips;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NearestPointType } from
|
|
2
|
-
import { LineString, Point, FeatureCollection, FeatureOf } from
|
|
3
|
-
import { ModeProps, ClickEvent, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, Viewport, GuideFeatureCollection, EditHandleFeature } from
|
|
4
|
-
import { GeoJsonEditMode } from
|
|
1
|
+
import { NearestPointType } from "./utils.js";
|
|
2
|
+
import { LineString, Point, FeatureCollection, FeatureOf } from "../utils/geojson-types.js";
|
|
3
|
+
import { ModeProps, ClickEvent, PointerMoveEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, Viewport, GuideFeatureCollection, EditHandleFeature } from "./types.js";
|
|
4
|
+
import { GeoJsonEditMode } from "./geojson-edit-mode.js";
|
|
5
5
|
export declare class ModifyMode extends GeoJsonEditMode {
|
|
6
6
|
getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection;
|
|
7
7
|
getNearestPoint(line: FeatureOf<LineString>, inPoint: FeatureOf<Point>, viewport: Viewport | null | undefined): NearestPointType;
|
|
@@ -13,3 +13,4 @@ export declare class ModifyMode extends GeoJsonEditMode {
|
|
|
13
13
|
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>): void;
|
|
14
14
|
getCursor(event: PointerMoveEvent): string | null | undefined;
|
|
15
15
|
}
|
|
16
|
+
//# sourceMappingURL=modify-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modify-mode.d.ts","sourceRoot":"","sources":["../../src/edit-modes/modify-mode.ts"],"names":[],"mappings":"AAKA,OAAO,EAUL,gBAAgB,EACjB,mBAAgB;AACjB,OAAO,EAAC,UAAU,EAAE,KAAK,EAAW,iBAAiB,EAAE,SAAS,EAAC,kCAA+B;AAChG,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EAElB,mBAAgB;AACjB,OAAO,EAAC,eAAe,EAAC,+BAA4B;AAGpD,qBAAa,UAAW,SAAQ,eAAe;IAE7C,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,sBAAsB;IAsFtE,eAAe,CACb,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAC3B,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EACzB,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GACpC,gBAAgB;IAenB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAuDlE,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAW/E,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,EACnC,UAAU,EAAE,iBAAiB,EAC7B,KAAK,EAAE,iBAAiB,GAAG,aAAa;IAqC1C,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAKrF,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IA2BlF,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAQhF,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;CAS9D"}
|