@deck.gl-community/editable-layers 9.1.1 → 9.2.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/edit-modes/draw-line-string-mode.d.ts +3 -1
- package/dist/edit-modes/draw-line-string-mode.d.ts.map +1 -1
- package/dist/edit-modes/draw-line-string-mode.js +19 -21
- package/dist/edit-modes/draw-line-string-mode.js.map +1 -1
- package/dist/edit-modes/draw-polygon-mode.d.ts +3 -1
- package/dist/edit-modes/draw-polygon-mode.d.ts.map +1 -1
- package/dist/edit-modes/draw-polygon-mode.js +19 -22
- package/dist/edit-modes/draw-polygon-mode.js.map +1 -1
- package/dist/edit-modes/edit-mode.d.ts +2 -1
- package/dist/edit-modes/edit-mode.d.ts.map +1 -1
- package/dist/edit-modes/geojson-edit-mode.d.ts +1 -0
- package/dist/edit-modes/geojson-edit-mode.d.ts.map +1 -1
- package/dist/edit-modes/geojson-edit-mode.js +1 -0
- package/dist/edit-modes/geojson-edit-mode.js.map +1 -1
- package/dist/edit-modes/measure-distance-mode.d.ts.map +1 -1
- package/dist/edit-modes/rotate-mode.d.ts.map +1 -1
- package/dist/edit-modes/scale-mode.d.ts.map +1 -1
- package/dist/edit-modes/types.d.ts +1 -0
- package/dist/edit-modes/types.d.ts.map +1 -1
- package/dist/editable-layers/editable-geojson-layer.d.ts +2 -1
- package/dist/editable-layers/editable-geojson-layer.d.ts.map +1 -1
- package/dist/editable-layers/editable-geojson-layer.js +5 -0
- package/dist/editable-layers/editable-geojson-layer.js.map +1 -1
- package/dist/editable-layers/editable-layer.d.ts +3 -1
- package/dist/editable-layers/editable-layer.d.ts.map +1 -1
- package/dist/editable-layers/editable-layer.js +7 -1
- package/dist/editable-layers/editable-layer.js.map +1 -1
- package/dist/index.cjs +604 -79
- package/dist/index.cjs.map +4 -4
- package/dist/lib/layers/segments-layer.d.ts +1 -1
- package/dist/lib/layers/segments-layer.d.ts.map +1 -1
- package/dist/lib/layers/segments-layer.js +1 -1
- package/dist/lib/layers/segments-layer.js.map +1 -1
- package/dist/lib/nebula-core.d.ts.map +1 -1
- package/dist/utils/memoize.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/edit-modes/draw-line-string-mode.ts +23 -24
- package/src/edit-modes/draw-polygon-mode.ts +24 -27
- package/src/edit-modes/edit-mode.ts +4 -1
- package/src/edit-modes/geojson-edit-mode.ts +2 -0
- package/src/edit-modes/types.ts +3 -0
- package/src/editable-layers/editable-geojson-layer.ts +8 -1
- package/src/editable-layers/editable-layer.ts +10 -2
- package/src/lib/layers/segments-layer.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -660,8 +660,525 @@ var TextsLayer = class extends NebulaLayer {
|
|
|
660
660
|
}
|
|
661
661
|
};
|
|
662
662
|
|
|
663
|
+
// ../layers/src/path-marker-layer/path-marker-layer.ts
|
|
664
|
+
var import_core4 = require("@deck.gl/core");
|
|
665
|
+
var import_layers5 = require("@deck.gl/layers");
|
|
666
|
+
var import_mesh_layers = require("@deck.gl/mesh-layers");
|
|
667
|
+
|
|
668
|
+
// ../layers/src/path-outline-layer/path-outline-layer.ts
|
|
669
|
+
var import_layers4 = require("@deck.gl/layers");
|
|
670
|
+
var import_constants2 = require("@luma.gl/constants");
|
|
671
|
+
|
|
672
|
+
// ../layers/src/path-outline-layer/outline.ts
|
|
673
|
+
var INITIAL_STATE = {
|
|
674
|
+
outlineEnabled: false,
|
|
675
|
+
outlineRenderShadowmap: false,
|
|
676
|
+
outlineShadowmap: null
|
|
677
|
+
};
|
|
678
|
+
function getUniforms({ outlineEnabled, outlineRenderShadowmap, outlineShadowmap } = INITIAL_STATE) {
|
|
679
|
+
const uniforms = {};
|
|
680
|
+
if (outlineEnabled !== void 0) {
|
|
681
|
+
uniforms.outline_uEnabled = outlineEnabled;
|
|
682
|
+
}
|
|
683
|
+
if (outlineRenderShadowmap !== void 0) {
|
|
684
|
+
uniforms.outline_uRenderOutlines = outlineRenderShadowmap;
|
|
685
|
+
}
|
|
686
|
+
if (outlineShadowmap !== void 0) {
|
|
687
|
+
uniforms.outline_uShadowmap = outlineShadowmap;
|
|
688
|
+
}
|
|
689
|
+
return uniforms;
|
|
690
|
+
}
|
|
691
|
+
var vs = `#version 300 es
|
|
692
|
+
in float instanceZLevel;
|
|
693
|
+
out float outline_vzLevel;
|
|
694
|
+
out vec4 outline_vPosition;
|
|
695
|
+
|
|
696
|
+
// Set the z level for the outline shadowmap rendering
|
|
697
|
+
void outline_setZLevel(float zLevel) {
|
|
698
|
+
outline_vzLevel = zLevel;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Store an adjusted position for texture2DProj
|
|
702
|
+
void outline_setUV(vec4 position) {
|
|
703
|
+
// mat4(
|
|
704
|
+
// 0.5, 0.0, 0.0, 0.0,
|
|
705
|
+
// 0.0, 0.5, 0.0, 0.0,
|
|
706
|
+
// 0.0, 0.0, 0.5, 0.0,
|
|
707
|
+
// 0.5, 0.5, 0.5, 1.0
|
|
708
|
+
// ) * position;
|
|
709
|
+
outline_vPosition = vec4(position.xyz * 0.5 + position.w * 0.5, position.w);
|
|
710
|
+
}
|
|
711
|
+
`;
|
|
712
|
+
var fs = `uniform bool outline_uEnabled;
|
|
713
|
+
uniform bool outline_uRenderOutlines;
|
|
714
|
+
uniform sampler2D outline_uShadowmap;
|
|
715
|
+
|
|
716
|
+
in float outline_vzLevel;
|
|
717
|
+
// in vec2 outline_vUV;
|
|
718
|
+
in vec4 outline_vPosition;
|
|
719
|
+
|
|
720
|
+
out vec4 fragColor;
|
|
721
|
+
|
|
722
|
+
const float OUTLINE_Z_LEVEL_ERROR = 0.01;
|
|
723
|
+
|
|
724
|
+
// Return a darker color in shadowmap
|
|
725
|
+
vec4 outline_filterShadowColor(vec4 color) {
|
|
726
|
+
return vec4(outline_vzLevel / 255., outline_vzLevel / 255., outline_vzLevel / 255., 1.);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// Return a darker color if in shadowmap
|
|
730
|
+
vec4 outline_filterDarkenColor(vec4 color) {
|
|
731
|
+
if (outline_uEnabled) {
|
|
732
|
+
float maxZLevel;
|
|
733
|
+
if (outline_vPosition.q > 0.0) {
|
|
734
|
+
maxZLevel = texture2DProj(outline_uShadowmap, outline_vPosition).r * 255.;
|
|
735
|
+
} else {
|
|
736
|
+
discard;
|
|
737
|
+
}
|
|
738
|
+
if (maxZLevel < outline_vzLevel + OUTLINE_Z_LEVEL_ERROR) {
|
|
739
|
+
vec4(color.rgb * 0.5, color.a);
|
|
740
|
+
} else {
|
|
741
|
+
discard;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return color;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// if enabled and rendering outlines - Render depth to shadowmap
|
|
748
|
+
// if enabled and rendering colors - Return a darker color if in shadowmap
|
|
749
|
+
// if disabled, just return color
|
|
750
|
+
vec4 outline_filterColor(vec4 color) {
|
|
751
|
+
if (outline_uEnabled) {
|
|
752
|
+
return outline_uRenderOutlines ?
|
|
753
|
+
outline_filterShadowColor(color) :
|
|
754
|
+
outline_filterDarkenColor(color);
|
|
755
|
+
}
|
|
756
|
+
return color;
|
|
757
|
+
}
|
|
758
|
+
`;
|
|
759
|
+
var outline = {
|
|
760
|
+
name: "outline",
|
|
761
|
+
vs,
|
|
762
|
+
fs,
|
|
763
|
+
getUniforms
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// ../layers/src/path-outline-layer/path-outline-layer.ts
|
|
767
|
+
var UNIT = {
|
|
768
|
+
common: 0,
|
|
769
|
+
meters: 1,
|
|
770
|
+
pixels: 2
|
|
771
|
+
};
|
|
772
|
+
function injectShaderCode({ source, code = "" }) {
|
|
773
|
+
const INJECT_CODE = /}[^{}]*$/;
|
|
774
|
+
return source.replace(INJECT_CODE, code.concat("\n}\n"));
|
|
775
|
+
}
|
|
776
|
+
var VS_CODE = ` outline_setUV(gl_Position);
|
|
777
|
+
outline_setZLevel(instanceZLevel);
|
|
778
|
+
`;
|
|
779
|
+
var FS_CODE = ` fragColor = outline_filterColor(fragColor);
|
|
780
|
+
`;
|
|
781
|
+
var defaultProps = {
|
|
782
|
+
getZLevel: () => 0
|
|
783
|
+
};
|
|
784
|
+
var PathOutlineLayer = class extends import_layers4.PathLayer {
|
|
785
|
+
state = void 0;
|
|
786
|
+
// Override getShaders to inject the outline module
|
|
787
|
+
getShaders() {
|
|
788
|
+
const shaders = super.getShaders();
|
|
789
|
+
return Object.assign({}, shaders, {
|
|
790
|
+
modules: shaders.modules.concat([outline]),
|
|
791
|
+
vs: injectShaderCode({ source: shaders.vs, code: VS_CODE }),
|
|
792
|
+
fs: injectShaderCode({ source: shaders.fs, code: FS_CODE })
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
// @ts-expect-error PathLayer is missing LayerContext arg
|
|
796
|
+
initializeState(context) {
|
|
797
|
+
super.initializeState();
|
|
798
|
+
this.setState({
|
|
799
|
+
outlineFramebuffer: context.device.createFramebuffer({}),
|
|
800
|
+
dummyTexture: context.device.createTexture({ width: 1, height: 1 })
|
|
801
|
+
});
|
|
802
|
+
this.state.attributeManager.addInstanced({
|
|
803
|
+
instanceZLevel: {
|
|
804
|
+
size: 1,
|
|
805
|
+
type: import_constants2.GL.UNSIGNED_BYTE,
|
|
806
|
+
accessor: "getZLevel"
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
// Override draw to add render module
|
|
811
|
+
draw({ moduleParameters = {}, parameters, uniforms, context }) {
|
|
812
|
+
const {
|
|
813
|
+
jointRounded,
|
|
814
|
+
capRounded,
|
|
815
|
+
billboard,
|
|
816
|
+
miterLimit,
|
|
817
|
+
widthUnits,
|
|
818
|
+
widthScale,
|
|
819
|
+
widthMinPixels,
|
|
820
|
+
widthMaxPixels
|
|
821
|
+
} = this.props;
|
|
822
|
+
uniforms = Object.assign({}, uniforms, {
|
|
823
|
+
jointType: Number(jointRounded),
|
|
824
|
+
capType: Number(capRounded),
|
|
825
|
+
billboard,
|
|
826
|
+
widthUnits: UNIT[widthUnits],
|
|
827
|
+
widthScale,
|
|
828
|
+
miterLimit,
|
|
829
|
+
widthMinPixels,
|
|
830
|
+
widthMaxPixels
|
|
831
|
+
});
|
|
832
|
+
const { outlineFramebuffer, dummyTexture } = this.state;
|
|
833
|
+
this.state.model.updateModuleSettings({
|
|
834
|
+
outlineEnabled: true,
|
|
835
|
+
outlineRenderShadowmap: true,
|
|
836
|
+
outlineShadowmap: dummyTexture
|
|
837
|
+
});
|
|
838
|
+
this.state.model.draw({
|
|
839
|
+
uniforms: Object.assign({}, uniforms, {
|
|
840
|
+
jointType: 0,
|
|
841
|
+
widthScale: this.props.widthScale * 1.3
|
|
842
|
+
}),
|
|
843
|
+
parameters: {
|
|
844
|
+
depthTest: false,
|
|
845
|
+
// Biggest value needs to go into buffer
|
|
846
|
+
blendEquation: import_constants2.GL.MAX
|
|
847
|
+
},
|
|
848
|
+
framebuffer: outlineFramebuffer
|
|
849
|
+
});
|
|
850
|
+
this.state.model.updateModuleSettings({
|
|
851
|
+
outlineEnabled: true,
|
|
852
|
+
outlineRenderShadowmap: false,
|
|
853
|
+
outlineShadowmap: outlineFramebuffer
|
|
854
|
+
});
|
|
855
|
+
this.state.model.draw({
|
|
856
|
+
uniforms: Object.assign({}, uniforms, {
|
|
857
|
+
jointType: Number(jointRounded),
|
|
858
|
+
capType: Number(capRounded),
|
|
859
|
+
widthScale: this.props.widthScale
|
|
860
|
+
}),
|
|
861
|
+
parameters: {
|
|
862
|
+
depthTest: false
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
__publicField(PathOutlineLayer, "layerName", "PathOutlineLayer");
|
|
868
|
+
__publicField(PathOutlineLayer, "defaultProps", defaultProps);
|
|
869
|
+
|
|
870
|
+
// ../layers/src/path-marker-layer/arrow-2d-geometry.ts
|
|
871
|
+
var import_engine = require("@luma.gl/engine");
|
|
872
|
+
var Arrow2DGeometry = class extends import_engine.Geometry {
|
|
873
|
+
constructor(opts = {}) {
|
|
874
|
+
super(
|
|
875
|
+
Object.assign({}, opts, {
|
|
876
|
+
attributes: getArrowAttributes(opts),
|
|
877
|
+
topology: "triangle-list"
|
|
878
|
+
})
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
function getArrowAttributes({ length = 1, headSize = 0.2, tailWidth = 0.05, tailStart = 0.05 }) {
|
|
883
|
+
const texCoords = [
|
|
884
|
+
// HEAD
|
|
885
|
+
0.5,
|
|
886
|
+
1,
|
|
887
|
+
0,
|
|
888
|
+
0.5 - headSize / 2,
|
|
889
|
+
1 - headSize,
|
|
890
|
+
0,
|
|
891
|
+
0.5 + headSize / 2,
|
|
892
|
+
1 - headSize,
|
|
893
|
+
0,
|
|
894
|
+
0.5 - tailWidth / 2,
|
|
895
|
+
tailStart,
|
|
896
|
+
0,
|
|
897
|
+
0.5 + tailWidth / 2,
|
|
898
|
+
1 - headSize,
|
|
899
|
+
0,
|
|
900
|
+
0.5 + tailWidth / 2,
|
|
901
|
+
tailStart,
|
|
902
|
+
0,
|
|
903
|
+
0.5 - tailWidth / 2,
|
|
904
|
+
tailStart,
|
|
905
|
+
0,
|
|
906
|
+
0.5 - tailWidth / 2,
|
|
907
|
+
1 - headSize,
|
|
908
|
+
0,
|
|
909
|
+
0.5 + tailWidth / 2,
|
|
910
|
+
1 - headSize,
|
|
911
|
+
0
|
|
912
|
+
];
|
|
913
|
+
const normals = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1];
|
|
914
|
+
const positions = new Array(texCoords.length);
|
|
915
|
+
for (let i = 0; i < texCoords.length / 3; i++) {
|
|
916
|
+
const i3 = i * 3;
|
|
917
|
+
positions[i3 + 0] = (texCoords[i3 + 0] - 0.5) * length;
|
|
918
|
+
positions[i3 + 1] = (texCoords[i3 + 1] - 0.5) * length;
|
|
919
|
+
positions[i3 + 2] = 0;
|
|
920
|
+
}
|
|
921
|
+
return {
|
|
922
|
+
positions: { size: 3, value: new Float32Array(positions) },
|
|
923
|
+
normals: { size: 3, value: new Float32Array(normals) },
|
|
924
|
+
texCoords: { size: 2, value: new Float32Array(texCoords) }
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// ../layers/src/path-marker-layer/create-path-markers.ts
|
|
929
|
+
var import_core2 = require("@math.gl/core");
|
|
930
|
+
function getLineLength(vPoints) {
|
|
931
|
+
let lineLength = 0;
|
|
932
|
+
for (let i = 0; i < vPoints.length - 1; i++) {
|
|
933
|
+
lineLength += vPoints[i].distance(vPoints[i + 1]);
|
|
934
|
+
}
|
|
935
|
+
return lineLength;
|
|
936
|
+
}
|
|
937
|
+
var DEFAULT_COLOR = [0, 0, 0, 255];
|
|
938
|
+
var DEFAULT_DIRECTION = { forward: true, backward: false };
|
|
939
|
+
function createPathMarkers({
|
|
940
|
+
data,
|
|
941
|
+
getPath = (x, context) => x.path,
|
|
942
|
+
getDirection = (x) => x.direction,
|
|
943
|
+
getColor = (x) => DEFAULT_COLOR,
|
|
944
|
+
getMarkerPercentages = (x, info) => [0.5],
|
|
945
|
+
projectFlat
|
|
946
|
+
}) {
|
|
947
|
+
const markers = [];
|
|
948
|
+
for (const object of data) {
|
|
949
|
+
const path = getPath(object, null);
|
|
950
|
+
const direction = getDirection(object) || DEFAULT_DIRECTION;
|
|
951
|
+
const color = getColor(object);
|
|
952
|
+
const vPoints = path.map((p) => new import_core2.Vector2(p));
|
|
953
|
+
const vPointsReverse = vPoints.slice(0).reverse();
|
|
954
|
+
const lineLength = getLineLength(vPoints);
|
|
955
|
+
const percentages = getMarkerPercentages(object, { lineLength });
|
|
956
|
+
for (const percentage of percentages) {
|
|
957
|
+
if (direction.forward) {
|
|
958
|
+
const marker = createMarkerAlongPath({
|
|
959
|
+
path: vPoints,
|
|
960
|
+
percentage,
|
|
961
|
+
lineLength,
|
|
962
|
+
color,
|
|
963
|
+
object,
|
|
964
|
+
projectFlat
|
|
965
|
+
});
|
|
966
|
+
markers.push(marker);
|
|
967
|
+
}
|
|
968
|
+
if (direction.backward) {
|
|
969
|
+
const marker = createMarkerAlongPath({
|
|
970
|
+
path: vPointsReverse,
|
|
971
|
+
percentage,
|
|
972
|
+
lineLength,
|
|
973
|
+
color,
|
|
974
|
+
object,
|
|
975
|
+
projectFlat
|
|
976
|
+
});
|
|
977
|
+
markers.push(marker);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
return markers;
|
|
982
|
+
}
|
|
983
|
+
function createMarkerAlongPath({
|
|
984
|
+
path,
|
|
985
|
+
percentage,
|
|
986
|
+
lineLength,
|
|
987
|
+
color,
|
|
988
|
+
object,
|
|
989
|
+
projectFlat
|
|
990
|
+
}) {
|
|
991
|
+
const distanceAlong = lineLength * percentage;
|
|
992
|
+
let currentDistance = 0;
|
|
993
|
+
let previousDistance = 0;
|
|
994
|
+
let i = 0;
|
|
995
|
+
for (i = 0; i < path.length - 1; i++) {
|
|
996
|
+
currentDistance += path[i].distance(path[i + 1]);
|
|
997
|
+
if (currentDistance > distanceAlong) {
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
previousDistance = currentDistance;
|
|
1001
|
+
}
|
|
1002
|
+
if (i === path.length - 1) {
|
|
1003
|
+
i -= 1;
|
|
1004
|
+
}
|
|
1005
|
+
const vDirection = path[i + 1].clone().subtract(path[i]).normalize();
|
|
1006
|
+
const along = distanceAlong - previousDistance;
|
|
1007
|
+
const vCenter = vDirection.clone().multiply(new import_core2.Vector2(along, along)).add(path[i]);
|
|
1008
|
+
const vDirection2 = new import_core2.Vector2(projectFlat(path[i + 1])).subtract(projectFlat(path[i]));
|
|
1009
|
+
const angle = vDirection2.verticalAngle() * 180 / Math.PI;
|
|
1010
|
+
return { position: [vCenter.x, vCenter.y, 0], angle, color, object };
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// ../layers/src/path-marker-layer/polyline.ts
|
|
1014
|
+
var import_core3 = require("@math.gl/core");
|
|
1015
|
+
function getClosestPointOnLine({ p, p1, p2, clampToLine = true }) {
|
|
1016
|
+
const lineVector = new import_core3.Vector3(p2).subtract(p1);
|
|
1017
|
+
const pointVector = new import_core3.Vector3(p).subtract(p1);
|
|
1018
|
+
let dotProduct = lineVector.dot(pointVector);
|
|
1019
|
+
if (clampToLine) {
|
|
1020
|
+
dotProduct = (0, import_core3.clamp)(dotProduct, 0, 1);
|
|
1021
|
+
}
|
|
1022
|
+
return lineVector.lerp(p1, p2, dotProduct);
|
|
1023
|
+
}
|
|
1024
|
+
function getClosestPointOnPolyline({ p, points }) {
|
|
1025
|
+
p = new import_core3.Vector3(p);
|
|
1026
|
+
let pClosest = null;
|
|
1027
|
+
let distanceSquared = Infinity;
|
|
1028
|
+
let index = -1;
|
|
1029
|
+
for (let i = 0; i < points.length - 1; ++i) {
|
|
1030
|
+
const p1 = points[i];
|
|
1031
|
+
const p2 = points[i + 1];
|
|
1032
|
+
const pClosestOnLine = getClosestPointOnLine({ p, p1, p2 });
|
|
1033
|
+
const distanceToLineSquared = p.distanceSquared(pClosestOnLine);
|
|
1034
|
+
if (distanceToLineSquared < distanceSquared) {
|
|
1035
|
+
distanceSquared = distanceToLineSquared;
|
|
1036
|
+
pClosest = pClosestOnLine;
|
|
1037
|
+
index = i;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
point: pClosest,
|
|
1042
|
+
index,
|
|
1043
|
+
p1: points[index],
|
|
1044
|
+
p2: points[index + 1],
|
|
1045
|
+
distanceSquared,
|
|
1046
|
+
distance: Math.sqrt(distanceSquared)
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// ../layers/src/path-marker-layer/path-marker-layer.ts
|
|
1051
|
+
var DISTANCE_FOR_MULTI_ARROWS = 0.1;
|
|
1052
|
+
var ARROW_HEAD_SIZE = 0.2;
|
|
1053
|
+
var ARROW_TAIL_WIDTH = 0.05;
|
|
1054
|
+
var DEFAULT_MARKER_LAYER = import_mesh_layers.SimpleMeshLayer;
|
|
1055
|
+
var DEFAULT_MARKER_LAYER_PROPS = {
|
|
1056
|
+
mesh: new Arrow2DGeometry({ headSize: ARROW_HEAD_SIZE, tailWidth: ARROW_TAIL_WIDTH })
|
|
1057
|
+
};
|
|
1058
|
+
var defaultProps2 = Object.assign(
|
|
1059
|
+
{},
|
|
1060
|
+
PathOutlineLayer.defaultProps,
|
|
1061
|
+
{
|
|
1062
|
+
MarkerLayer: DEFAULT_MARKER_LAYER,
|
|
1063
|
+
markerLayerProps: DEFAULT_MARKER_LAYER_PROPS,
|
|
1064
|
+
sizeScale: 100,
|
|
1065
|
+
fp64: false,
|
|
1066
|
+
highlightIndex: -1,
|
|
1067
|
+
highlightPoint: null,
|
|
1068
|
+
getPath: (x) => x.path,
|
|
1069
|
+
getColor: (x) => x.color,
|
|
1070
|
+
getMarkerColor: (x) => [0, 0, 0, 255],
|
|
1071
|
+
getDirection: (x) => x.direction,
|
|
1072
|
+
getMarkerPercentages: (object, { lineLength }) => lineLength > DISTANCE_FOR_MULTI_ARROWS ? [0.25, 0.5, 0.75] : [0.5]
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1075
|
+
var PathMarkerLayer = class extends import_core4.CompositeLayer {
|
|
1076
|
+
state = void 0;
|
|
1077
|
+
initializeState() {
|
|
1078
|
+
this.state = {
|
|
1079
|
+
markers: [],
|
|
1080
|
+
mesh: new Arrow2DGeometry({ headSize: ARROW_HEAD_SIZE, tailWidth: ARROW_TAIL_WIDTH }),
|
|
1081
|
+
closestPoint: null,
|
|
1082
|
+
closestPoints: []
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
projectFlat(xyz, viewport, coordinateSystem, coordinateOrigin) {
|
|
1086
|
+
if (coordinateSystem === import_core4.COORDINATE_SYSTEM.METER_OFFSETS) {
|
|
1087
|
+
const [dx, dy] = viewport.metersToLngLatDelta(xyz);
|
|
1088
|
+
const [x, y] = coordinateOrigin;
|
|
1089
|
+
return viewport.projectFlat([x + dx, dy + y]);
|
|
1090
|
+
} else if (coordinateSystem === import_core4.COORDINATE_SYSTEM.LNGLAT_OFFSETS) {
|
|
1091
|
+
const [dx, dy] = xyz;
|
|
1092
|
+
const [x, y] = coordinateOrigin;
|
|
1093
|
+
return viewport.projectFlat([x + dx, dy + y]);
|
|
1094
|
+
}
|
|
1095
|
+
return viewport.projectFlat(xyz);
|
|
1096
|
+
}
|
|
1097
|
+
updateState({ props, oldProps, changeFlags }) {
|
|
1098
|
+
if (changeFlags.dataChanged || changeFlags.updateTriggersChanged) {
|
|
1099
|
+
const {
|
|
1100
|
+
data,
|
|
1101
|
+
getPath,
|
|
1102
|
+
getDirection,
|
|
1103
|
+
getMarkerColor,
|
|
1104
|
+
getMarkerPercentages,
|
|
1105
|
+
coordinateSystem,
|
|
1106
|
+
coordinateOrigin
|
|
1107
|
+
} = this.props;
|
|
1108
|
+
const { viewport } = this.context;
|
|
1109
|
+
const projectFlat = (o) => this.projectFlat(o, viewport, coordinateSystem, coordinateOrigin);
|
|
1110
|
+
this.state.markers = createPathMarkers({
|
|
1111
|
+
data,
|
|
1112
|
+
getPath,
|
|
1113
|
+
getDirection,
|
|
1114
|
+
getColor: getMarkerColor,
|
|
1115
|
+
getMarkerPercentages,
|
|
1116
|
+
projectFlat
|
|
1117
|
+
});
|
|
1118
|
+
this._recalculateClosestPoint();
|
|
1119
|
+
}
|
|
1120
|
+
if (changeFlags.propsChanged) {
|
|
1121
|
+
if (props.point !== oldProps.point) {
|
|
1122
|
+
this._recalculateClosestPoint();
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
_recalculateClosestPoint() {
|
|
1127
|
+
const { highlightPoint, highlightIndex } = this.props;
|
|
1128
|
+
if (highlightPoint && highlightIndex >= 0) {
|
|
1129
|
+
const object = this.props.data[highlightIndex];
|
|
1130
|
+
const points = this.props.getPath(object, null);
|
|
1131
|
+
const { point: point14 } = getClosestPointOnPolyline({ points, p: highlightPoint });
|
|
1132
|
+
this.state.closestPoints = [{ position: point14 }];
|
|
1133
|
+
} else {
|
|
1134
|
+
this.state.closestPoints = [];
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
getPickingInfo({ info }) {
|
|
1138
|
+
return Object.assign(info, {
|
|
1139
|
+
// override object with picked feature
|
|
1140
|
+
object: info.object && info.object.path || info.object
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
renderLayers() {
|
|
1144
|
+
return [
|
|
1145
|
+
new PathOutlineLayer(
|
|
1146
|
+
this.props,
|
|
1147
|
+
this.getSubLayerProps({
|
|
1148
|
+
id: "paths",
|
|
1149
|
+
// Note: data has to be passed explicitly like this to avoid being empty
|
|
1150
|
+
data: this.props.data
|
|
1151
|
+
})
|
|
1152
|
+
),
|
|
1153
|
+
new this.props.MarkerLayer(
|
|
1154
|
+
this.getSubLayerProps(
|
|
1155
|
+
Object.assign({}, this.props.markerLayerProps, {
|
|
1156
|
+
id: "markers",
|
|
1157
|
+
data: this.state.markers,
|
|
1158
|
+
getOrientation: (x) => [0, -x.angle, 0],
|
|
1159
|
+
getColor: (x) => x.color,
|
|
1160
|
+
sizeScale: this.props.sizeScale,
|
|
1161
|
+
fp64: this.props.fp64,
|
|
1162
|
+
pickable: false,
|
|
1163
|
+
parameters: {
|
|
1164
|
+
blend: false,
|
|
1165
|
+
depthTest: false
|
|
1166
|
+
}
|
|
1167
|
+
})
|
|
1168
|
+
)
|
|
1169
|
+
),
|
|
1170
|
+
this.state.closestPoints && new import_layers5.ScatterplotLayer({
|
|
1171
|
+
id: `${this.props.id}-highlight`,
|
|
1172
|
+
data: this.state.closestPoints,
|
|
1173
|
+
fp64: this.props.fp64
|
|
1174
|
+
})
|
|
1175
|
+
];
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
__publicField(PathMarkerLayer, "layerName", "PathMarkerLayer");
|
|
1179
|
+
__publicField(PathMarkerLayer, "defaultProps", defaultProps2);
|
|
1180
|
+
|
|
663
1181
|
// dist/lib/layers/segments-layer.js
|
|
664
|
-
var import_layers4 = require("@deck.gl-community/layers");
|
|
665
1182
|
var NEBULA_TO_DECK_DIRECTIONS = {
|
|
666
1183
|
[ArrowStyles.NONE]: { forward: false, backward: false },
|
|
667
1184
|
[ArrowStyles.FORWARD]: { forward: true, backward: false },
|
|
@@ -717,7 +1234,7 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
717
1234
|
render({ nebula }) {
|
|
718
1235
|
const defaultColor = [0, 0, 0, 255];
|
|
719
1236
|
const { objects, updateTrigger } = this.deckCache;
|
|
720
|
-
return new
|
|
1237
|
+
return new PathMarkerLayer({
|
|
721
1238
|
id: `segments-${this.id}`,
|
|
722
1239
|
data: objects,
|
|
723
1240
|
opacity: 1,
|
|
@@ -743,7 +1260,7 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
743
1260
|
highlightColor: toDeckColor(this.highlightColor),
|
|
744
1261
|
dashJustified: this.dashed,
|
|
745
1262
|
getDashArray: this.dashed ? (nf) => nf.style.dashArray : void 0,
|
|
746
|
-
markerLayerProps: this.markerLayerProps ||
|
|
1263
|
+
markerLayerProps: this.markerLayerProps || PathMarkerLayer.defaultProps.markerLayerProps,
|
|
747
1264
|
nebulaLayer: this
|
|
748
1265
|
});
|
|
749
1266
|
}
|
|
@@ -751,12 +1268,12 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
751
1268
|
|
|
752
1269
|
// dist/lib/nebula-core.js
|
|
753
1270
|
var import_eventemitter32 = require("eventemitter3");
|
|
754
|
-
var
|
|
1271
|
+
var import_core5 = require("@deck.gl/core");
|
|
755
1272
|
var LOGGER_PREFIX = "Nebula: ";
|
|
756
1273
|
var NebulaCore = class {
|
|
757
1274
|
init(props) {
|
|
758
1275
|
this.props = props;
|
|
759
|
-
this.wmViewport = new
|
|
1276
|
+
this.wmViewport = new import_core5.WebMercatorViewport(this.props.viewport);
|
|
760
1277
|
["click", "mousemove", "mouseup", "mousedown"].forEach((name) => document.addEventListener(name, this._onMouseEvent, true));
|
|
761
1278
|
}
|
|
762
1279
|
detach() {
|
|
@@ -765,7 +1282,7 @@ var NebulaCore = class {
|
|
|
765
1282
|
updateProps(newProps) {
|
|
766
1283
|
this.props = newProps;
|
|
767
1284
|
const { viewport } = this.props;
|
|
768
|
-
this.wmViewport = new
|
|
1285
|
+
this.wmViewport = new import_core5.WebMercatorViewport(viewport);
|
|
769
1286
|
}
|
|
770
1287
|
props = null;
|
|
771
1288
|
deckgl = null;
|
|
@@ -966,7 +1483,7 @@ var NebulaCore = class {
|
|
|
966
1483
|
};
|
|
967
1484
|
|
|
968
1485
|
// dist/editable-layers/editable-geojson-layer.js
|
|
969
|
-
var
|
|
1486
|
+
var import_layers7 = require("@deck.gl/layers");
|
|
970
1487
|
|
|
971
1488
|
// dist/edit-modes/geojson-edit-mode.js
|
|
972
1489
|
var import_union = __toESM(require("@turf/union"), 1);
|
|
@@ -1697,6 +2214,8 @@ var GeoJsonEditMode = class {
|
|
|
1697
2214
|
}
|
|
1698
2215
|
handleClick(event, props) {
|
|
1699
2216
|
}
|
|
2217
|
+
handleDoubleClick(event, props) {
|
|
2218
|
+
}
|
|
1700
2219
|
handlePointerMove(event, props) {
|
|
1701
2220
|
const tentativeFeature = this.createTentativeFeature(props);
|
|
1702
2221
|
if (tentativeFeature) {
|
|
@@ -2802,15 +3321,7 @@ var DrawLineStringMode = class extends GeoJsonEditMode {
|
|
|
2802
3321
|
}
|
|
2803
3322
|
if (clickSequence.length > 1 && clickedEditHandle && Array.isArray(clickedEditHandle.properties.positionIndexes) && clickedEditHandle.properties.positionIndexes[0] === clickSequence.length - 1) {
|
|
2804
3323
|
this.dist = 0;
|
|
2805
|
-
|
|
2806
|
-
type: "LineString",
|
|
2807
|
-
coordinates: [...clickSequence]
|
|
2808
|
-
};
|
|
2809
|
-
this.resetClickSequence();
|
|
2810
|
-
const editAction = this.getAddFeatureAction(lineStringToAdd, props.data);
|
|
2811
|
-
if (editAction) {
|
|
2812
|
-
props.onEdit(editAction);
|
|
2813
|
-
}
|
|
3324
|
+
this.finishDrawing(props);
|
|
2814
3325
|
} else if (positionAdded) {
|
|
2815
3326
|
props.onEdit({
|
|
2816
3327
|
// data is the same
|
|
@@ -2822,21 +3333,27 @@ var DrawLineStringMode = class extends GeoJsonEditMode {
|
|
|
2822
3333
|
});
|
|
2823
3334
|
}
|
|
2824
3335
|
}
|
|
3336
|
+
handleDoubleClick(event, props) {
|
|
3337
|
+
this.finishDrawing(props);
|
|
3338
|
+
}
|
|
3339
|
+
finishDrawing(props) {
|
|
3340
|
+
const clickSequence = this.getClickSequence();
|
|
3341
|
+
if (clickSequence.length > 1) {
|
|
3342
|
+
const lineStringToAdd = {
|
|
3343
|
+
type: "LineString",
|
|
3344
|
+
coordinates: [...clickSequence]
|
|
3345
|
+
};
|
|
3346
|
+
this.resetClickSequence();
|
|
3347
|
+
const editAction = this.getAddFeatureAction(lineStringToAdd, props.data);
|
|
3348
|
+
if (editAction) {
|
|
3349
|
+
props.onEdit(editAction);
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
2825
3353
|
handleKeyUp(event, props) {
|
|
2826
3354
|
const { key } = event;
|
|
2827
3355
|
if (key === "Enter") {
|
|
2828
|
-
|
|
2829
|
-
if (clickSequence.length > 1) {
|
|
2830
|
-
const lineStringToAdd = {
|
|
2831
|
-
type: "LineString",
|
|
2832
|
-
coordinates: [...clickSequence]
|
|
2833
|
-
};
|
|
2834
|
-
this.resetClickSequence();
|
|
2835
|
-
const editAction = this.getAddFeatureAction(lineStringToAdd, props.data);
|
|
2836
|
-
if (editAction) {
|
|
2837
|
-
props.onEdit(editAction);
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
3356
|
+
this.finishDrawing(props);
|
|
2840
3357
|
} else if (key === "Escape") {
|
|
2841
3358
|
this.resetClickSequence();
|
|
2842
3359
|
props.onEdit({
|
|
@@ -2994,6 +3511,20 @@ var DrawPolygonMode = class extends GeoJsonEditMode {
|
|
|
2994
3511
|
guides.features.push(...editHandles);
|
|
2995
3512
|
return guides;
|
|
2996
3513
|
}
|
|
3514
|
+
finishDrawing(props) {
|
|
3515
|
+
const clickSequence = this.getClickSequence();
|
|
3516
|
+
if (clickSequence.length > 2) {
|
|
3517
|
+
const polygonToAdd = {
|
|
3518
|
+
type: "Polygon",
|
|
3519
|
+
coordinates: [[...clickSequence, clickSequence[0]]]
|
|
3520
|
+
};
|
|
3521
|
+
this.resetClickSequence();
|
|
3522
|
+
const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);
|
|
3523
|
+
if (editAction) {
|
|
3524
|
+
props.onEdit(editAction);
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
2997
3528
|
// eslint-disable-next-line complexity
|
|
2998
3529
|
handleClick(event, props) {
|
|
2999
3530
|
const { picks } = event;
|
|
@@ -3017,15 +3548,7 @@ var DrawPolygonMode = class extends GeoJsonEditMode {
|
|
|
3017
3548
|
positionAdded = true;
|
|
3018
3549
|
}
|
|
3019
3550
|
if (clickSequence.length > 2 && clickedEditHandle && Array.isArray(clickedEditHandle.properties.positionIndexes) && (clickedEditHandle.properties.positionIndexes[0] === 0 || clickedEditHandle.properties.positionIndexes[0] === clickSequence.length - 1)) {
|
|
3020
|
-
|
|
3021
|
-
type: "Polygon",
|
|
3022
|
-
coordinates: [[...clickSequence, clickSequence[0]]]
|
|
3023
|
-
};
|
|
3024
|
-
this.resetClickSequence();
|
|
3025
|
-
const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);
|
|
3026
|
-
if (editAction) {
|
|
3027
|
-
props.onEdit(editAction);
|
|
3028
|
-
}
|
|
3551
|
+
this.finishDrawing(props);
|
|
3029
3552
|
} else if (positionAdded) {
|
|
3030
3553
|
props.onEdit({
|
|
3031
3554
|
// data is the same
|
|
@@ -3037,20 +3560,12 @@ var DrawPolygonMode = class extends GeoJsonEditMode {
|
|
|
3037
3560
|
});
|
|
3038
3561
|
}
|
|
3039
3562
|
}
|
|
3563
|
+
handleDoubleClick(event, props) {
|
|
3564
|
+
this.finishDrawing(props);
|
|
3565
|
+
}
|
|
3040
3566
|
handleKeyUp(event, props) {
|
|
3041
3567
|
if (event.key === "Enter") {
|
|
3042
|
-
|
|
3043
|
-
if (clickSequence.length > 2) {
|
|
3044
|
-
const polygonToAdd = {
|
|
3045
|
-
type: "Polygon",
|
|
3046
|
-
coordinates: [[...clickSequence, clickSequence[0]]]
|
|
3047
|
-
};
|
|
3048
|
-
this.resetClickSequence();
|
|
3049
|
-
const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);
|
|
3050
|
-
if (editAction) {
|
|
3051
|
-
props.onEdit(editAction);
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3568
|
+
this.finishDrawing(props);
|
|
3054
3569
|
} else if (event.key === "Escape") {
|
|
3055
3570
|
this.resetClickSequence();
|
|
3056
3571
|
props.onEdit({
|
|
@@ -3987,13 +4502,15 @@ var DeleteMode = class extends GeoJsonEditMode {
|
|
|
3987
4502
|
var PROJECTED_PIXEL_SIZE_MULTIPLIER2 = 2 / 3;
|
|
3988
4503
|
|
|
3989
4504
|
// dist/editable-layers/editable-layer.js
|
|
3990
|
-
var
|
|
3991
|
-
var EVENT_TYPES = ["click", "pointermove", "panstart", "panmove", "panend", "keyup"];
|
|
3992
|
-
var EditableLayer = class extends
|
|
4505
|
+
var import_core6 = require("@deck.gl/core");
|
|
4506
|
+
var EVENT_TYPES = ["click", "pointermove", "panstart", "panmove", "panend", "keyup", "dblclick"];
|
|
4507
|
+
var EditableLayer = class extends import_core6.CompositeLayer {
|
|
3993
4508
|
state = void 0;
|
|
3994
4509
|
// Overridable interaction event handlers
|
|
3995
4510
|
onLayerClick(event) {
|
|
3996
4511
|
}
|
|
4512
|
+
onLayerDoubleClick(event) {
|
|
4513
|
+
}
|
|
3997
4514
|
onStartDragging(event) {
|
|
3998
4515
|
}
|
|
3999
4516
|
onStopDragging(event) {
|
|
@@ -4063,6 +4580,9 @@ var EditableLayer = class extends import_core3.CompositeLayer {
|
|
|
4063
4580
|
sourceEvent: srcEvent
|
|
4064
4581
|
});
|
|
4065
4582
|
}
|
|
4583
|
+
_ondblclick({ srcEvent }) {
|
|
4584
|
+
this.onLayerDoubleClick(srcEvent);
|
|
4585
|
+
}
|
|
4066
4586
|
_onkeyup({ srcEvent }) {
|
|
4067
4587
|
this.onLayerKeyUp(srcEvent);
|
|
4068
4588
|
}
|
|
@@ -4177,7 +4697,7 @@ var EditableLayer = class extends import_core3.CompositeLayer {
|
|
|
4177
4697
|
__publicField(EditableLayer, "layerName", "EditableLayer");
|
|
4178
4698
|
|
|
4179
4699
|
// dist/editable-layers/editable-path-layer.js
|
|
4180
|
-
var
|
|
4700
|
+
var import_layers6 = require("@deck.gl/layers");
|
|
4181
4701
|
var uniformBlock = `uniform pickingLineWidthUniforms {
|
|
4182
4702
|
float extraPixels;
|
|
4183
4703
|
} pickingLineWidth;
|
|
@@ -4190,11 +4710,11 @@ var pickingUniforms = {
|
|
|
4190
4710
|
extraPixels: "f32"
|
|
4191
4711
|
}
|
|
4192
4712
|
};
|
|
4193
|
-
var
|
|
4194
|
-
...
|
|
4713
|
+
var defaultProps3 = {
|
|
4714
|
+
...import_layers6.PathLayer.defaultProps,
|
|
4195
4715
|
pickingLineWidthExtraPixels: { type: "number", min: 0, value: Number.MAX_SAFE_INTEGER }
|
|
4196
4716
|
};
|
|
4197
|
-
var EditablePathLayer = class extends
|
|
4717
|
+
var EditablePathLayer = class extends import_layers6.PathLayer {
|
|
4198
4718
|
getShaders() {
|
|
4199
4719
|
const shaders = super.getShaders();
|
|
4200
4720
|
shaders.vs = insertBefore(shaders.vs, "vec3 width;", `
|
|
@@ -4215,7 +4735,7 @@ var EditablePathLayer = class extends import_layers5.PathLayer {
|
|
|
4215
4735
|
super.draw(props);
|
|
4216
4736
|
}
|
|
4217
4737
|
};
|
|
4218
|
-
EditablePathLayer.defaultProps =
|
|
4738
|
+
EditablePathLayer.defaultProps = defaultProps3;
|
|
4219
4739
|
EditablePathLayer.layerName = "EditablePathLayer";
|
|
4220
4740
|
|
|
4221
4741
|
// dist/editable-layers/editable-geojson-layer.js
|
|
@@ -4273,7 +4793,7 @@ function getEditHandleRadius(handle) {
|
|
|
4273
4793
|
return DEFAULT_EDITING_INTERMEDIATE_POINT_RADIUS;
|
|
4274
4794
|
}
|
|
4275
4795
|
}
|
|
4276
|
-
var
|
|
4796
|
+
var defaultProps4 = {
|
|
4277
4797
|
mode: DEFAULT_EDIT_MODE,
|
|
4278
4798
|
// Edit and interaction events
|
|
4279
4799
|
onEdit: () => {
|
|
@@ -4405,7 +4925,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4405
4925
|
getLineWidth: [this.props.selectedFeatureIndexes, this.props.mode]
|
|
4406
4926
|
}
|
|
4407
4927
|
});
|
|
4408
|
-
let layers = [new
|
|
4928
|
+
let layers = [new import_layers7.GeoJsonLayer(subLayerProps)];
|
|
4409
4929
|
layers = layers.concat(this.createGuidesLayers(), this.createTooltipsLayers());
|
|
4410
4930
|
return layers;
|
|
4411
4931
|
}
|
|
@@ -4519,7 +5039,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4519
5039
|
};
|
|
4520
5040
|
if (this.props.editHandleType === "icon") {
|
|
4521
5041
|
subLayerProps["points-icon"] = {
|
|
4522
|
-
type:
|
|
5042
|
+
type: import_layers7.IconLayer,
|
|
4523
5043
|
iconAtlas: this.props.editHandleIconAtlas,
|
|
4524
5044
|
iconMapping: this.props.editHandleIconMapping,
|
|
4525
5045
|
sizeUnits: this.props.editHandleIconSizeUnits,
|
|
@@ -4532,7 +5052,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4532
5052
|
};
|
|
4533
5053
|
} else {
|
|
4534
5054
|
subLayerProps["points-circle"] = {
|
|
4535
|
-
type:
|
|
5055
|
+
type: import_layers7.ScatterplotLayer,
|
|
4536
5056
|
radiusScale: this.props.editHandlePointRadiusScale,
|
|
4537
5057
|
stroked: this.props.editHandlePointOutline,
|
|
4538
5058
|
getLineWidth: this.props.editHandlePointStrokeWidth,
|
|
@@ -4545,7 +5065,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4545
5065
|
billboard: this.props.billboard
|
|
4546
5066
|
};
|
|
4547
5067
|
}
|
|
4548
|
-
const layer = new
|
|
5068
|
+
const layer = new import_layers7.GeoJsonLayer(this.getSubLayerProps({
|
|
4549
5069
|
id: "guides",
|
|
4550
5070
|
data: guides,
|
|
4551
5071
|
fp64: this.props.fp64,
|
|
@@ -4568,7 +5088,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4568
5088
|
createTooltipsLayers() {
|
|
4569
5089
|
const mode = this.getActiveMode();
|
|
4570
5090
|
const tooltips = mode.getTooltips(this.getModeProps(this.props));
|
|
4571
|
-
const layer = new
|
|
5091
|
+
const layer = new import_layers7.TextLayer({
|
|
4572
5092
|
getSize: DEFAULT_TOOLTIP_FONT_SIZE,
|
|
4573
5093
|
...this.getSubLayerProps({
|
|
4574
5094
|
id: "tooltips",
|
|
@@ -4580,6 +5100,11 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4580
5100
|
onLayerClick(event) {
|
|
4581
5101
|
this.getActiveMode().handleClick(event, this.getModeProps(this.props));
|
|
4582
5102
|
}
|
|
5103
|
+
onLayerDoubleClick(event) {
|
|
5104
|
+
if (this.getActiveMode().handleDoubleClick) {
|
|
5105
|
+
this.getActiveMode().handleDoubleClick(event, this.getModeProps(this.props));
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
4583
5108
|
onLayerKeyUp(event) {
|
|
4584
5109
|
this.getActiveMode().handleKeyUp(event, this.getModeProps(this.props));
|
|
4585
5110
|
}
|
|
@@ -4611,7 +5136,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4611
5136
|
}
|
|
4612
5137
|
};
|
|
4613
5138
|
__publicField(EditableGeoJsonLayer, "layerName", "EditableGeoJsonLayer");
|
|
4614
|
-
__publicField(EditableGeoJsonLayer, "defaultProps",
|
|
5139
|
+
__publicField(EditableGeoJsonLayer, "defaultProps", defaultProps4);
|
|
4615
5140
|
|
|
4616
5141
|
// dist/editable-layers/editable-h3-cluster-layer.js
|
|
4617
5142
|
var import_geo_layers = require("@deck.gl/geo-layers");
|
|
@@ -4621,7 +5146,7 @@ var EMPTY_FEATURE_COLLECTION = {
|
|
|
4621
5146
|
type: "FeatureCollection",
|
|
4622
5147
|
features: []
|
|
4623
5148
|
};
|
|
4624
|
-
var
|
|
5149
|
+
var defaultProps5 = {
|
|
4625
5150
|
mode: DEFAULT_EDIT_MODE2,
|
|
4626
5151
|
...EditableGeoJsonLayer.defaultProps,
|
|
4627
5152
|
// h3 layer
|
|
@@ -4760,11 +5285,11 @@ var EditableH3ClusterLayer = class extends EditableLayer {
|
|
|
4760
5285
|
}
|
|
4761
5286
|
};
|
|
4762
5287
|
__publicField(EditableH3ClusterLayer, "layerName", "EditableH3ClusterLayer");
|
|
4763
|
-
__publicField(EditableH3ClusterLayer, "defaultProps",
|
|
5288
|
+
__publicField(EditableH3ClusterLayer, "defaultProps", defaultProps5);
|
|
4764
5289
|
|
|
4765
5290
|
// dist/editable-layers/selection-layer.js
|
|
4766
|
-
var
|
|
4767
|
-
var
|
|
5291
|
+
var import_core7 = require("@deck.gl/core");
|
|
5292
|
+
var import_layers8 = require("@deck.gl/layers");
|
|
4768
5293
|
var import_helpers16 = require("@turf/helpers");
|
|
4769
5294
|
var import_buffer3 = __toESM(require("@turf/buffer"), 1);
|
|
4770
5295
|
var import_difference4 = __toESM(require("@turf/difference"), 1);
|
|
@@ -4780,7 +5305,7 @@ var MODE_MAP = {
|
|
|
4780
5305
|
var MODE_CONFIG_MAP = {
|
|
4781
5306
|
[SELECTION_TYPE2.RECTANGLE]: { dragToDraw: true }
|
|
4782
5307
|
};
|
|
4783
|
-
var
|
|
5308
|
+
var defaultProps6 = {
|
|
4784
5309
|
selectionType: SELECTION_TYPE2.RECTANGLE,
|
|
4785
5310
|
layerIds: [],
|
|
4786
5311
|
onSelect: () => {
|
|
@@ -4815,7 +5340,7 @@ var PASS_THROUGH_PROPS = [
|
|
|
4815
5340
|
"getTentativeFillColor",
|
|
4816
5341
|
"getTentativeLineWidth"
|
|
4817
5342
|
];
|
|
4818
|
-
var SelectionLayer = class extends
|
|
5343
|
+
var SelectionLayer = class extends import_core7.CompositeLayer {
|
|
4819
5344
|
state = void 0;
|
|
4820
5345
|
_selectRectangleObjects(coordinates) {
|
|
4821
5346
|
const { layerIds, onSelect } = this.props;
|
|
@@ -4899,7 +5424,7 @@ var SelectionLayer = class extends import_core4.CompositeLayer {
|
|
|
4899
5424
|
];
|
|
4900
5425
|
if (pendingPolygonSelection) {
|
|
4901
5426
|
const { bigPolygon } = pendingPolygonSelection;
|
|
4902
|
-
layers.push(new
|
|
5427
|
+
layers.push(new import_layers8.PolygonLayer(this.getSubLayerProps({
|
|
4903
5428
|
id: LAYER_ID_BLOCKER,
|
|
4904
5429
|
pickable: true,
|
|
4905
5430
|
stroked: false,
|
|
@@ -4917,19 +5442,19 @@ var SelectionLayer = class extends import_core4.CompositeLayer {
|
|
|
4917
5442
|
}
|
|
4918
5443
|
};
|
|
4919
5444
|
__publicField(SelectionLayer, "layerName", "SelectionLayer");
|
|
4920
|
-
__publicField(SelectionLayer, "defaultProps",
|
|
5445
|
+
__publicField(SelectionLayer, "defaultProps", defaultProps6);
|
|
4921
5446
|
|
|
4922
5447
|
// dist/editable-layers/elevated-edit-handle-layer.js
|
|
4923
|
-
var
|
|
4924
|
-
var
|
|
4925
|
-
var
|
|
4926
|
-
var ElevatedEditHandleLayer = class extends
|
|
5448
|
+
var import_core8 = require("@deck.gl/core");
|
|
5449
|
+
var import_layers9 = require("@deck.gl/layers");
|
|
5450
|
+
var defaultProps7 = {};
|
|
5451
|
+
var ElevatedEditHandleLayer = class extends import_core8.CompositeLayer {
|
|
4927
5452
|
renderLayers() {
|
|
4928
|
-
const handles = new
|
|
5453
|
+
const handles = new import_layers9.ScatterplotLayer(Object.assign({}, this.props, {
|
|
4929
5454
|
id: `${this.props.id}-ScatterplotLayer`,
|
|
4930
5455
|
data: this.props.data
|
|
4931
5456
|
}));
|
|
4932
|
-
const lines = new
|
|
5457
|
+
const lines = new import_layers9.LineLayer(Object.assign({}, this.props, {
|
|
4933
5458
|
id: `${this.props.id}-LineLayer`,
|
|
4934
5459
|
data: this.props.data,
|
|
4935
5460
|
pickable: false,
|
|
@@ -4942,7 +5467,7 @@ var ElevatedEditHandleLayer = class extends import_core5.CompositeLayer {
|
|
|
4942
5467
|
}
|
|
4943
5468
|
};
|
|
4944
5469
|
__publicField(ElevatedEditHandleLayer, "layerName", "ElevatedEditHandleLayer");
|
|
4945
|
-
__publicField(ElevatedEditHandleLayer, "defaultProps",
|
|
5470
|
+
__publicField(ElevatedEditHandleLayer, "defaultProps", defaultProps7);
|
|
4946
5471
|
|
|
4947
5472
|
// dist/edit-modes/resize-circle-mode.js
|
|
4948
5473
|
var import_nearest_point_on_line2 = __toESM(require("@turf/nearest-point-on-line"), 1);
|