@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,8 +1,12 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import circle from '@turf/circle';
|
|
2
6
|
import distance from '@turf/distance';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
8
|
+
import {EditAction, getIntermediatePosition} from './mode-handler';
|
|
9
|
+
import {TwoClickPolygonHandler} from './two-click-polygon-handler';
|
|
6
10
|
|
|
7
11
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
8
12
|
export class DrawCircleByBoundingBoxHandler extends TwoClickPolygonHandler {
|
|
@@ -10,7 +14,7 @@ export class DrawCircleByBoundingBoxHandler extends TwoClickPolygonHandler {
|
|
|
10
14
|
editAction: EditAction | null | undefined;
|
|
11
15
|
cancelMapPan: boolean;
|
|
12
16
|
} {
|
|
13
|
-
const result = {
|
|
17
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
14
18
|
const clickSequence = this.getClickSequence();
|
|
15
19
|
|
|
16
20
|
if (clickSequence.length === 0) {
|
|
@@ -20,8 +24,8 @@ export class DrawCircleByBoundingBoxHandler extends TwoClickPolygonHandler {
|
|
|
20
24
|
|
|
21
25
|
const modeConfig = this.getModeConfig() || {};
|
|
22
26
|
// Default turf value for circle is 64
|
|
23
|
-
const {
|
|
24
|
-
const options = {
|
|
27
|
+
const {steps = 64} = modeConfig;
|
|
28
|
+
const options = {steps};
|
|
25
29
|
|
|
26
30
|
if (steps < 4) {
|
|
27
31
|
console.warn('Minimum steps to draw a circle is 4 '); // eslint-disable-line no-console,no-undef
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import circle from '@turf/circle';
|
|
2
6
|
import distance from '@turf/distance';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
8
|
+
import {EditAction} from './mode-handler';
|
|
9
|
+
import {TwoClickPolygonHandler} from './two-click-polygon-handler';
|
|
6
10
|
|
|
7
11
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
8
12
|
export class DrawCircleFromCenterHandler extends TwoClickPolygonHandler {
|
|
@@ -10,7 +14,7 @@ export class DrawCircleFromCenterHandler extends TwoClickPolygonHandler {
|
|
|
10
14
|
editAction: EditAction | null | undefined;
|
|
11
15
|
cancelMapPan: boolean;
|
|
12
16
|
} {
|
|
13
|
-
const result = {
|
|
17
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
14
18
|
const clickSequence = this.getClickSequence();
|
|
15
19
|
|
|
16
20
|
if (clickSequence.length === 0) {
|
|
@@ -20,8 +24,8 @@ export class DrawCircleFromCenterHandler extends TwoClickPolygonHandler {
|
|
|
20
24
|
|
|
21
25
|
const modeConfig = this.getModeConfig() || {};
|
|
22
26
|
// Default turf value for circle is 64
|
|
23
|
-
const {
|
|
24
|
-
const options = {
|
|
27
|
+
const {steps = 64} = modeConfig;
|
|
28
|
+
const options = {steps};
|
|
25
29
|
|
|
26
30
|
if (steps < 4) {
|
|
27
31
|
console.warn('Minimum steps to draw a circle is 4 '); // eslint-disable-line no-console,no-undef
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import bboxPolygon from '@turf/bbox-polygon';
|
|
2
6
|
import distance from '@turf/distance';
|
|
3
7
|
import ellipse from '@turf/ellipse';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import {point} from '@turf/helpers';
|
|
9
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
10
|
+
import {EditAction, getIntermediatePosition} from './mode-handler';
|
|
11
|
+
import {TwoClickPolygonHandler} from './two-click-polygon-handler';
|
|
8
12
|
|
|
9
13
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
10
14
|
export class DrawEllipseByBoundingBoxHandler extends TwoClickPolygonHandler {
|
|
@@ -12,7 +16,7 @@ export class DrawEllipseByBoundingBoxHandler extends TwoClickPolygonHandler {
|
|
|
12
16
|
editAction: EditAction | null | undefined;
|
|
13
17
|
cancelMapPan: boolean;
|
|
14
18
|
} {
|
|
15
|
-
const result = {
|
|
19
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
16
20
|
const clickSequence = this.getClickSequence();
|
|
17
21
|
|
|
18
22
|
if (clickSequence.length === 0) {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import distance from '@turf/distance';
|
|
2
6
|
import ellipse from '@turf/ellipse';
|
|
3
7
|
import bearing from '@turf/bearing';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import {point} from '@turf/helpers';
|
|
9
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
10
|
+
import {EditAction, getIntermediatePosition} from './mode-handler';
|
|
11
|
+
import {ThreeClickPolygonHandler} from './three-click-polygon-handler';
|
|
8
12
|
|
|
9
13
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
10
14
|
export class DrawEllipseUsingThreePointsHandler extends ThreeClickPolygonHandler {
|
|
@@ -12,7 +16,7 @@ export class DrawEllipseUsingThreePointsHandler extends ThreeClickPolygonHandler
|
|
|
12
16
|
editAction: EditAction | null | undefined;
|
|
13
17
|
cancelMapPan: boolean;
|
|
14
18
|
} {
|
|
15
|
-
const result = {
|
|
19
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
16
20
|
const clickSequence = this.getClickSequence();
|
|
17
21
|
|
|
18
22
|
if (clickSequence.length === 0) {
|
|
@@ -27,8 +31,8 @@ export class DrawEllipseUsingThreePointsHandler extends ThreeClickPolygonHandler
|
|
|
27
31
|
type: 'Feature',
|
|
28
32
|
geometry: {
|
|
29
33
|
type: 'LineString',
|
|
30
|
-
coordinates: [clickSequence[0], mapCoords]
|
|
31
|
-
}
|
|
34
|
+
coordinates: [clickSequence[0], mapCoords]
|
|
35
|
+
}
|
|
32
36
|
});
|
|
33
37
|
} else if (clickSequence.length === 2) {
|
|
34
38
|
const [p1, p2] = clickSequence;
|
|
@@ -36,7 +40,7 @@ export class DrawEllipseUsingThreePointsHandler extends ThreeClickPolygonHandler
|
|
|
36
40
|
const centerCoordinates = getIntermediatePosition(p1, p2);
|
|
37
41
|
const xSemiAxis = Math.max(distance(centerCoordinates, point(mapCoords)), 0.001);
|
|
38
42
|
const ySemiAxis = Math.max(distance(p1, p2), 0.001) / 2;
|
|
39
|
-
const options = {
|
|
43
|
+
const options = {angle: bearing(p1, p2)};
|
|
40
44
|
// @ts-expect-error turf types diff
|
|
41
45
|
this._setTentativeFeature(ellipse(centerCoordinates, xSemiAxis, ySemiAxis, options));
|
|
42
46
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Position, LineString} from '../utils/geojson-types';
|
|
6
|
+
import {ClickEvent, PointerMoveEvent} from '../edit-modes/types';
|
|
7
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
4
8
|
|
|
5
9
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
6
10
|
export class DrawLineStringHandler extends ModeHandler {
|
|
@@ -43,8 +47,8 @@ export class DrawLineStringHandler extends ModeHandler {
|
|
|
43
47
|
featureIndexes: [featureIndex],
|
|
44
48
|
editContext: {
|
|
45
49
|
positionIndexes,
|
|
46
|
-
position: event.mapCoords
|
|
47
|
-
}
|
|
50
|
+
position: event.mapCoords
|
|
51
|
+
}
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
this.resetClickSequence();
|
|
@@ -63,7 +67,7 @@ export class DrawLineStringHandler extends ModeHandler {
|
|
|
63
67
|
editAction: EditAction | null | undefined;
|
|
64
68
|
cancelMapPan: boolean;
|
|
65
69
|
} {
|
|
66
|
-
const result = {
|
|
70
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
67
71
|
|
|
68
72
|
const clickSequence = this.getClickSequence();
|
|
69
73
|
const mapCoords = event.mapCoords;
|
|
@@ -98,8 +102,8 @@ export class DrawLineStringHandler extends ModeHandler {
|
|
|
98
102
|
properties: {},
|
|
99
103
|
geometry: {
|
|
100
104
|
type: 'LineString',
|
|
101
|
-
coordinates: [startPosition, mapCoords]
|
|
102
|
-
}
|
|
105
|
+
coordinates: [startPosition, mapCoords]
|
|
106
|
+
}
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Geometry} from '../utils/geojson-types';
|
|
6
|
+
import {ClickEvent} from '../edit-modes/types';
|
|
7
|
+
import {EditAction, ModeHandler} from './mode-handler';
|
|
4
8
|
|
|
5
9
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
6
10
|
export class DrawPointHandler extends ModeHandler {
|
|
7
|
-
handleClick({
|
|
11
|
+
handleClick({mapCoords}: ClickEvent): EditAction | null | undefined {
|
|
8
12
|
const geometry: Geometry = {
|
|
9
13
|
type: 'Point',
|
|
10
|
-
coordinates: mapCoords
|
|
14
|
+
coordinates: mapCoords
|
|
11
15
|
};
|
|
12
16
|
|
|
13
17
|
return this.getAddFeatureAction(geometry);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Polygon, Position} from '../utils/geojson-types';
|
|
6
|
+
import {ClickEvent, PointerMoveEvent} from '../edit-modes/types';
|
|
3
7
|
import {
|
|
4
8
|
EditAction,
|
|
5
9
|
EditHandle,
|
|
6
10
|
ModeHandler,
|
|
7
11
|
getPickedEditHandle,
|
|
8
|
-
getEditHandlesForGeometry
|
|
12
|
+
getEditHandlesForGeometry
|
|
9
13
|
} from './mode-handler';
|
|
10
14
|
|
|
11
15
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
@@ -31,7 +35,7 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
31
35
|
handleClick(event: ClickEvent): EditAction | null | undefined {
|
|
32
36
|
super.handleClick(event);
|
|
33
37
|
|
|
34
|
-
const {
|
|
38
|
+
const {picks} = event;
|
|
35
39
|
const tentativeFeature = this.getTentativeFeature();
|
|
36
40
|
|
|
37
41
|
let editAction: EditAction | null | undefined = null;
|
|
@@ -58,7 +62,7 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
58
62
|
// Remove the hovered position
|
|
59
63
|
const polygonToAdd: Polygon = {
|
|
60
64
|
type: 'Polygon',
|
|
61
|
-
coordinates: [[...polygon.coordinates[0].slice(0, -2), polygon.coordinates[0][0]]]
|
|
65
|
+
coordinates: [[...polygon.coordinates[0].slice(0, -2), polygon.coordinates[0][0]]]
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
this.resetClickSequence();
|
|
@@ -76,7 +80,7 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
76
80
|
pointerDownPicks: null,
|
|
77
81
|
pointerDownScreenCoords: null,
|
|
78
82
|
pointerDownMapCoords: null,
|
|
79
|
-
sourceEvent: null
|
|
83
|
+
sourceEvent: null
|
|
80
84
|
} as unknown as PointerMoveEvent;
|
|
81
85
|
|
|
82
86
|
this.handlePointerMove(fakePointerMoveEvent);
|
|
@@ -84,12 +88,12 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
84
88
|
return editAction;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
handlePointerMove({
|
|
91
|
+
handlePointerMove({mapCoords}: PointerMoveEvent): {
|
|
88
92
|
editAction: EditAction | null | undefined;
|
|
89
93
|
cancelMapPan: boolean;
|
|
90
94
|
} {
|
|
91
95
|
const clickSequence = this.getClickSequence();
|
|
92
|
-
const result = {
|
|
96
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
93
97
|
|
|
94
98
|
if (clickSequence.length === 0) {
|
|
95
99
|
// nothing to do yet
|
|
@@ -102,8 +106,8 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
102
106
|
type: 'Feature',
|
|
103
107
|
geometry: {
|
|
104
108
|
type: 'LineString',
|
|
105
|
-
coordinates: [...clickSequence, mapCoords]
|
|
106
|
-
}
|
|
109
|
+
coordinates: [...clickSequence, mapCoords]
|
|
110
|
+
}
|
|
107
111
|
});
|
|
108
112
|
} else {
|
|
109
113
|
// Draw a Polygon connecting all the clicked points with the hovered point
|
|
@@ -111,8 +115,8 @@ export class DrawPolygonHandler extends ModeHandler {
|
|
|
111
115
|
type: 'Feature',
|
|
112
116
|
geometry: {
|
|
113
117
|
type: 'Polygon',
|
|
114
|
-
coordinates: [[...clickSequence, mapCoords, clickSequence[0]]]
|
|
115
|
-
}
|
|
118
|
+
coordinates: [[...clickSequence, mapCoords, clickSequence[0]]]
|
|
119
|
+
}
|
|
116
120
|
});
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import bboxPolygon from '@turf/bbox-polygon';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
6
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
7
|
+
import {EditAction} from './mode-handler';
|
|
8
|
+
import {TwoClickPolygonHandler} from './two-click-polygon-handler';
|
|
5
9
|
|
|
6
10
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
7
11
|
export class DrawRectangleHandler extends TwoClickPolygonHandler {
|
|
@@ -9,7 +13,7 @@ export class DrawRectangleHandler extends TwoClickPolygonHandler {
|
|
|
9
13
|
editAction: EditAction | null | undefined;
|
|
10
14
|
cancelMapPan: boolean;
|
|
11
15
|
} {
|
|
12
|
-
const result = {
|
|
16
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
13
17
|
const clickSequence = this.getClickSequence();
|
|
14
18
|
|
|
15
19
|
if (clickSequence.length === 0) {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {LineString} from '../utils/geojson-types';
|
|
6
|
+
import {generatePointsParallelToLinePoints} from '../utils/utils';
|
|
7
|
+
import {PointerMoveEvent} from '../edit-modes/types';
|
|
8
|
+
import {EditAction} from './mode-handler';
|
|
9
|
+
import {ThreeClickPolygonHandler} from './three-click-polygon-handler';
|
|
6
10
|
|
|
7
11
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
8
12
|
export class DrawRectangleUsingThreePointsHandler extends ThreeClickPolygonHandler {
|
|
@@ -10,7 +14,7 @@ export class DrawRectangleUsingThreePointsHandler extends ThreeClickPolygonHandl
|
|
|
10
14
|
editAction: EditAction | null | undefined;
|
|
11
15
|
cancelMapPan: boolean;
|
|
12
16
|
} {
|
|
13
|
-
const result = {
|
|
17
|
+
const result = {editAction: null, cancelMapPan: false};
|
|
14
18
|
const clickSequence = this.getClickSequence();
|
|
15
19
|
|
|
16
20
|
if (clickSequence.length === 0) {
|
|
@@ -25,13 +29,13 @@ export class DrawRectangleUsingThreePointsHandler extends ThreeClickPolygonHandl
|
|
|
25
29
|
type: 'Feature',
|
|
26
30
|
geometry: {
|
|
27
31
|
type: 'LineString',
|
|
28
|
-
coordinates: [clickSequence[0], mapCoords]
|
|
29
|
-
}
|
|
32
|
+
coordinates: [clickSequence[0], mapCoords]
|
|
33
|
+
}
|
|
30
34
|
});
|
|
31
35
|
} else if (clickSequence.length === 2) {
|
|
32
36
|
const lineString: LineString = {
|
|
33
37
|
type: 'LineString',
|
|
34
|
-
coordinates: clickSequence
|
|
38
|
+
coordinates: clickSequence
|
|
35
39
|
};
|
|
36
40
|
const [p1, p2] = clickSequence;
|
|
37
41
|
const [p3, p4] = generatePointsParallelToLinePoints(p1, p2, mapCoords);
|
|
@@ -48,10 +52,10 @@ export class DrawRectangleUsingThreePointsHandler extends ThreeClickPolygonHandl
|
|
|
48
52
|
...lineString.coordinates,
|
|
49
53
|
p3,
|
|
50
54
|
p4,
|
|
51
|
-
p1
|
|
52
|
-
]
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
+
p1
|
|
56
|
+
]
|
|
57
|
+
]
|
|
58
|
+
}
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {StartDraggingEvent} from '../edit-modes/types';
|
|
6
|
+
import {EditAction} from './mode-handler';
|
|
7
|
+
import {TranslateHandler} from './translate-handler';
|
|
4
8
|
|
|
5
9
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
6
10
|
export class DuplicateHandler extends TranslateHandler {
|
|
@@ -16,7 +20,7 @@ export class DuplicateHandler extends TranslateHandler {
|
|
|
16
20
|
: null;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
getCursor({
|
|
23
|
+
getCursor({isDragging}: {isDragging: boolean}): string {
|
|
20
24
|
if (this._isTranslatable) {
|
|
21
25
|
return 'copy';
|
|
22
26
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {Position} from '../utils/geojson-types';
|
|
6
|
+
import {PointerMoveEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
7
|
+
import {EditAction, getPickedEditHandle} from './mode-handler';
|
|
8
|
+
|
|
9
|
+
import {ModifyHandler} from './modify-handler';
|
|
6
10
|
|
|
7
11
|
function defaultCalculateElevationChange({
|
|
8
12
|
pointerDownScreenCoords,
|
|
9
|
-
screenCoords
|
|
13
|
+
screenCoords
|
|
10
14
|
}: {
|
|
11
15
|
pointerDownScreenCoords: Position;
|
|
12
16
|
screenCoords: Position;
|
|
@@ -27,7 +31,7 @@ export class ElevationHandler extends ModifyHandler {
|
|
|
27
31
|
const {
|
|
28
32
|
minElevation = 0,
|
|
29
33
|
maxElevation = 20000,
|
|
30
|
-
calculateElevationChange = defaultCalculateElevationChange
|
|
34
|
+
calculateElevationChange = defaultCalculateElevationChange
|
|
31
35
|
} = this._modeConfig || {};
|
|
32
36
|
|
|
33
37
|
// $FlowFixMe - really, I know it has something at index 2
|
|
@@ -36,13 +40,13 @@ export class ElevationHandler extends ModifyHandler {
|
|
|
36
40
|
// calculateElevationChange is configurable becase (at this time) modes are not aware of the viewport
|
|
37
41
|
elevation += calculateElevationChange({
|
|
38
42
|
pointerDownScreenCoords: event.pointerDownScreenCoords,
|
|
39
|
-
screenCoords: event.screenCoords
|
|
43
|
+
screenCoords: event.screenCoords
|
|
40
44
|
});
|
|
41
45
|
elevation = Math.min(elevation, maxElevation);
|
|
42
46
|
elevation = Math.max(elevation, minElevation);
|
|
43
47
|
|
|
44
48
|
return Object.assign({}, event, {
|
|
45
|
-
mapCoords: [position[0], position[1], elevation]
|
|
49
|
+
mapCoords: [position[0], position[1], elevation]
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -61,7 +65,7 @@ export class ElevationHandler extends ModifyHandler {
|
|
|
61
65
|
return super.handleStopDragging(this.makeElevatedEvent(event, position));
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
getCursor(params: {
|
|
68
|
+
getCursor(params: {isDragging: boolean}): string {
|
|
65
69
|
let cursor = super.getCursor(params);
|
|
66
70
|
if (cursor === 'cell') {
|
|
67
71
|
cursor = 'ns-resize';
|
|
@@ -73,7 +77,7 @@ export class ElevationHandler extends ModifyHandler {
|
|
|
73
77
|
viewport: any,
|
|
74
78
|
{
|
|
75
79
|
pointerDownScreenCoords,
|
|
76
|
-
screenCoords
|
|
80
|
+
screenCoords
|
|
77
81
|
}: {
|
|
78
82
|
pointerDownScreenCoords: Position;
|
|
79
83
|
screenCoords: Position;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import bearing from '@turf/bearing';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
6
|
+
import {generatePointsParallelToLinePoints} from '../utils/utils';
|
|
7
|
+
import {PointerMoveEvent, StartDraggingEvent, StopDraggingEvent} from '../edit-modes/types';
|
|
8
|
+
import {EditAction, getPickedEditHandle} from './mode-handler';
|
|
5
9
|
|
|
6
|
-
import {
|
|
10
|
+
import {ModifyHandler} from './modify-handler';
|
|
7
11
|
|
|
8
12
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
9
13
|
export class ExtrudeHandler extends ModifyHandler {
|
|
@@ -48,8 +52,8 @@ export class ExtrudeHandler extends ModifyHandler {
|
|
|
48
52
|
featureIndexes: [editHandle.featureIndex],
|
|
49
53
|
editContext: {
|
|
50
54
|
positionIndexes: this.nextPositionIndexes(editHandle.positionIndexes, size),
|
|
51
|
-
position: p3
|
|
52
|
-
}
|
|
55
|
+
position: p3
|
|
56
|
+
}
|
|
53
57
|
};
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -57,7 +61,7 @@ export class ExtrudeHandler extends ModifyHandler {
|
|
|
57
61
|
// Cancel map panning if pointer went down on an edit handle
|
|
58
62
|
const cancelMapPan = Boolean(editHandle);
|
|
59
63
|
|
|
60
|
-
return {
|
|
64
|
+
return {editAction, cancelMapPan};
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
handleStartDragging(event: StartDraggingEvent): EditAction | null | undefined {
|
|
@@ -108,8 +112,8 @@ export class ExtrudeHandler extends ModifyHandler {
|
|
|
108
112
|
featureIndexes: [editHandle.featureIndex],
|
|
109
113
|
editContext: {
|
|
110
114
|
positionIndexes: editHandle.positionIndexes,
|
|
111
|
-
position: p1
|
|
112
|
-
}
|
|
115
|
+
position: p1
|
|
116
|
+
}
|
|
113
117
|
};
|
|
114
118
|
}
|
|
115
119
|
}
|
|
@@ -153,8 +157,8 @@ export class ExtrudeHandler extends ModifyHandler {
|
|
|
153
157
|
featureIndexes: [editHandle.featureIndex],
|
|
154
158
|
editContext: {
|
|
155
159
|
positionIndexes: editHandle.positionIndexes,
|
|
156
|
-
position: p3
|
|
157
|
-
}
|
|
160
|
+
position: p3
|
|
161
|
+
}
|
|
158
162
|
};
|
|
159
163
|
}
|
|
160
164
|
}
|