@deck.gl-community/editable-layers 9.0.2 → 9.1.0-beta.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/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -0
- 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 +1 -1
- package/dist/edit-modes/delete-mode.d.ts +7 -0
- package/dist/edit-modes/delete-mode.d.ts.map +1 -0
- package/dist/edit-modes/delete-mode.js +22 -0
- 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 +2 -2
- 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 +7 -3
- 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 +6 -2
- 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 +11 -3
- 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 +12 -3
- 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 +3 -3
- 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 +1 -1
- 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 +2 -2
- 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 +2 -2
- 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 +1 -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 +1 -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 +2 -2
- 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 +1 -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 +1 -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 +1 -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/elevation-mode.d.ts +4 -3
- package/dist/edit-modes/elevation-mode.d.ts.map +1 -0
- package/dist/edit-modes/elevation-mode.js +2 -2
- 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 +5 -2
- 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 +6 -3
- package/dist/edit-modes/geojson-edit-mode.d.ts +6 -5
- package/dist/edit-modes/geojson-edit-mode.d.ts.map +1 -0
- package/dist/edit-modes/geojson-edit-mode.js +9 -6
- package/dist/edit-modes/immutable-feature-collection.d.ts +2 -1
- package/dist/edit-modes/immutable-feature-collection.d.ts.map +1 -0
- 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 +2 -2
- 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 +1 -1
- 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 +2 -2
- 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 +6 -3
- 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 +4 -3
- 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 +5 -4
- 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 +5 -4
- 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 +2 -2
- 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 +3 -3
- 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 +4 -2
- 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 +7 -4
- 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 +6 -5
- 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 +4 -5
- package/dist/edit-modes/types.d.ts +3 -1
- package/dist/edit-modes/types.d.ts.map +1 -0
- package/dist/edit-modes/utils.d.ts +5 -3
- package/dist/edit-modes/utils.d.ts.map +1 -0
- package/dist/edit-modes/utils.js +5 -1
- 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 +1 -1
- package/dist/editable-layers/editable-geojson-layer.d.ts +10 -9
- package/dist/editable-layers/editable-geojson-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-geojson-layer.js +30 -28
- 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 +4 -5
- package/dist/editable-layers/editable-layer.d.ts +7 -4
- package/dist/editable-layers/editable-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-layer.js +8 -4
- package/dist/editable-layers/editable-path-layer.d.ts +14 -1
- package/dist/editable-layers/editable-path-layer.d.ts.map +1 -0
- package/dist/editable-layers/editable-path-layer.js +21 -13
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts +1 -0
- package/dist/editable-layers/elevated-edit-handle-layer.d.ts.map +1 -0
- package/dist/editable-layers/junction-scatterplot-layer.d.ts +6 -3
- package/dist/editable-layers/junction-scatterplot-layer.d.ts.map +1 -0
- package/dist/editable-layers/selection-layer.d.ts +3 -1
- package/dist/editable-layers/selection-layer.d.ts.map +1 -0
- package/dist/editable-layers/selection-layer.js +4 -5
- package/dist/index.cjs +127 -45
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +60 -58
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -52
- package/dist/lib/constants.d.ts +1 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/deck-renderer/deck-cache.d.ts +1 -0
- package/dist/lib/deck-renderer/deck-cache.d.ts.map +1 -0
- package/dist/lib/deck-renderer/deck-drawer.d.ts +2 -1
- package/dist/lib/deck-renderer/deck-drawer.d.ts.map +1 -0
- package/dist/lib/feature.d.ts +3 -2
- package/dist/lib/feature.d.ts.map +1 -0
- package/dist/lib/layer-mouse-event.d.ts +2 -1
- package/dist/lib/layer-mouse-event.d.ts.map +1 -0
- package/dist/lib/layers/junctions-layer.d.ts +4 -3
- package/dist/lib/layers/junctions-layer.d.ts.map +1 -0
- package/dist/lib/layers/junctions-layer.js +4 -4
- package/dist/lib/layers/segments-layer.d.ts +3 -2
- package/dist/lib/layers/segments-layer.d.ts.map +1 -0
- package/dist/lib/layers/segments-layer.js +4 -4
- package/dist/lib/layers/texts-layer.d.ts +3 -2
- package/dist/lib/layers/texts-layer.d.ts.map +1 -0
- package/dist/lib/layers/texts-layer.js +4 -4
- package/dist/lib/math.d.ts +2 -1
- package/dist/lib/math.d.ts.map +1 -0
- package/dist/lib/nebula-core.d.ts +2 -1
- package/dist/lib/nebula-core.d.ts.map +1 -0
- package/dist/lib/nebula-core.js +3 -3
- package/dist/lib/nebula-layer.d.ts +2 -1
- package/dist/lib/nebula-layer.d.ts.map +1 -0
- package/dist/lib/style.d.ts +1 -0
- package/dist/lib/style.d.ts.map +1 -0
- 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 +2 -2
- 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 +2 -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 +1 -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 +2 -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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -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 +2 -2
- 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 +1 -1
- package/dist/mode-handlers/elevation-handler.d.ts +5 -4
- package/dist/mode-handlers/elevation-handler.d.ts.map +1 -0
- package/dist/mode-handlers/elevation-handler.js +2 -2
- 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 +3 -3
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -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 +1 -1
- 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 +1 -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 +1 -1
- package/dist/shaderlib/color/color.d.ts +13 -2
- package/dist/shaderlib/color/color.d.ts.map +1 -0
- package/dist/shaderlib/color/color.js +25 -18
- package/dist/shaderlib/utils/utils.d.ts +1 -0
- package/dist/shaderlib/utils/utils.d.ts.map +1 -0
- package/dist/utils/curve-utils.d.ts +1 -0
- package/dist/utils/curve-utils.d.ts.map +1 -0
- package/dist/utils/geojson-types.d.ts +1 -0
- package/dist/utils/geojson-types.d.ts.map +1 -0
- package/dist/utils/memoize.d.ts +1 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/translate-from-center.d.ts +1 -0
- package/dist/utils/translate-from-center.d.ts.map +1 -0
- package/dist/utils/translate-from-center.js +4 -4
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +5 -4
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +4 -4
- package/package.json +11 -10
- package/src/edit-modes/delete-mode.ts +28 -0
- package/src/edit-modes/draw-circle-by-diameter-mode.ts +4 -0
- package/src/edit-modes/draw-circle-from-center-mode.ts +4 -0
- package/src/edit-modes/draw-ellipse-by-bounding-box-mode.ts +10 -1
- package/src/edit-modes/draw-ellipse-using-three-points-mode.ts +11 -1
- package/src/edit-modes/extend-line-string-mode.ts +4 -0
- package/src/edit-modes/extrude-mode.ts +6 -1
- package/src/edit-modes/geojson-edit-mode.ts +9 -4
- package/src/edit-modes/measure-distance-mode.ts +1 -1
- package/src/edit-modes/modify-mode.ts +6 -1
- package/src/edit-modes/resize-circle-mode.ts +1 -0
- package/src/edit-modes/rotate-mode.ts +2 -1
- package/src/edit-modes/scale-mode.ts +2 -1
- package/src/edit-modes/split-polygon-mode.ts +4 -2
- package/src/edit-modes/three-click-polygon-mode.ts +7 -1
- package/src/edit-modes/transform-mode.ts +4 -0
- package/src/edit-modes/translate-mode.ts +4 -2
- package/src/edit-modes/two-click-polygon-mode.ts +3 -4
- package/src/edit-modes/types.ts +1 -0
- package/src/edit-modes/utils.ts +10 -3
- package/src/editable-layers/editable-geojson-layer.ts +6 -4
- package/src/editable-layers/editable-h3-cluster-layer.ts +1 -1
- package/src/editable-layers/editable-layer.ts +12 -4
- package/src/editable-layers/editable-path-layer.ts +29 -15
- package/src/editable-layers/junction-scatterplot-layer.ts +4 -2
- package/src/editable-layers/selection-layer.ts +2 -1
- package/src/index.ts +2 -0
- package/src/mode-handlers/split-polygon-handler.ts +2 -1
- package/src/shaderlib/color/color.ts +34 -20
- package/src/utils/translate-from-center.ts +5 -5
- package/src/utils/utils.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FeatureCollection, Position } from
|
|
2
|
-
import { PointerMoveEvent, StartDraggingEvent, StopDraggingEvent } from
|
|
3
|
-
import { EditAction, ModeHandler } from
|
|
1
|
+
import { FeatureCollection, Position } from "../utils/geojson-types.js";
|
|
2
|
+
import { PointerMoveEvent, StartDraggingEvent, StopDraggingEvent } from "../edit-modes/types.js";
|
|
3
|
+
import { EditAction, ModeHandler } from "./mode-handler.js";
|
|
4
4
|
export declare class TranslateHandler extends ModeHandler {
|
|
5
5
|
_geometryBeforeTranslate: FeatureCollection | null | undefined;
|
|
6
6
|
_isTranslatable: boolean;
|
|
@@ -15,3 +15,4 @@ export declare class TranslateHandler extends ModeHandler {
|
|
|
15
15
|
}): string;
|
|
16
16
|
getTranslateAction(startDragPoint: Position, currentPoint: Position, editType: string): EditAction | null | undefined;
|
|
17
17
|
}
|
|
18
|
+
//# sourceMappingURL=translate-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate-handler.d.ts","sourceRoot":"","sources":["../../src/mode-handlers/translate-handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,iBAAiB,EAAE,QAAQ,EAAC,kCAA+B;AACnE,OAAO,EAAC,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAC,+BAA4B;AAC5F,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,0BAAuB;AAGvD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,wBAAwB,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/D,eAAe,EAAE,OAAO,CAAc;IAEtC,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG;QAC1C,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;QAC1C,YAAY,EAAE,OAAO,CAAC;KACvB;IAuBD,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS;IAS7E,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS;IAgB3E,SAAS,CAAC,EAAC,UAAU,EAAC,EAAE;QAAC,UAAU,EAAE,OAAO,CAAA;KAAC,GAAG,MAAM;IAOtD,kBAAkB,CAChB,cAAc,EAAE,QAAQ,EACxB,YAAY,EAAE,QAAQ,EACtB,QAAQ,EAAE,MAAM,GACf,UAAU,GAAG,IAAI,GAAG,SAAS;CAkCjC"}
|
|
@@ -5,7 +5,7 @@ import turfBearing from '@turf/bearing';
|
|
|
5
5
|
import turfDistance from '@turf/distance';
|
|
6
6
|
import turfTransformTranslate from '@turf/transform-translate';
|
|
7
7
|
import { point } from '@turf/helpers';
|
|
8
|
-
import { ModeHandler } from
|
|
8
|
+
import { ModeHandler } from "./mode-handler.js";
|
|
9
9
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
10
10
|
export class TranslateHandler extends ModeHandler {
|
|
11
11
|
_geometryBeforeTranslate;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ClickEvent } from
|
|
2
|
-
import { ModeHandler, EditAction } from
|
|
1
|
+
import { ClickEvent } from "../edit-modes/types.js";
|
|
2
|
+
import { ModeHandler, EditAction } from "./mode-handler.js";
|
|
3
3
|
export declare class TwoClickPolygonHandler extends ModeHandler {
|
|
4
4
|
handleClick(event: ClickEvent): EditAction | null | undefined;
|
|
5
5
|
}
|
|
6
|
+
//# sourceMappingURL=two-click-polygon-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"two-click-polygon-handler.d.ts","sourceRoot":"","sources":["../../src/mode-handlers/two-click-polygon-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,+BAA4B;AAC/C,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,0BAAuB;AAGvD,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS;CAmB9D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { ModeHandler } from
|
|
4
|
+
import { ModeHandler } from "./mode-handler.js";
|
|
5
5
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
6
6
|
export class TwoClickPolygonHandler extends ModeHandler {
|
|
7
7
|
handleClick(event) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Position } from
|
|
2
|
-
import { EditHandle, ModeHandler } from
|
|
1
|
+
import { Position } from "../utils/geojson-types.js";
|
|
2
|
+
import { EditHandle, ModeHandler } from "./mode-handler.js";
|
|
3
3
|
export declare class ViewHandler extends ModeHandler {
|
|
4
4
|
getCursor({ isDragging }: {
|
|
5
5
|
isDragging: boolean;
|
|
6
6
|
}): string;
|
|
7
7
|
getEditHandles(picks?: Array<Record<string, any>>, mapCoords?: Position): EditHandle[];
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=view-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-handler.d.ts","sourceRoot":"","sources":["../../src/mode-handlers/view-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,kCAA+B;AAChD,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,0BAAuB;AAGvD,qBAAa,WAAY,SAAQ,WAAW;IAC1C,SAAS,CAAC,EAAC,UAAU,EAAC,EAAE;QAAC,UAAU,EAAE,OAAO,CAAA;KAAC,GAAG,MAAM;IAItD,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE;CAGvF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { ModeHandler } from
|
|
4
|
+
import { ModeHandler } from "./mode-handler.js";
|
|
5
5
|
// TODO edit-modes: delete handlers once EditMode fully implemented
|
|
6
6
|
export class ViewHandler extends ModeHandler {
|
|
7
7
|
getCursor({ isDragging }) {
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
export type ColorProps = {
|
|
2
|
+
opacity: number;
|
|
3
|
+
desaturate: number;
|
|
4
|
+
brightness: number;
|
|
5
|
+
};
|
|
6
|
+
declare function getUniforms(opts?: ColorProps): ColorProps;
|
|
2
7
|
/** Shader module that implements desaturation. @note still WIP */
|
|
3
8
|
export declare const color: {
|
|
4
9
|
readonly name: "color";
|
|
5
10
|
readonly vs: "in vec4 color_vColor;\n\ncolor_setColor(vec4 color) {\n color_vColor = color;\n}\n";
|
|
6
|
-
readonly fs: "uniform float
|
|
11
|
+
readonly fs: "uniform colorUniforms {\n float opacity;\n float desaturate;\n float brightness;\n} color;\n\n\nin vec4 color_vColor;\n\nout vec4 fragColor;\n\nvec4 color_getColor() {\n return color_vColor;\n}\n\nvec4 color_filterColor(vec4 inputColor) {\n vec4 color = inputColor;\n // apply desaturation and brightness\n if (color.desaturate > 0.01) {\n float luminance = (color.r + color.g + color.b) * 0.333333333 + color.brightness;\n color = vec4(mix(color.rgb, vec3(luminance), color.desaturate), color.a);\n }\n\n // Apply opacity\n color = vec4(color.rgb, color.a * color.opacity);\n return color;\n}\n";
|
|
7
12
|
readonly getUniforms: typeof getUniforms;
|
|
13
|
+
readonly uniformTypes: {
|
|
14
|
+
readonly opacity: "f32";
|
|
15
|
+
readonly desaturate: "f32";
|
|
16
|
+
readonly brightness: "f32";
|
|
17
|
+
};
|
|
8
18
|
};
|
|
9
19
|
export {};
|
|
20
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/shaderlib/color/color.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAQF,iBAAS,WAAW,CAAC,IAAI,aAAgB,cAExC;AAmCD,kEAAkE;AAClE,eAAO,MAAM,KAAK;;;;;;;;;;CAU2B,CAAC"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
4
|
+
const uniformBlock = `\
|
|
5
|
+
uniform colorUniforms {
|
|
6
|
+
float opacity;
|
|
7
|
+
float desaturate;
|
|
8
|
+
float brightness;
|
|
9
|
+
} color;
|
|
10
|
+
`;
|
|
5
11
|
const INITIAL_STATE = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
opacity: 1.0,
|
|
13
|
+
desaturate: 0.0,
|
|
14
|
+
brightness: 1.0
|
|
9
15
|
};
|
|
10
16
|
function getUniforms(opts = INITIAL_STATE) {
|
|
11
|
-
|
|
12
|
-
if (opts.opacity) {
|
|
13
|
-
uniforms.color_uOpacity = opts.opacity;
|
|
14
|
-
}
|
|
15
|
-
return uniforms;
|
|
17
|
+
return opts;
|
|
16
18
|
}
|
|
17
19
|
const vs = `\
|
|
18
20
|
in vec4 color_vColor;
|
|
@@ -22,9 +24,7 @@ color_setColor(vec4 color) {
|
|
|
22
24
|
}
|
|
23
25
|
`;
|
|
24
26
|
const fs = `\
|
|
25
|
-
|
|
26
|
-
uniform float color_uDesaturate;
|
|
27
|
-
uniform float color_uBrightness;
|
|
27
|
+
${uniformBlock}
|
|
28
28
|
|
|
29
29
|
in vec4 color_vColor;
|
|
30
30
|
|
|
@@ -34,14 +34,16 @@ vec4 color_getColor() {
|
|
|
34
34
|
return color_vColor;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
vec4 color_filterColor(vec4
|
|
37
|
+
vec4 color_filterColor(vec4 inputColor) {
|
|
38
|
+
vec4 color = inputColor;
|
|
38
39
|
// apply desaturation and brightness
|
|
39
|
-
if (
|
|
40
|
-
float luminance = (color.r + color.g + color.b) * 0.333333333 +
|
|
41
|
-
color = vec4(mix(color.rgb, vec3(luminance),
|
|
40
|
+
if (color.desaturate > 0.01) {
|
|
41
|
+
float luminance = (color.r + color.g + color.b) * 0.333333333 + color.brightness;
|
|
42
|
+
color = vec4(mix(color.rgb, vec3(luminance), color.desaturate), color.a);
|
|
43
|
+
}
|
|
42
44
|
|
|
43
45
|
// Apply opacity
|
|
44
|
-
color = vec4(color.rgb, color.a *
|
|
46
|
+
color = vec4(color.rgb, color.a * color.opacity);
|
|
45
47
|
return color;
|
|
46
48
|
}
|
|
47
49
|
`;
|
|
@@ -50,5 +52,10 @@ export const color = {
|
|
|
50
52
|
name: 'color',
|
|
51
53
|
vs,
|
|
52
54
|
fs,
|
|
53
|
-
getUniforms
|
|
55
|
+
getUniforms,
|
|
56
|
+
uniformTypes: {
|
|
57
|
+
opacity: 'f32',
|
|
58
|
+
desaturate: 'f32',
|
|
59
|
+
brightness: 'f32'
|
|
60
|
+
}
|
|
54
61
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shaderlib/utils/utils.ts"],"names":[],"mappings":"AASA,iBAAS,WAAW,CAAC,EAAE,KAAgB,QAAI;AAsB3C,eAAO,MAAM,KAAK;;;;;CAKjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curve-utils.d.ts","sourceRoot":"","sources":["../../src/utils/curve-utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAYlF,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAC7B,OAAO,CAAC,UAAU,CAAC,CA2DrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geojson-types.d.ts","sourceRoot":"","sources":["../../src/utils/geojson-types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,YAAY,EACZ,QAAQ,EACT,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAC,CAAC;AAEzF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AACxC,MAAM,MAAM,qBAAqB,GAAG,QAAQ,EAAE,CAAC;AAC/C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,EAAE,EAAE,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,QAAQ,EAAE,CAAC;AAC/C,MAAM,MAAM,0BAA0B,GAAG,QAAQ,EAAE,EAAE,CAAC;AACtD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,EAAE,EAAE,EAAE,CAAC;AAErD,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,qBAAqB,GACrB,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,GAC1B,uBAAuB,CAAC;AAE5B,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,eAAe,GAAG,YAAY,CAAC;AAElG,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAI/C,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC1C,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC;IACZ,UAAU,CAAC,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,IAAI;IACpD,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC;IACZ,UAAU,EAAE,CAAC,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GACf,SAAS,CAAC,KAAK,CAAC,GAChB,SAAS,CAAC,UAAU,CAAC,GACrB,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,CAAC,UAAU,CAAC,GACrB,SAAS,CAAC,eAAe,CAAC,GAC1B,SAAS,CAAC,YAAY,CAAC,CAAC;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,EAAE,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,iBAAiB,CAAC"}
|
package/dist/utils/memoize.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../src/utils/memoize.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,QAAQ,UAIzB,GAAG,SAUlB"}
|
|
@@ -2,3 +2,4 @@ import type { Feature as TurfFeature, Geometry as TurfGeometry } from '@turf/hel
|
|
|
2
2
|
export declare function translateFromCenter(feature: TurfFeature<TurfGeometry>, distance: number, direction: number): TurfFeature<TurfGeometry, {
|
|
3
3
|
[name: string]: any;
|
|
4
4
|
}>;
|
|
5
|
+
//# sourceMappingURL=translate-from-center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate-from-center.d.ts","sourceRoot":"","sources":["../../src/utils/translate-from-center.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,OAAO,IAAI,WAAW,EACtB,QAAQ,IAAI,YAAY,EACzB,MAAM,eAAe,CAAC;AAMvB,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;;GA8BlB"}
|
|
@@ -5,16 +5,16 @@ import turfCenter from '@turf/center';
|
|
|
5
5
|
import turfRhumbBearing from '@turf/rhumb-bearing';
|
|
6
6
|
import turfRhumbDistance from '@turf/rhumb-distance';
|
|
7
7
|
import turfRhumbDestination from '@turf/rhumb-destination';
|
|
8
|
-
import { mapCoords } from
|
|
8
|
+
import { mapCoords } from "../edit-modes/utils.js";
|
|
9
9
|
// This function takes feature's center, moves it,
|
|
10
10
|
// and builds new feature around it keeping the proportions
|
|
11
11
|
export function translateFromCenter(feature, distance, direction) {
|
|
12
12
|
const initialCenterPoint = turfCenter(feature);
|
|
13
13
|
const movedCenterPoint = turfRhumbDestination(initialCenterPoint, distance, direction);
|
|
14
14
|
const movedCoordinates = mapCoords(feature.geometry.coordinates, (coordinate) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const movedPosition = turfRhumbDestination(movedCenterPoint.geometry.coordinates,
|
|
15
|
+
const rhumbDistance = turfRhumbDistance(initialCenterPoint.geometry.coordinates, coordinate);
|
|
16
|
+
const rhumbDirection = turfRhumbBearing(initialCenterPoint.geometry.coordinates, coordinate);
|
|
17
|
+
const movedPosition = turfRhumbDestination(movedCenterPoint.geometry.coordinates, rhumbDistance, rhumbDirection).geometry.coordinates;
|
|
18
18
|
return movedPosition;
|
|
19
19
|
});
|
|
20
20
|
feature.geometry.coordinates = movedCoordinates;
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;CACnC,CAAC;AAGF,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FeatureOf, FeatureWithProps, LineString, Point, Position } from
|
|
2
|
-
import { Viewport } from
|
|
1
|
+
import { FeatureOf, FeatureWithProps, LineString, Point, Position } from "./geojson-types.js";
|
|
2
|
+
import { Viewport } from "./types.js";
|
|
3
3
|
export type NearestPointType = FeatureWithProps<Point, {
|
|
4
4
|
dist: number;
|
|
5
5
|
index: number;
|
|
@@ -13,8 +13,9 @@ export declare function nearestPointOnProjectedLine(line: FeatureOf<LineString>,
|
|
|
13
13
|
/**
|
|
14
14
|
* Inserts toInsert string into base string before insertBefore string.
|
|
15
15
|
* @param base A string to insert into.
|
|
16
|
-
* @param
|
|
16
|
+
* @param insertBeforeText A sub string in `base` string to insert before.
|
|
17
17
|
* @param toInsert A string to insert.
|
|
18
18
|
* @returns Combined string. `base` string if `insertBefore` string isn't found.
|
|
19
19
|
*/
|
|
20
|
-
export declare function insertBefore(base: string,
|
|
20
|
+
export declare function insertBefore(base: string, insertBeforeText: string, toInsert: string): string;
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAC,2BAAwB;AACzF,OAAO,EAAC,QAAQ,EAAC,mBAAgB;AAIjC,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,KAAK,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC;AAEtF,wBAAgB,WAAW,CACzB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EACjD,YAAY,GAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAoB,GAChE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAKlC;AA2BD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,EAAE,EAAE,QAAQ,WAYb;AAED,wBAAgB,kCAAkC,CAChD,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,QAAQ,GAClB,QAAQ,EAAE,CAuBZ;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIjF;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC,EAC3B,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,EACzB,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CA6DlB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM7F"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ import destination from '@turf/destination';
|
|
|
5
5
|
import bearing from '@turf/bearing';
|
|
6
6
|
import pointToLineDistance from '@turf/point-to-line-distance';
|
|
7
7
|
import { point } from '@turf/helpers';
|
|
8
|
-
import WebMercatorViewport from 'viewport-mercator-project';
|
|
8
|
+
import { WebMercatorViewport } from 'viewport-mercator-project';
|
|
9
9
|
export function toDeckColor(color, defaultColor = [255, 0, 0, 255]) {
|
|
10
10
|
if (!Array.isArray(color)) {
|
|
11
11
|
return defaultColor;
|
|
@@ -133,12 +133,12 @@ export function nearestPointOnProjectedLine(line, inPoint, viewport) {
|
|
|
133
133
|
/**
|
|
134
134
|
* Inserts toInsert string into base string before insertBefore string.
|
|
135
135
|
* @param base A string to insert into.
|
|
136
|
-
* @param
|
|
136
|
+
* @param insertBeforeText A sub string in `base` string to insert before.
|
|
137
137
|
* @param toInsert A string to insert.
|
|
138
138
|
* @returns Combined string. `base` string if `insertBefore` string isn't found.
|
|
139
139
|
*/
|
|
140
|
-
export function insertBefore(base,
|
|
141
|
-
const at = base.indexOf(
|
|
140
|
+
export function insertBefore(base, insertBeforeText, toInsert) {
|
|
141
|
+
const at = base.indexOf(insertBeforeText);
|
|
142
142
|
if (at < 0) {
|
|
143
143
|
return base;
|
|
144
144
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@deck.gl-community/editable-layers",
|
|
3
3
|
"description": "A suite of 3D-enabled data editing overlays, suitable for deck.gl",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "9.0.2",
|
|
5
|
+
"version": "9.1.0-beta.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/visgl/deck.gl-community"
|
|
@@ -70,15 +70,16 @@
|
|
|
70
70
|
"viewport-mercator-project": ">=6.2.3"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@deck.gl/
|
|
74
|
-
"@deck.gl/
|
|
75
|
-
"@deck.gl/
|
|
76
|
-
"@deck.gl/layers": "^9.0
|
|
77
|
-
"@deck.gl/
|
|
78
|
-
"@
|
|
79
|
-
"@luma.gl/
|
|
80
|
-
"@luma.gl/
|
|
73
|
+
"@deck.gl-community/layers": "^9.1.0",
|
|
74
|
+
"@deck.gl/core": "^9.1.0",
|
|
75
|
+
"@deck.gl/extensions": "^9.1.0",
|
|
76
|
+
"@deck.gl/geo-layers": "^9.1.0",
|
|
77
|
+
"@deck.gl/layers": "^9.1.0",
|
|
78
|
+
"@deck.gl/mesh-layers": "^9.1.0",
|
|
79
|
+
"@luma.gl/constants": ">=9.1.0",
|
|
80
|
+
"@luma.gl/core": ">=9.1.0",
|
|
81
|
+
"@luma.gl/engine": ">=9.1.0",
|
|
81
82
|
"@math.gl/core": ">=4.0.1"
|
|
82
83
|
},
|
|
83
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "80b6a3b1fafe0765f2070928ae360fc52bd57a46"
|
|
84
85
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {FeatureCollection} from '../utils/geojson-types';
|
|
2
|
+
|
|
3
|
+
import {GeoJsonEditMode} from './geojson-edit-mode';
|
|
4
|
+
import {ClickEvent, ModeProps} from './types';
|
|
5
|
+
export class DeleteMode extends GeoJsonEditMode {
|
|
6
|
+
handleClick(_event: ClickEvent, props: ModeProps<FeatureCollection>): void {
|
|
7
|
+
const selectedFeatureIndexes = props.lastPointerMoveEvent.picks.map((pick) => pick.index);
|
|
8
|
+
if (selectedFeatureIndexes.length > 0) {
|
|
9
|
+
const indexToDelete = selectedFeatureIndexes[0];
|
|
10
|
+
|
|
11
|
+
const features = props.data.features.filter((_, index) => index !== indexToDelete);
|
|
12
|
+
const updatedData = {
|
|
13
|
+
...props.data,
|
|
14
|
+
features
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const editAction = {
|
|
18
|
+
updatedData,
|
|
19
|
+
editType: 'deleteFeature',
|
|
20
|
+
editContext: {
|
|
21
|
+
featureIndexes: selectedFeatureIndexes
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
props.onEdit(editAction);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -38,6 +38,10 @@ export class DrawCircleByDiameterMode extends TwoClickPolygonMode {
|
|
|
38
38
|
|
|
39
39
|
geometry.properties = geometry.properties || {};
|
|
40
40
|
geometry.properties.shape = 'Circle';
|
|
41
|
+
geometry.properties.editProperties = geometry.properties.editProperties || {};
|
|
42
|
+
geometry.properties.editProperties.shape = 'Circle';
|
|
43
|
+
geometry.properties.editProperties.radius = {value: this.radius, unit: 'kilometers'};
|
|
44
|
+
geometry.properties.editProperties.center = centerCoordinates;
|
|
41
45
|
// calculate area of circle with turf function
|
|
42
46
|
this.areaCircle = area(geometry);
|
|
43
47
|
// @ts-expect-error turf types diff
|
|
@@ -32,6 +32,10 @@ export class DrawCircleFromCenterMode extends TwoClickPolygonMode {
|
|
|
32
32
|
|
|
33
33
|
geometry.properties = geometry.properties || {};
|
|
34
34
|
geometry.properties.shape = 'Circle';
|
|
35
|
+
geometry.properties.editProperties = geometry.properties.editProperties || {};
|
|
36
|
+
geometry.properties.editProperties.shape = 'Circle';
|
|
37
|
+
geometry.properties.editProperties.radius = {value: this.radius, unit: 'kilometers'};
|
|
38
|
+
geometry.properties.editProperties.center = coord1;
|
|
35
39
|
// calculate area of circle with turf function
|
|
36
40
|
this.areaCircle = area(geometry);
|
|
37
41
|
// @ts-expect-error turf types diff
|
|
@@ -23,7 +23,16 @@ export class DrawEllipseByBoundingBoxMode extends TwoClickPolygonMode {
|
|
|
23
23
|
const xSemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[1])), 0.001);
|
|
24
24
|
const ySemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[3])), 0.001);
|
|
25
25
|
|
|
26
|
+
const geometry = ellipse(centerCoordinates, xSemiAxis, ySemiAxis);
|
|
27
|
+
|
|
28
|
+
geometry.properties = geometry.properties || {};
|
|
29
|
+
geometry.properties.editProperties = geometry.properties.editProperties || {};
|
|
30
|
+
geometry.properties.editProperties.shape = 'Ellipse';
|
|
31
|
+
geometry.properties.editProperties.xSemiAxis = {value: xSemiAxis, unit: 'kilometers'};
|
|
32
|
+
geometry.properties.editProperties.ySemiAxis = {value: ySemiAxis, unit: 'kilometers'};
|
|
33
|
+
geometry.properties.editProperties.angle = 0;
|
|
34
|
+
geometry.properties.editProperties.center = centerCoordinates;
|
|
26
35
|
// @ts-expect-error fix return types
|
|
27
|
-
return
|
|
36
|
+
return geometry;
|
|
28
37
|
}
|
|
29
38
|
}
|
|
@@ -22,6 +22,16 @@ export class DrawEllipseUsingThreePointsMode extends ThreeClickPolygonMode {
|
|
|
22
22
|
const ySemiAxis = Math.max(distance(coord1, coord2), 0.001) / 2;
|
|
23
23
|
const options = {angle: bearing(coord1, coord2)};
|
|
24
24
|
// @ts-expect-error fix return types
|
|
25
|
-
|
|
25
|
+
const geometry = ellipse(centerCoordinates, xSemiAxis, ySemiAxis, options);
|
|
26
|
+
|
|
27
|
+
geometry.properties = geometry.properties || {};
|
|
28
|
+
geometry.properties.editProperties = geometry.properties.editProperties || {};
|
|
29
|
+
geometry.properties.editProperties.shape = 'Ellipse';
|
|
30
|
+
geometry.properties.editProperties.xSemiAxis = {value: xSemiAxis, unit: 'kilometers'};
|
|
31
|
+
geometry.properties.editProperties.ySemiAxis = {value: ySemiAxis, unit: 'kilometers'};
|
|
32
|
+
geometry.properties.editProperties.angle = options.angle;
|
|
33
|
+
geometry.properties.editProperties.center = centerCoordinates;
|
|
34
|
+
// @ts-expect-error fix return types
|
|
35
|
+
return geometry;
|
|
26
36
|
}
|
|
27
37
|
}
|
|
@@ -62,6 +62,10 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
|
|
|
62
62
|
|
|
63
63
|
const mapCoords = props.lastPointerMoveEvent && props.lastPointerMoveEvent.mapCoords;
|
|
64
64
|
|
|
65
|
+
if (!mapCoords) {
|
|
66
|
+
return guides;
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
// Draw an extension line starting from one end of the selected LineString to the cursor
|
|
66
70
|
let startPosition: Position | null | undefined = null;
|
|
67
71
|
const {modeConfig} = props;
|
|
@@ -6,7 +6,8 @@ import bearing from '@turf/bearing';
|
|
|
6
6
|
import {
|
|
7
7
|
generatePointsParallelToLinePoints,
|
|
8
8
|
getPickedEditHandle,
|
|
9
|
-
getPickedIntermediateEditHandle
|
|
9
|
+
getPickedIntermediateEditHandle,
|
|
10
|
+
shouldCancelPan
|
|
10
11
|
} from './utils';
|
|
11
12
|
import {FeatureCollection} from '../utils/geojson-types';
|
|
12
13
|
import {ModeProps, StartDraggingEvent, StopDraggingEvent, DraggingEvent} from './types';
|
|
@@ -61,6 +62,10 @@ export class ExtrudeMode extends ModifyMode {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
65
|
+
if (shouldCancelPan(event)) {
|
|
66
|
+
event.cancelPan();
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
const selectedFeatureIndexes = props.selectedIndexes;
|
|
65
70
|
|
|
66
71
|
const editHandle = getPickedIntermediateEditHandle(event.picks);
|
|
@@ -118,17 +118,19 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
118
118
|
|
|
119
119
|
getAddFeatureAction(
|
|
120
120
|
featureOrGeometry: Geometry | Feature,
|
|
121
|
-
features: FeatureCollection
|
|
121
|
+
features: FeatureCollection,
|
|
122
|
+
featureProperties?: {}
|
|
122
123
|
): GeoJsonEditAction {
|
|
123
124
|
// Unsure why flow can't deal with Geometry type, but there I fixed it
|
|
124
125
|
const featureOrGeometryAsAny: any = featureOrGeometry;
|
|
126
|
+
featureProperties = featureProperties || {};
|
|
125
127
|
|
|
126
128
|
const feature: any =
|
|
127
129
|
featureOrGeometryAsAny.type === 'Feature'
|
|
128
130
|
? featureOrGeometryAsAny
|
|
129
131
|
: {
|
|
130
132
|
type: 'Feature',
|
|
131
|
-
properties:
|
|
133
|
+
properties: featureProperties,
|
|
132
134
|
geometry: featureOrGeometryAsAny
|
|
133
135
|
};
|
|
134
136
|
|
|
@@ -173,11 +175,14 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
173
175
|
};
|
|
174
176
|
}
|
|
175
177
|
|
|
178
|
+
// eslint-disable-next-line complexity
|
|
176
179
|
getAddFeatureOrBooleanPolygonAction(
|
|
177
180
|
featureOrGeometry: Polygon | Feature,
|
|
178
|
-
props: ModeProps<FeatureCollection
|
|
181
|
+
props: ModeProps<FeatureCollection>,
|
|
182
|
+
featureProperties?: {}
|
|
179
183
|
): GeoJsonEditAction | null | undefined {
|
|
180
184
|
const featureOrGeometryAsAny: any = featureOrGeometry;
|
|
185
|
+
featureProperties = featureProperties || {};
|
|
181
186
|
|
|
182
187
|
const selectedFeature = this.getSelectedFeature(props);
|
|
183
188
|
const {modeConfig} = props;
|
|
@@ -240,7 +245,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
|
|
|
240
245
|
|
|
241
246
|
return editAction;
|
|
242
247
|
}
|
|
243
|
-
return this.getAddFeatureAction(featureOrGeometry, props.data);
|
|
248
|
+
return this.getAddFeatureAction(featureOrGeometry, props.data, featureProperties);
|
|
244
249
|
}
|
|
245
250
|
|
|
246
251
|
createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature | null {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import turfDistance from '@turf/distance';
|
|
6
6
|
import turfMidpoint from '@turf/midpoint';
|
|
7
|
-
import {FeatureCollection
|
|
7
|
+
import {FeatureCollection} from '../utils/geojson-types';
|
|
8
8
|
import {
|
|
9
9
|
ClickEvent,
|
|
10
10
|
PointerMoveEvent,
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
getPickedExistingEditHandle,
|
|
14
14
|
getPickedIntermediateEditHandle,
|
|
15
15
|
updateRectanglePosition,
|
|
16
|
-
NearestPointType
|
|
16
|
+
NearestPointType,
|
|
17
|
+
shouldCancelPan
|
|
17
18
|
} from './utils';
|
|
18
19
|
import {LineString, Point, Polygon, FeatureCollection, FeatureOf} from '../utils/geojson-types';
|
|
19
20
|
import {
|
|
@@ -251,6 +252,10 @@ export class ModifyMode extends GeoJsonEditMode {
|
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
255
|
+
if (shouldCancelPan(event)) {
|
|
256
|
+
event.cancelPan();
|
|
257
|
+
}
|
|
258
|
+
|
|
254
259
|
const selectedFeatureIndexes = props.selectedIndexes;
|
|
255
260
|
|
|
256
261
|
const editHandle = getPickedIntermediateEditHandle(event.picks);
|
|
@@ -11,7 +11,7 @@ import {coordEach} from '@turf/meta';
|
|
|
11
11
|
import {getGeom} from '@turf/invariant';
|
|
12
12
|
import {point, featureCollection, lineString} from '@turf/helpers';
|
|
13
13
|
import turfTransformRotate from '@turf/transform-rotate';
|
|
14
|
-
import polygonToLine from '@turf/polygon-to-line';
|
|
14
|
+
import {polygonToLine} from '@turf/polygon-to-line';
|
|
15
15
|
import {
|
|
16
16
|
PointerMoveEvent,
|
|
17
17
|
StartDraggingEvent,
|
|
@@ -128,6 +128,7 @@ export class RotateMode extends GeoJsonEditMode {
|
|
|
128
128
|
|
|
129
129
|
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
130
130
|
if (this._selectedEditHandle) {
|
|
131
|
+
event.cancelPan();
|
|
131
132
|
this._isRotating = true;
|
|
132
133
|
this._geometryBeingRotated = this.getSelectedFeaturesAsFeatureCollection(props);
|
|
133
134
|
}
|
|
@@ -7,7 +7,7 @@ import turfCentroid from '@turf/centroid';
|
|
|
7
7
|
import turfBearing from '@turf/bearing';
|
|
8
8
|
import bboxPolygon from '@turf/bbox-polygon';
|
|
9
9
|
import {point, featureCollection} from '@turf/helpers';
|
|
10
|
-
import polygonToLine from '@turf/polygon-to-line';
|
|
10
|
+
import {polygonToLine} from '@turf/polygon-to-line';
|
|
11
11
|
import {coordEach} from '@turf/meta';
|
|
12
12
|
import turfDistance from '@turf/distance';
|
|
13
13
|
import turfTransformScale from '@turf/transform-scale';
|
|
@@ -152,6 +152,7 @@ export class ScaleMode extends GeoJsonEditMode {
|
|
|
152
152
|
|
|
153
153
|
handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {
|
|
154
154
|
if (this._selectedEditHandle) {
|
|
155
|
+
event.cancelPan();
|
|
155
156
|
this._isScaling = true;
|
|
156
157
|
this._geometryBeingScaled = this.getSelectedFeaturesAsFeatureCollection(props);
|
|
157
158
|
}
|
|
@@ -6,12 +6,14 @@ import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
|
|
|
6
6
|
import turfDifference from '@turf/difference';
|
|
7
7
|
import turfBuffer from '@turf/buffer';
|
|
8
8
|
import lineIntersect from '@turf/line-intersect';
|
|
9
|
-
import {
|
|
9
|
+
import type {Point} from '@turf/helpers';
|
|
10
|
+
import {lineString} from '@turf/helpers';
|
|
10
11
|
import turfBearing from '@turf/bearing';
|
|
11
12
|
import turfDistance from '@turf/distance';
|
|
12
13
|
import turfDestination from '@turf/destination';
|
|
13
14
|
import turfPolygonToLine from '@turf/polygon-to-line';
|
|
14
|
-
import
|
|
15
|
+
import type {NearestPointOnLine} from '@turf/nearest-point-on-line';
|
|
16
|
+
import nearestPointOnLine from '@turf/nearest-point-on-line';
|
|
15
17
|
import {generatePointsParallelToLinePoints} from './utils';
|
|
16
18
|
import {FeatureCollection} from '../utils/geojson-types';
|
|
17
19
|
import {
|