@deck.gl-community/editable-layers 9.0.0-alpha.1 → 9.0.2
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.js +4 -1
- package/dist/edit-modes/composite-mode.d.ts +1 -1
- package/dist/edit-modes/composite-mode.js +4 -1
- package/dist/edit-modes/draw-90degree-polygon-mode.d.ts +1 -1
- package/dist/edit-modes/draw-90degree-polygon-mode.js +29 -24
- package/dist/edit-modes/draw-circle-by-diameter-mode.d.ts +1 -1
- package/dist/edit-modes/draw-circle-by-diameter-mode.js +7 -4
- package/dist/edit-modes/draw-circle-from-center-mode.d.ts +1 -1
- package/dist/edit-modes/draw-circle-from-center-mode.js +7 -4
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.d.ts +1 -1
- package/dist/edit-modes/draw-ellipse-by-bounding-box-mode.js +3 -0
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.d.ts +1 -1
- package/dist/edit-modes/draw-ellipse-using-three-points-mode.js +3 -0
- package/dist/edit-modes/draw-line-string-mode.d.ts +1 -1
- package/dist/edit-modes/draw-line-string-mode.js +19 -16
- package/dist/edit-modes/draw-point-mode.d.ts +1 -1
- package/dist/edit-modes/draw-point-mode.js +7 -4
- package/dist/edit-modes/draw-polygon-by-dragging-mode.d.ts +1 -1
- package/dist/edit-modes/draw-polygon-by-dragging-mode.js +10 -5
- package/dist/edit-modes/draw-polygon-mode.d.ts +1 -1
- package/dist/edit-modes/draw-polygon-mode.js +20 -16
- package/dist/edit-modes/draw-rectangle-from-center-mode.d.ts +1 -1
- package/dist/edit-modes/draw-rectangle-from-center-mode.js +3 -0
- package/dist/edit-modes/draw-rectangle-mode.d.ts +1 -1
- package/dist/edit-modes/draw-rectangle-mode.js +3 -0
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.d.ts +1 -1
- package/dist/edit-modes/draw-rectangle-using-three-points-mode.js +8 -5
- package/dist/edit-modes/draw-square-from-center-mode.d.ts +1 -1
- package/dist/edit-modes/draw-square-from-center-mode.js +3 -0
- package/dist/edit-modes/draw-square-mode.d.ts +1 -1
- package/dist/edit-modes/draw-square-mode.js +3 -0
- package/dist/edit-modes/duplicate-mode.d.ts +1 -1
- package/dist/edit-modes/duplicate-mode.js +3 -0
- package/dist/edit-modes/edit-mode.js +3 -1
- package/dist/edit-modes/elevation-mode.d.ts +2 -2
- package/dist/edit-modes/elevation-mode.js +8 -5
- package/dist/edit-modes/extend-line-string-mode.d.ts +1 -1
- package/dist/edit-modes/extend-line-string-mode.js +9 -6
- package/dist/edit-modes/extrude-mode.d.ts +1 -1
- package/dist/edit-modes/extrude-mode.js +10 -7
- package/dist/edit-modes/geojson-edit-mode.d.ts +1 -1
- package/dist/edit-modes/geojson-edit-mode.js +18 -15
- package/dist/edit-modes/immutable-feature-collection.d.ts +2 -1
- package/dist/edit-modes/immutable-feature-collection.js +25 -20
- package/dist/edit-modes/measure-angle-mode.d.ts +1 -1
- package/dist/edit-modes/measure-angle-mode.js +8 -8
- package/dist/edit-modes/measure-area-mode.d.ts +1 -1
- package/dist/edit-modes/measure-area-mode.js +7 -5
- package/dist/edit-modes/measure-distance-mode.d.ts +1 -1
- package/dist/edit-modes/measure-distance-mode.js +17 -14
- package/dist/edit-modes/modify-mode.d.ts +1 -1
- package/dist/edit-modes/modify-mode.js +17 -14
- package/dist/edit-modes/resize-circle-mode.d.ts +2 -2
- package/dist/edit-modes/resize-circle-mode.js +3 -1
- package/dist/edit-modes/rotate-mode.d.ts +1 -1
- package/dist/edit-modes/rotate-mode.js +8 -5
- package/dist/edit-modes/scale-mode.d.ts +1 -1
- package/dist/edit-modes/scale-mode.js +8 -5
- package/dist/edit-modes/snappable-mode.d.ts +1 -1
- package/dist/edit-modes/snappable-mode.js +8 -5
- package/dist/edit-modes/split-polygon-mode.d.ts +1 -1
- package/dist/edit-modes/split-polygon-mode.js +12 -9
- package/dist/edit-modes/three-click-polygon-mode.d.ts +1 -1
- package/dist/edit-modes/three-click-polygon-mode.js +9 -6
- package/dist/edit-modes/transform-mode.d.ts +1 -1
- package/dist/edit-modes/transform-mode.js +4 -1
- package/dist/edit-modes/translate-mode.d.ts +1 -1
- package/dist/edit-modes/translate-mode.js +7 -4
- package/dist/edit-modes/two-click-polygon-mode.d.ts +1 -1
- package/dist/edit-modes/two-click-polygon-mode.js +9 -6
- package/dist/edit-modes/types.d.ts +1 -1
- package/dist/edit-modes/types.js +3 -0
- package/dist/edit-modes/utils.d.ts +1 -1
- package/dist/edit-modes/utils.js +21 -19
- package/dist/edit-modes/view-mode.js +3 -0
- package/dist/editable-layers/editable-geojson-layer.d.ts +4 -4
- package/dist/editable-layers/editable-geojson-layer.js +27 -26
- package/dist/editable-layers/editable-h3-cluster-layer.d.ts +2 -2
- package/dist/editable-layers/editable-h3-cluster-layer.js +6 -3
- package/dist/editable-layers/editable-layer.d.ts +5 -5
- package/dist/editable-layers/editable-layer.js +18 -15
- package/dist/editable-layers/editable-path-layer.d.ts +1 -1
- package/dist/editable-layers/editable-path-layer.js +10 -7
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts +1 -1
- package/dist/editable-layers/elevated-edit-handle-layer.js +6 -3
- package/dist/editable-layers/junction-scatterplot-layer.d.ts +2 -2
- package/dist/editable-layers/junction-scatterplot-layer.js +10 -7
- package/dist/editable-layers/selection-layer.d.ts +1 -1
- package/dist/editable-layers/selection-layer.js +5 -2
- package/dist/index.cjs +65 -537
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +19 -20
- package/dist/index.js +20 -18
- package/dist/lib/constants.js +3 -0
- package/dist/lib/deck-renderer/deck-cache.d.ts +1 -1
- package/dist/lib/deck-renderer/deck-cache.js +1 -1
- package/dist/lib/deck-renderer/deck-drawer.d.ts +2 -3
- package/dist/lib/deck-renderer/deck-drawer.js +12 -12
- package/dist/lib/feature.d.ts +4 -4
- package/dist/lib/feature.js +4 -1
- package/dist/lib/layer-mouse-event.d.ts +2 -2
- package/dist/lib/layer-mouse-event.js +4 -1
- package/dist/lib/layers/junctions-layer.d.ts +4 -4
- package/dist/lib/layers/junctions-layer.js +10 -7
- package/dist/lib/layers/segments-layer.d.ts +4 -4
- package/dist/lib/layers/segments-layer.js +11 -8
- package/dist/lib/layers/texts-layer.d.ts +3 -3
- package/dist/lib/layers/texts-layer.js +8 -5
- package/dist/lib/math.d.ts +1 -1
- package/dist/lib/math.js +3 -0
- package/dist/lib/{nebula.d.ts → nebula-core.d.ts} +2 -2
- package/dist/lib/{nebula.js → nebula-core.js} +7 -4
- package/dist/lib/nebula-layer.d.ts +2 -2
- package/dist/lib/nebula-layer.js +4 -1
- package/dist/lib/style.js +5 -2
- package/dist/mode-handlers/composite-mode-handler.d.ts +1 -1
- package/dist/mode-handlers/draw-90degree-polygon-handler.d.ts +1 -1
- package/dist/mode-handlers/draw-90degree-polygon-handler.js +13 -10
- package/dist/mode-handlers/draw-circle-by-bounding-box-handler.js +3 -0
- package/dist/mode-handlers/draw-circle-from-center-handler.js +3 -0
- package/dist/mode-handlers/draw-ellipse-by-bounding-box-handler.js +3 -0
- package/dist/mode-handlers/draw-ellipse-using-three-points-handler.js +5 -2
- package/dist/mode-handlers/draw-line-string-handler.js +7 -4
- package/dist/mode-handlers/draw-point-handler.js +4 -1
- package/dist/mode-handlers/draw-polygon-handler.d.ts +1 -1
- package/dist/mode-handlers/draw-polygon-handler.js +10 -7
- package/dist/mode-handlers/draw-rectangle-handler.js +3 -0
- package/dist/mode-handlers/draw-rectangle-using-three-points-handler.js +11 -8
- package/dist/mode-handlers/duplicate-handler.js +3 -0
- package/dist/mode-handlers/elevation-handler.d.ts +2 -2
- package/dist/mode-handlers/elevation-handler.js +8 -5
- package/dist/mode-handlers/extrude-handler.js +10 -7
- package/dist/mode-handlers/mode-handler.d.ts +1 -1
- package/dist/mode-handlers/mode-handler.js +17 -14
- package/dist/mode-handlers/modify-handler.d.ts +2 -2
- package/dist/mode-handlers/modify-handler.js +18 -15
- package/dist/mode-handlers/rotate-handler.d.ts +1 -1
- package/dist/mode-handlers/rotate-handler.js +4 -1
- package/dist/mode-handlers/scale-handler.d.ts +1 -1
- package/dist/mode-handlers/scale-handler.js +5 -2
- package/dist/mode-handlers/snappable-handler.d.ts +1 -1
- package/dist/mode-handlers/snappable-handler.js +6 -3
- package/dist/mode-handlers/split-polygon-handler.js +11 -8
- package/dist/mode-handlers/three-click-polygon-handler.js +3 -0
- package/dist/mode-handlers/translate-handler.d.ts +1 -1
- package/dist/mode-handlers/translate-handler.js +4 -1
- package/dist/mode-handlers/two-click-polygon-handler.js +3 -0
- package/dist/mode-handlers/view-handler.d.ts +1 -1
- package/dist/mode-handlers/view-handler.js +3 -0
- package/dist/shaderlib/color/color.d.ts +7 -6
- package/dist/shaderlib/color/color.js +7 -4
- package/dist/shaderlib/utils/utils.d.ts +2 -2
- package/dist/shaderlib/utils/utils.js +5 -2
- package/dist/{curve-utils.js → utils/curve-utils.js} +7 -4
- package/dist/{geojson-types.d.ts → utils/geojson-types.d.ts} +2 -25
- package/dist/utils/geojson-types.js +4 -0
- package/dist/{memoize.d.ts → utils/memoize.d.ts} +1 -1
- package/dist/{memoize.js → utils/memoize.js} +4 -1
- package/dist/{translateFromCenter.js → utils/translate-from-center.js} +4 -1
- package/dist/utils/types.js +4 -0
- package/dist/{utils.js → utils/utils.js} +8 -6
- package/package.json +10 -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 +33 -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} +8 -4
- package/src/{types.ts → utils/types.ts} +4 -0
- package/src/{utils.ts → utils/utils.ts} +14 -11
- 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
- /package/dist/{curve-utils.d.ts → utils/curve-utils.d.ts} +0 -0
- /package/dist/{translateFromCenter.d.ts → utils/translate-from-center.d.ts} +0 -0
- /package/dist/{types.d.ts → utils/types.d.ts} +0 -0
- /package/dist/{utils.d.ts → utils/utils.d.ts} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Position, LineString, FeatureCollection} from '../utils/geojson-types';
|
|
6
|
+
import {ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection} from './types';
|
|
7
|
+
import {GeoJsonEditMode} from './geojson-edit-mode';
|
|
8
|
+
import {ImmutableFeatureCollection} from './immutable-feature-collection';
|
|
5
9
|
|
|
6
10
|
export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
7
11
|
getSingleSelectedLineString(props: ModeProps<FeatureCollection>): LineString | null | undefined {
|
|
@@ -14,7 +18,7 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>) {
|
|
17
|
-
const {
|
|
21
|
+
const {selectedIndexes} = props;
|
|
18
22
|
const selectedLineString = this.getSingleSelectedLineString(props);
|
|
19
23
|
|
|
20
24
|
if (!selectedLineString) {
|
|
@@ -40,15 +44,15 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
|
40
44
|
editContext: {
|
|
41
45
|
featureIndexes: [featureIndex],
|
|
42
46
|
positionIndexes,
|
|
43
|
-
position: event.mapCoords
|
|
44
|
-
}
|
|
47
|
+
position: event.mapCoords
|
|
48
|
+
}
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {
|
|
49
53
|
const guides: GuideFeatureCollection = {
|
|
50
54
|
type: 'FeatureCollection',
|
|
51
|
-
features: []
|
|
55
|
+
features: []
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
const selectedLineString = this.getSingleSelectedLineString(props);
|
|
@@ -60,7 +64,7 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
|
60
64
|
|
|
61
65
|
// Draw an extension line starting from one end of the selected LineString to the cursor
|
|
62
66
|
let startPosition: Position | null | undefined = null;
|
|
63
|
-
const {
|
|
67
|
+
const {modeConfig} = props;
|
|
64
68
|
if (modeConfig && modeConfig.drawAtFront) {
|
|
65
69
|
startPosition = selectedLineString.coordinates[0];
|
|
66
70
|
} else {
|
|
@@ -70,12 +74,12 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
|
70
74
|
guides.features.push({
|
|
71
75
|
type: 'Feature',
|
|
72
76
|
properties: {
|
|
73
|
-
guideType: 'tentative'
|
|
77
|
+
guideType: 'tentative'
|
|
74
78
|
},
|
|
75
79
|
geometry: {
|
|
76
80
|
type: 'LineString',
|
|
77
|
-
coordinates: [startPosition, mapCoords]
|
|
78
|
-
}
|
|
81
|
+
coordinates: [startPosition, mapCoords]
|
|
82
|
+
}
|
|
79
83
|
});
|
|
80
84
|
|
|
81
85
|
return guides;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import bearing from '@turf/bearing';
|
|
2
6
|
import {
|
|
3
7
|
generatePointsParallelToLinePoints,
|
|
4
8
|
getPickedEditHandle,
|
|
5
|
-
getPickedIntermediateEditHandle
|
|
9
|
+
getPickedIntermediateEditHandle
|
|
6
10
|
} from './utils';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import {FeatureCollection} from '../utils/geojson-types';
|
|
12
|
+
import {ModeProps, StartDraggingEvent, StopDraggingEvent, DraggingEvent} from './types';
|
|
13
|
+
import {ModifyMode} from './modify-mode';
|
|
14
|
+
import {ImmutableFeatureCollection} from './immutable-feature-collection';
|
|
11
15
|
|
|
12
16
|
export class ExtrudeMode extends ModifyMode {
|
|
13
17
|
// this mode is busted =(
|
|
@@ -18,8 +22,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
18
22
|
const editHandle = getPickedEditHandle(event.pointerDownPicks);
|
|
19
23
|
|
|
20
24
|
if (editHandle) {
|
|
21
|
-
const {
|
|
22
|
-
let {
|
|
25
|
+
const {featureIndex} = editHandle.properties;
|
|
26
|
+
let {positionIndexes} = editHandle.properties;
|
|
23
27
|
|
|
24
28
|
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
25
29
|
positionIndexes = this.isPointAdded
|
|
@@ -47,8 +51,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
47
51
|
editContext: {
|
|
48
52
|
featureIndexes: [featureIndex],
|
|
49
53
|
positionIndexes: this.nextPositionIndexes(positionIndexes, size),
|
|
50
|
-
position: p3
|
|
51
|
-
}
|
|
54
|
+
position: p3
|
|
55
|
+
}
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
event.cancelPan();
|
|
@@ -61,7 +65,7 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
61
65
|
|
|
62
66
|
const editHandle = getPickedIntermediateEditHandle(event.picks);
|
|
63
67
|
if (selectedFeatureIndexes.length && editHandle) {
|
|
64
|
-
const {
|
|
68
|
+
const {positionIndexes, featureIndex} = editHandle.properties;
|
|
65
69
|
|
|
66
70
|
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
67
71
|
// p1 and p1 are end points for edge
|
|
@@ -95,8 +99,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
95
99
|
editContext: {
|
|
96
100
|
featureIndexes: [featureIndex],
|
|
97
101
|
positionIndexes,
|
|
98
|
-
position: p1
|
|
99
|
-
}
|
|
102
|
+
position: p1
|
|
103
|
+
}
|
|
100
104
|
});
|
|
101
105
|
}
|
|
102
106
|
}
|
|
@@ -106,8 +110,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
106
110
|
const selectedFeatureIndexes = props.selectedIndexes;
|
|
107
111
|
const editHandle = getPickedEditHandle(event.pointerDownPicks);
|
|
108
112
|
if (selectedFeatureIndexes.length && editHandle) {
|
|
109
|
-
const {
|
|
110
|
-
let {
|
|
113
|
+
const {featureIndex} = editHandle.properties;
|
|
114
|
+
let {positionIndexes} = editHandle.properties;
|
|
111
115
|
|
|
112
116
|
const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);
|
|
113
117
|
positionIndexes = this.isPointAdded
|
|
@@ -136,8 +140,8 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
136
140
|
editContext: {
|
|
137
141
|
featureIndexes: [featureIndex],
|
|
138
142
|
positionIndexes,
|
|
139
|
-
position: p3
|
|
140
|
-
}
|
|
143
|
+
position: p3
|
|
144
|
+
}
|
|
141
145
|
});
|
|
142
146
|
}
|
|
143
147
|
}
|
|
@@ -147,7 +151,7 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
147
151
|
coordinatesSize(
|
|
148
152
|
positionIndexes: number[] | null | undefined,
|
|
149
153
|
featureIndex: number,
|
|
150
|
-
{
|
|
154
|
+
{features}: FeatureCollection
|
|
151
155
|
) {
|
|
152
156
|
let size = 0;
|
|
153
157
|
if (Array.isArray(positionIndexes)) {
|
|
@@ -230,7 +234,7 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
230
234
|
getPointForPositionIndexes(
|
|
231
235
|
positionIndexes: number[] | null | undefined,
|
|
232
236
|
featureIndex: number,
|
|
233
|
-
{
|
|
237
|
+
{features}: FeatureCollection
|
|
234
238
|
) {
|
|
235
239
|
let p1;
|
|
236
240
|
if (Array.isArray(positionIndexes)) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import turfUnion from '@turf/union';
|
|
2
6
|
import turfDifference from '@turf/difference';
|
|
3
7
|
import turfIntersect from '@turf/intersect';
|
|
@@ -14,18 +18,18 @@ import {
|
|
|
14
18
|
Tooltip,
|
|
15
19
|
ModeProps,
|
|
16
20
|
GuideFeatureCollection,
|
|
17
|
-
TentativeFeature
|
|
21
|
+
TentativeFeature
|
|
18
22
|
} from './types';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
+
import {FeatureCollection, Feature, Polygon, Geometry, Position} from '../utils/geojson-types';
|
|
24
|
+
import {getPickedEditHandles, getNonGuidePicks} from './utils';
|
|
25
|
+
import {EditMode} from './edit-mode';
|
|
26
|
+
import {ImmutableFeatureCollection} from './immutable-feature-collection';
|
|
23
27
|
|
|
24
28
|
export type GeoJsonEditAction = EditAction<FeatureCollection>;
|
|
25
29
|
|
|
26
30
|
const DEFAULT_GUIDES: GuideFeatureCollection = {
|
|
27
31
|
type: 'FeatureCollection',
|
|
28
|
-
features: []
|
|
32
|
+
features: []
|
|
29
33
|
};
|
|
30
34
|
const DEFAULT_TOOLTIPS: Tooltip[] = [];
|
|
31
35
|
|
|
@@ -63,11 +67,11 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
getSelectedFeaturesAsFeatureCollection(props: ModeProps<FeatureCollection>): FeatureCollection {
|
|
66
|
-
const {
|
|
70
|
+
const {features} = props.data;
|
|
67
71
|
const selectedFeatures = props.selectedIndexes.map((selectedIndex) => features[selectedIndex]);
|
|
68
72
|
return {
|
|
69
73
|
type: 'FeatureCollection',
|
|
70
|
-
features: selectedFeatures
|
|
74
|
+
features: selectedFeatures
|
|
71
75
|
};
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -75,7 +79,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
75
79
|
return this._clickSequence;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
|
-
addClickSequence({
|
|
82
|
+
addClickSequence({mapCoords}: ClickEvent): void {
|
|
79
83
|
this._clickSequence.push(mapCoords);
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -92,16 +96,16 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
92
96
|
|
|
93
97
|
isSelectionPicked(picks: Pick[], props: ModeProps<FeatureCollection>): boolean {
|
|
94
98
|
if (!picks.length) return false;
|
|
95
|
-
const pickedFeatures = getNonGuidePicks(picks).map(({
|
|
99
|
+
const pickedFeatures = getNonGuidePicks(picks).map(({index}) => index);
|
|
96
100
|
const pickedHandles = getPickedEditHandles(picks).map(
|
|
97
|
-
({
|
|
101
|
+
({properties}) => properties.featureIndex
|
|
98
102
|
);
|
|
99
103
|
const pickedIndexes = new Set([...pickedFeatures, ...pickedHandles]);
|
|
100
104
|
return props.selectedIndexes.some((index) => pickedIndexes.has(index));
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
rewindPolygon(feature: Feature): Feature {
|
|
104
|
-
const {
|
|
108
|
+
const {geometry} = feature;
|
|
105
109
|
|
|
106
110
|
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
107
111
|
if (isPolygonal) {
|
|
@@ -123,10 +127,10 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
123
127
|
featureOrGeometryAsAny.type === 'Feature'
|
|
124
128
|
? featureOrGeometryAsAny
|
|
125
129
|
: {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
type: 'Feature',
|
|
131
|
+
properties: {},
|
|
132
|
+
geometry: featureOrGeometryAsAny
|
|
133
|
+
};
|
|
130
134
|
|
|
131
135
|
const rewindFeature = this.rewindPolygon(feature);
|
|
132
136
|
const updatedData = new ImmutableFeatureCollection(features)
|
|
@@ -137,25 +141,25 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
137
141
|
updatedData,
|
|
138
142
|
editType: 'addFeature',
|
|
139
143
|
editContext: {
|
|
140
|
-
featureIndexes: [updatedData.features.length - 1]
|
|
141
|
-
}
|
|
144
|
+
featureIndexes: [updatedData.features.length - 1]
|
|
145
|
+
}
|
|
142
146
|
};
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
getAddManyFeaturesAction(
|
|
146
|
-
{
|
|
150
|
+
{features: featuresToAdd}: FeatureCollection,
|
|
147
151
|
features: FeatureCollection
|
|
148
152
|
): GeoJsonEditAction {
|
|
149
153
|
let updatedData = new ImmutableFeatureCollection(features);
|
|
150
154
|
const initialIndex = updatedData.getObject().features.length;
|
|
151
155
|
const updatedIndexes: number[] = [];
|
|
152
156
|
for (const feature of featuresToAdd) {
|
|
153
|
-
const {
|
|
157
|
+
const {properties, geometry} = feature;
|
|
154
158
|
const geometryAsAny: any = geometry;
|
|
155
159
|
updatedData = updatedData.addFeature({
|
|
156
160
|
type: 'Feature',
|
|
157
161
|
properties,
|
|
158
|
-
geometry: geometryAsAny
|
|
162
|
+
geometry: geometryAsAny
|
|
159
163
|
});
|
|
160
164
|
updatedIndexes.push(initialIndex + updatedIndexes.length);
|
|
161
165
|
}
|
|
@@ -164,8 +168,8 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
164
168
|
updatedData: updatedData.getObject(),
|
|
165
169
|
editType: 'addFeature',
|
|
166
170
|
editContext: {
|
|
167
|
-
featureIndexes: updatedIndexes
|
|
168
|
-
}
|
|
171
|
+
featureIndexes: updatedIndexes
|
|
172
|
+
}
|
|
169
173
|
};
|
|
170
174
|
}
|
|
171
175
|
|
|
@@ -176,7 +180,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
176
180
|
const featureOrGeometryAsAny: any = featureOrGeometry;
|
|
177
181
|
|
|
178
182
|
const selectedFeature = this.getSelectedFeature(props);
|
|
179
|
-
const {
|
|
183
|
+
const {modeConfig} = props;
|
|
180
184
|
if (modeConfig && modeConfig.booleanOperation) {
|
|
181
185
|
if (
|
|
182
186
|
!selectedFeature ||
|
|
@@ -194,9 +198,9 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
194
198
|
featureOrGeometryAsAny.type === 'Feature'
|
|
195
199
|
? featureOrGeometryAsAny
|
|
196
200
|
: {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
201
|
+
type: 'Feature',
|
|
202
|
+
geometry: featureOrGeometryAsAny
|
|
203
|
+
};
|
|
200
204
|
|
|
201
205
|
let updatedGeometry;
|
|
202
206
|
if (modeConfig.booleanOperation === 'union') {
|
|
@@ -230,8 +234,8 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
230
234
|
updatedData,
|
|
231
235
|
editType: 'unionGeometry',
|
|
232
236
|
editContext: {
|
|
233
|
-
featureIndexes: [featureIndex]
|
|
234
|
-
}
|
|
237
|
+
featureIndexes: [featureIndex]
|
|
238
|
+
}
|
|
235
239
|
};
|
|
236
240
|
|
|
237
241
|
return editAction;
|
|
@@ -251,8 +255,8 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
251
255
|
updatedData: props.data,
|
|
252
256
|
editType: 'updateTentativeFeature',
|
|
253
257
|
editContext: {
|
|
254
|
-
feature: tentativeFeature
|
|
255
|
-
}
|
|
258
|
+
feature: tentativeFeature
|
|
259
|
+
}
|
|
256
260
|
});
|
|
257
261
|
}
|
|
258
262
|
}
|
|
@@ -267,7 +271,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
267
271
|
// Because the new drawing feature is dropped, so the data will keep as the same.
|
|
268
272
|
updatedData: props.data,
|
|
269
273
|
editType: 'cancelFeature',
|
|
270
|
-
editContext: {}
|
|
274
|
+
editContext: {}
|
|
271
275
|
});
|
|
272
276
|
}
|
|
273
277
|
}
|
|
@@ -276,7 +280,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
276
280
|
export function getIntermediatePosition(position1: Position, position2: Position): Position {
|
|
277
281
|
const intermediatePosition: Position = [
|
|
278
282
|
(position1[0] + position2[0]) / 2.0,
|
|
279
|
-
(position1[1] + position2[1]) / 2.0
|
|
283
|
+
(position1[1] + position2[1]) / 2.0
|
|
280
284
|
];
|
|
281
285
|
|
|
282
286
|
return intermediatePosition;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Feature,
|
|
3
7
|
FeatureCollection,
|
|
@@ -6,8 +10,8 @@ import {
|
|
|
6
10
|
MultiLineString,
|
|
7
11
|
MultiPolygon,
|
|
8
12
|
Position,
|
|
9
|
-
PolygonCoordinates
|
|
10
|
-
} from '../geojson-types';
|
|
13
|
+
PolygonCoordinates
|
|
14
|
+
} from '../utils/geojson-types';
|
|
11
15
|
|
|
12
16
|
export class ImmutableFeatureCollection {
|
|
13
17
|
featureCollection: FeatureCollection;
|
|
@@ -45,7 +49,7 @@ export class ImmutableFeatureCollection {
|
|
|
45
49
|
positionIndexes,
|
|
46
50
|
updatedPosition,
|
|
47
51
|
isPolygonal
|
|
48
|
-
)
|
|
52
|
+
)
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
return this.replaceGeometry(featureIndex, updatedGeometry);
|
|
@@ -59,7 +63,9 @@ export class ImmutableFeatureCollection {
|
|
|
59
63
|
* @param positionIndexes An array containing the indexes of the postion to remove
|
|
60
64
|
*
|
|
61
65
|
* @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.
|
|
66
|
+
*
|
|
62
67
|
*/
|
|
68
|
+
// eslint-disable-next-line complexity
|
|
63
69
|
removePosition(
|
|
64
70
|
featureIndex: number,
|
|
65
71
|
positionIndexes: number[] | null | undefined
|
|
@@ -67,19 +73,19 @@ export class ImmutableFeatureCollection {
|
|
|
67
73
|
const geometry = this.featureCollection.features[featureIndex].geometry;
|
|
68
74
|
|
|
69
75
|
if (geometry.type === 'Point') {
|
|
70
|
-
throw Error(
|
|
76
|
+
throw Error("Can't remove a position from a Point or there'd be nothing left");
|
|
71
77
|
}
|
|
72
78
|
if (
|
|
73
79
|
geometry.type === 'MultiPoint' && // only 1 point left
|
|
74
80
|
geometry.coordinates.length < 2
|
|
75
81
|
) {
|
|
76
|
-
throw Error(
|
|
82
|
+
throw Error("Can't remove the last point of a MultiPoint or there'd be nothing left");
|
|
77
83
|
}
|
|
78
84
|
if (
|
|
79
85
|
geometry.type === 'LineString' && // only 2 positions
|
|
80
86
|
geometry.coordinates.length < 3
|
|
81
87
|
) {
|
|
82
|
-
throw Error(
|
|
88
|
+
throw Error("Can't remove position. LineString must have at least two positions");
|
|
83
89
|
}
|
|
84
90
|
if (
|
|
85
91
|
geometry.type === 'Polygon' && // outer ring is a triangle
|
|
@@ -87,14 +93,14 @@ export class ImmutableFeatureCollection {
|
|
|
87
93
|
Array.isArray(positionIndexes) && // trying to remove from outer ring
|
|
88
94
|
positionIndexes[0] === 0
|
|
89
95
|
) {
|
|
90
|
-
throw Error(
|
|
96
|
+
throw Error("Can't remove position. Polygon's outer ring must have at least four positions");
|
|
91
97
|
}
|
|
92
98
|
if (
|
|
93
99
|
geometry.type === 'MultiLineString' && // only 1 LineString left
|
|
94
100
|
geometry.coordinates.length === 1 && // only 2 positions
|
|
95
101
|
geometry.coordinates[0].length < 3
|
|
96
102
|
) {
|
|
97
|
-
throw Error(
|
|
103
|
+
throw Error("Can't remove position. MultiLineString must have at least two positions");
|
|
98
104
|
}
|
|
99
105
|
if (
|
|
100
106
|
geometry.type === 'MultiPolygon' && // only 1 polygon left
|
|
@@ -105,14 +111,14 @@ export class ImmutableFeatureCollection {
|
|
|
105
111
|
positionIndexes[1] === 0
|
|
106
112
|
) {
|
|
107
113
|
throw Error(
|
|
108
|
-
|
|
114
|
+
"Can't remove position. MultiPolygon's outer ring must have at least four positions"
|
|
109
115
|
);
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
|
|
113
119
|
const updatedGeometry: any = {
|
|
114
120
|
...geometry,
|
|
115
|
-
coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)
|
|
121
|
+
coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)
|
|
116
122
|
};
|
|
117
123
|
|
|
118
124
|
// Handle cases where incomplete geometries need pruned (e.g. holes that were triangles)
|
|
@@ -150,7 +156,7 @@ export class ImmutableFeatureCollection {
|
|
|
150
156
|
positionIndexes,
|
|
151
157
|
positionToAdd,
|
|
152
158
|
isPolygonal
|
|
153
|
-
)
|
|
159
|
+
)
|
|
154
160
|
};
|
|
155
161
|
|
|
156
162
|
return this.replaceGeometry(featureIndex, updatedGeometry);
|
|
@@ -159,7 +165,7 @@ export class ImmutableFeatureCollection {
|
|
|
159
165
|
replaceGeometry(featureIndex: number, geometry: Geometry): ImmutableFeatureCollection {
|
|
160
166
|
const updatedFeature: any = {
|
|
161
167
|
...this.featureCollection.features[featureIndex],
|
|
162
|
-
geometry
|
|
168
|
+
geometry
|
|
163
169
|
};
|
|
164
170
|
|
|
165
171
|
const updatedFeatureCollection = {
|
|
@@ -167,8 +173,8 @@ export class ImmutableFeatureCollection {
|
|
|
167
173
|
features: [
|
|
168
174
|
...this.featureCollection.features.slice(0, featureIndex),
|
|
169
175
|
updatedFeature,
|
|
170
|
-
...this.featureCollection.features.slice(featureIndex + 1)
|
|
171
|
-
]
|
|
176
|
+
...this.featureCollection.features.slice(featureIndex + 1)
|
|
177
|
+
]
|
|
172
178
|
};
|
|
173
179
|
|
|
174
180
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
@@ -181,7 +187,7 @@ export class ImmutableFeatureCollection {
|
|
|
181
187
|
addFeatures(features: Feature[]): ImmutableFeatureCollection {
|
|
182
188
|
const updatedFeatureCollection = {
|
|
183
189
|
...this.featureCollection,
|
|
184
|
-
features: [...this.featureCollection.features, ...features]
|
|
190
|
+
features: [...this.featureCollection.features, ...features]
|
|
185
191
|
};
|
|
186
192
|
|
|
187
193
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
@@ -203,7 +209,7 @@ export class ImmutableFeatureCollection {
|
|
|
203
209
|
|
|
204
210
|
const updatedFeatureCollection = {
|
|
205
211
|
...this.featureCollection,
|
|
206
|
-
features
|
|
212
|
+
features
|
|
207
213
|
};
|
|
208
214
|
|
|
209
215
|
return new ImmutableFeatureCollection(updatedFeatureCollection);
|
|
@@ -237,7 +243,7 @@ function immutablyReplacePosition(
|
|
|
237
243
|
const updated = [
|
|
238
244
|
...coordinates.slice(0, positionIndexes[0]),
|
|
239
245
|
getUpdatedPosition(updatedPosition, coordinates[positionIndexes[0]]),
|
|
240
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
246
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
241
247
|
];
|
|
242
248
|
|
|
243
249
|
if (
|
|
@@ -261,7 +267,7 @@ function immutablyReplacePosition(
|
|
|
261
267
|
updatedPosition,
|
|
262
268
|
isPolygonal
|
|
263
269
|
),
|
|
264
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
270
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
265
271
|
];
|
|
266
272
|
}
|
|
267
273
|
|
|
@@ -279,7 +285,7 @@ function immutablyRemovePosition(
|
|
|
279
285
|
if (positionIndexes.length === 1) {
|
|
280
286
|
const updated = [
|
|
281
287
|
...coordinates.slice(0, positionIndexes[0]),
|
|
282
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
288
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
283
289
|
];
|
|
284
290
|
|
|
285
291
|
if (
|
|
@@ -307,7 +313,7 @@ function immutablyRemovePosition(
|
|
|
307
313
|
positionIndexes.slice(1, positionIndexes.length),
|
|
308
314
|
isPolygonal
|
|
309
315
|
),
|
|
310
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
316
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
311
317
|
];
|
|
312
318
|
}
|
|
313
319
|
|
|
@@ -327,7 +333,7 @@ function immutablyAddPosition(
|
|
|
327
333
|
const updated = [
|
|
328
334
|
...coordinates.slice(0, positionIndexes[0]),
|
|
329
335
|
positionToAdd,
|
|
330
|
-
...coordinates.slice(positionIndexes[0])
|
|
336
|
+
...coordinates.slice(positionIndexes[0])
|
|
331
337
|
];
|
|
332
338
|
return updated;
|
|
333
339
|
}
|
|
@@ -341,7 +347,7 @@ function immutablyAddPosition(
|
|
|
341
347
|
positionToAdd,
|
|
342
348
|
isPolygonal
|
|
343
349
|
),
|
|
344
|
-
...coordinates.slice(positionIndexes[0] + 1)
|
|
350
|
+
...coordinates.slice(positionIndexes[0] + 1)
|
|
345
351
|
];
|
|
346
352
|
}
|
|
347
353
|
|