@deck.gl-community/editable-layers 9.2.0-beta.3 → 9.2.0-beta.4
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/index.cjs +38 -579
- 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/package.json +2 -2
- package/src/lib/layers/segments-layer.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -661,549 +661,8 @@ var TextsLayer = class extends NebulaLayer {
|
|
|
661
661
|
}
|
|
662
662
|
};
|
|
663
663
|
|
|
664
|
-
// ../layers/src/path-marker-layer/path-marker-layer.ts
|
|
665
|
-
var import_core4 = require("@deck.gl/core");
|
|
666
|
-
var import_layers5 = require("@deck.gl/layers");
|
|
667
|
-
var import_mesh_layers = require("@deck.gl/mesh-layers");
|
|
668
|
-
|
|
669
|
-
// ../layers/src/path-outline-layer/path-outline-layer.ts
|
|
670
|
-
var import_layers4 = require("@deck.gl/layers");
|
|
671
|
-
var import_constants2 = require("@luma.gl/constants");
|
|
672
|
-
|
|
673
|
-
// ../layers/src/path-outline-layer/outline.ts
|
|
674
|
-
var INITIAL_STATE = {
|
|
675
|
-
outlineEnabled: false,
|
|
676
|
-
outlineRenderShadowmap: false,
|
|
677
|
-
outlineShadowmap: null
|
|
678
|
-
};
|
|
679
|
-
function getUniforms({ outlineEnabled, outlineRenderShadowmap, outlineShadowmap } = INITIAL_STATE) {
|
|
680
|
-
const uniforms = {};
|
|
681
|
-
if (outlineEnabled !== void 0) {
|
|
682
|
-
uniforms.outline_uEnabled = outlineEnabled;
|
|
683
|
-
}
|
|
684
|
-
if (outlineRenderShadowmap !== void 0) {
|
|
685
|
-
uniforms.outline_uRenderOutlines = outlineRenderShadowmap;
|
|
686
|
-
}
|
|
687
|
-
if (outlineShadowmap !== void 0) {
|
|
688
|
-
uniforms.outline_uShadowmap = outlineShadowmap;
|
|
689
|
-
}
|
|
690
|
-
return uniforms;
|
|
691
|
-
}
|
|
692
|
-
var vs = `#version 300 es
|
|
693
|
-
in float instanceZLevel;
|
|
694
|
-
out float outline_vzLevel;
|
|
695
|
-
out vec4 outline_vPosition;
|
|
696
|
-
|
|
697
|
-
// Set the z level for the outline shadowmap rendering
|
|
698
|
-
void outline_setZLevel(float zLevel) {
|
|
699
|
-
outline_vzLevel = zLevel;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Store an adjusted position for texture2DProj
|
|
703
|
-
void outline_setUV(vec4 position) {
|
|
704
|
-
// mat4(
|
|
705
|
-
// 0.5, 0.0, 0.0, 0.0,
|
|
706
|
-
// 0.0, 0.5, 0.0, 0.0,
|
|
707
|
-
// 0.0, 0.0, 0.5, 0.0,
|
|
708
|
-
// 0.5, 0.5, 0.5, 1.0
|
|
709
|
-
// ) * position;
|
|
710
|
-
outline_vPosition = vec4(position.xyz * 0.5 + position.w * 0.5, position.w);
|
|
711
|
-
}
|
|
712
|
-
`;
|
|
713
|
-
var fs = `uniform bool outline_uEnabled;
|
|
714
|
-
uniform bool outline_uRenderOutlines;
|
|
715
|
-
uniform sampler2D outline_uShadowmap;
|
|
716
|
-
|
|
717
|
-
in float outline_vzLevel;
|
|
718
|
-
// in vec2 outline_vUV;
|
|
719
|
-
in vec4 outline_vPosition;
|
|
720
|
-
|
|
721
|
-
out vec4 fragColor;
|
|
722
|
-
|
|
723
|
-
const float OUTLINE_Z_LEVEL_ERROR = 0.01;
|
|
724
|
-
|
|
725
|
-
// Return a darker color in shadowmap
|
|
726
|
-
vec4 outline_filterShadowColor(vec4 color) {
|
|
727
|
-
return vec4(outline_vzLevel / 255., outline_vzLevel / 255., outline_vzLevel / 255., 1.);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// Return a darker color if in shadowmap
|
|
731
|
-
vec4 outline_filterDarkenColor(vec4 color) {
|
|
732
|
-
if (outline_uEnabled) {
|
|
733
|
-
float maxZLevel;
|
|
734
|
-
if (outline_vPosition.q > 0.0) {
|
|
735
|
-
maxZLevel = texture2DProj(outline_uShadowmap, outline_vPosition).r * 255.;
|
|
736
|
-
} else {
|
|
737
|
-
discard;
|
|
738
|
-
}
|
|
739
|
-
if (maxZLevel < outline_vzLevel + OUTLINE_Z_LEVEL_ERROR) {
|
|
740
|
-
vec4(color.rgb * 0.5, color.a);
|
|
741
|
-
} else {
|
|
742
|
-
discard;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return color;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// if enabled and rendering outlines - Render depth to shadowmap
|
|
749
|
-
// if enabled and rendering colors - Return a darker color if in shadowmap
|
|
750
|
-
// if disabled, just return color
|
|
751
|
-
vec4 outline_filterColor(vec4 color) {
|
|
752
|
-
if (outline_uEnabled) {
|
|
753
|
-
return outline_uRenderOutlines ?
|
|
754
|
-
outline_filterShadowColor(color) :
|
|
755
|
-
outline_filterDarkenColor(color);
|
|
756
|
-
}
|
|
757
|
-
return color;
|
|
758
|
-
}
|
|
759
|
-
`;
|
|
760
|
-
var outline = {
|
|
761
|
-
name: "outline",
|
|
762
|
-
vs,
|
|
763
|
-
fs,
|
|
764
|
-
getUniforms
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
// ../layers/src/path-outline-layer/path-outline-layer.ts
|
|
768
|
-
var UNIT = {
|
|
769
|
-
common: 0,
|
|
770
|
-
meters: 1,
|
|
771
|
-
pixels: 2
|
|
772
|
-
};
|
|
773
|
-
function injectShaderCode({ source, code = "" }) {
|
|
774
|
-
const INJECT_CODE = /}[^{}]*$/;
|
|
775
|
-
return source.replace(INJECT_CODE, code.concat("\n}\n"));
|
|
776
|
-
}
|
|
777
|
-
var VS_CODE = ` outline_setUV(gl_Position);
|
|
778
|
-
outline_setZLevel(instanceZLevel);
|
|
779
|
-
`;
|
|
780
|
-
var FS_CODE = ` fragColor = outline_filterColor(fragColor);
|
|
781
|
-
`;
|
|
782
|
-
var OUTLINE_SHADOWMAP_PARAMETERS = {
|
|
783
|
-
blend: true,
|
|
784
|
-
blendColorSrcFactor: "one",
|
|
785
|
-
blendColorDstFactor: "one",
|
|
786
|
-
blendColorOperation: "max",
|
|
787
|
-
blendAlphaSrcFactor: "one",
|
|
788
|
-
blendAlphaDstFactor: "one",
|
|
789
|
-
blendAlphaOperation: "max",
|
|
790
|
-
depthWriteEnabled: false,
|
|
791
|
-
depthCompare: "always"
|
|
792
|
-
};
|
|
793
|
-
var OUTLINE_RENDER_PARAMETERS = {
|
|
794
|
-
blend: false,
|
|
795
|
-
depthWriteEnabled: false,
|
|
796
|
-
depthCompare: "always"
|
|
797
|
-
};
|
|
798
|
-
var defaultProps = {
|
|
799
|
-
getZLevel: () => 0
|
|
800
|
-
};
|
|
801
|
-
var PathOutlineLayer = class extends import_layers4.PathLayer {
|
|
802
|
-
state = void 0;
|
|
803
|
-
// Override getShaders to inject the outline module
|
|
804
|
-
getShaders() {
|
|
805
|
-
const shaders = super.getShaders();
|
|
806
|
-
return Object.assign({}, shaders, {
|
|
807
|
-
modules: shaders.modules.concat([outline]),
|
|
808
|
-
vs: injectShaderCode({ source: shaders.vs, code: VS_CODE }),
|
|
809
|
-
fs: injectShaderCode({ source: shaders.fs, code: FS_CODE })
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
// @ts-expect-error PathLayer is missing LayerContext arg
|
|
813
|
-
initializeState(context) {
|
|
814
|
-
super.initializeState();
|
|
815
|
-
const outlineFramebuffer = context.device.createFramebuffer({
|
|
816
|
-
colorAttachments: ["rgba8unorm"]
|
|
817
|
-
});
|
|
818
|
-
this.setState({
|
|
819
|
-
outlineFramebuffer
|
|
820
|
-
});
|
|
821
|
-
this.state.attributeManager.addInstanced({
|
|
822
|
-
instanceZLevel: {
|
|
823
|
-
size: 1,
|
|
824
|
-
type: import_constants2.GL.UNSIGNED_BYTE,
|
|
825
|
-
accessor: "getZLevel"
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
// Override draw to add render module
|
|
830
|
-
draw({ moduleParameters = {}, parameters, uniforms, context }) {
|
|
831
|
-
var _a;
|
|
832
|
-
const {
|
|
833
|
-
jointRounded,
|
|
834
|
-
capRounded,
|
|
835
|
-
billboard,
|
|
836
|
-
miterLimit,
|
|
837
|
-
widthUnits,
|
|
838
|
-
widthScale,
|
|
839
|
-
widthMinPixels,
|
|
840
|
-
widthMaxPixels
|
|
841
|
-
} = this.props;
|
|
842
|
-
uniforms = Object.assign({}, uniforms, {
|
|
843
|
-
jointType: Number(jointRounded),
|
|
844
|
-
capType: Number(capRounded),
|
|
845
|
-
billboard,
|
|
846
|
-
widthUnits: UNIT[widthUnits],
|
|
847
|
-
widthScale,
|
|
848
|
-
miterLimit,
|
|
849
|
-
widthMinPixels,
|
|
850
|
-
widthMaxPixels
|
|
851
|
-
});
|
|
852
|
-
const { outlineFramebuffer } = this.state;
|
|
853
|
-
if (context == null ? void 0 : context.viewport) {
|
|
854
|
-
const viewportWidth = Math.max(1, Math.ceil(context.viewport.width));
|
|
855
|
-
const viewportHeight = Math.max(1, Math.ceil(context.viewport.height));
|
|
856
|
-
outlineFramebuffer.resize({ width: viewportWidth, height: viewportHeight });
|
|
857
|
-
} else {
|
|
858
|
-
outlineFramebuffer.resize();
|
|
859
|
-
}
|
|
860
|
-
const shadowmapTexture = (_a = outlineFramebuffer.colorAttachments[0]) == null ? void 0 : _a.texture;
|
|
861
|
-
if (!shadowmapTexture) {
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
this.state.model.updateModuleSettings({
|
|
865
|
-
outlineEnabled: true,
|
|
866
|
-
outlineRenderShadowmap: true,
|
|
867
|
-
outlineShadowmap: shadowmapTexture
|
|
868
|
-
});
|
|
869
|
-
this.state.model.draw({
|
|
870
|
-
uniforms: Object.assign({}, uniforms, {
|
|
871
|
-
jointType: 0,
|
|
872
|
-
widthScale: this.props.widthScale * 1.3
|
|
873
|
-
}),
|
|
874
|
-
parameters: OUTLINE_SHADOWMAP_PARAMETERS,
|
|
875
|
-
framebuffer: outlineFramebuffer
|
|
876
|
-
});
|
|
877
|
-
this.state.model.updateModuleSettings({
|
|
878
|
-
outlineEnabled: true,
|
|
879
|
-
outlineRenderShadowmap: false,
|
|
880
|
-
outlineShadowmap: shadowmapTexture
|
|
881
|
-
});
|
|
882
|
-
this.state.model.draw({
|
|
883
|
-
uniforms: Object.assign({}, uniforms, {
|
|
884
|
-
jointType: Number(jointRounded),
|
|
885
|
-
capType: Number(capRounded),
|
|
886
|
-
widthScale: this.props.widthScale
|
|
887
|
-
}),
|
|
888
|
-
parameters: OUTLINE_RENDER_PARAMETERS
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
};
|
|
892
|
-
__publicField(PathOutlineLayer, "layerName", "PathOutlineLayer");
|
|
893
|
-
__publicField(PathOutlineLayer, "defaultProps", defaultProps);
|
|
894
|
-
|
|
895
|
-
// ../layers/src/path-marker-layer/arrow-2d-geometry.ts
|
|
896
|
-
var import_engine = require("@luma.gl/engine");
|
|
897
|
-
var Arrow2DGeometry = class extends import_engine.Geometry {
|
|
898
|
-
constructor(opts = {}) {
|
|
899
|
-
super(
|
|
900
|
-
Object.assign({}, opts, {
|
|
901
|
-
attributes: getArrowAttributes(opts),
|
|
902
|
-
topology: "triangle-list"
|
|
903
|
-
})
|
|
904
|
-
);
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
function getArrowAttributes({ length = 1, headSize = 0.2, tailWidth = 0.05, tailStart = 0.05 }) {
|
|
908
|
-
const texCoords = [
|
|
909
|
-
// HEAD
|
|
910
|
-
0.5,
|
|
911
|
-
1,
|
|
912
|
-
0,
|
|
913
|
-
0.5 - headSize / 2,
|
|
914
|
-
1 - headSize,
|
|
915
|
-
0,
|
|
916
|
-
0.5 + headSize / 2,
|
|
917
|
-
1 - headSize,
|
|
918
|
-
0,
|
|
919
|
-
0.5 - tailWidth / 2,
|
|
920
|
-
tailStart,
|
|
921
|
-
0,
|
|
922
|
-
0.5 + tailWidth / 2,
|
|
923
|
-
1 - headSize,
|
|
924
|
-
0,
|
|
925
|
-
0.5 + tailWidth / 2,
|
|
926
|
-
tailStart,
|
|
927
|
-
0,
|
|
928
|
-
0.5 - tailWidth / 2,
|
|
929
|
-
tailStart,
|
|
930
|
-
0,
|
|
931
|
-
0.5 - tailWidth / 2,
|
|
932
|
-
1 - headSize,
|
|
933
|
-
0,
|
|
934
|
-
0.5 + tailWidth / 2,
|
|
935
|
-
1 - headSize,
|
|
936
|
-
0
|
|
937
|
-
];
|
|
938
|
-
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];
|
|
939
|
-
const positions = new Array(texCoords.length);
|
|
940
|
-
for (let i = 0; i < texCoords.length / 3; i++) {
|
|
941
|
-
const i3 = i * 3;
|
|
942
|
-
positions[i3 + 0] = (texCoords[i3 + 0] - 0.5) * length;
|
|
943
|
-
positions[i3 + 1] = (texCoords[i3 + 1] - 0.5) * length;
|
|
944
|
-
positions[i3 + 2] = 0;
|
|
945
|
-
}
|
|
946
|
-
return {
|
|
947
|
-
positions: { size: 3, value: new Float32Array(positions) },
|
|
948
|
-
normals: { size: 3, value: new Float32Array(normals) },
|
|
949
|
-
texCoords: { size: 2, value: new Float32Array(texCoords) }
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
// ../layers/src/path-marker-layer/create-path-markers.ts
|
|
954
|
-
var import_core2 = require("@math.gl/core");
|
|
955
|
-
function getLineLength(vPoints) {
|
|
956
|
-
let lineLength = 0;
|
|
957
|
-
for (let i = 0; i < vPoints.length - 1; i++) {
|
|
958
|
-
lineLength += vPoints[i].distance(vPoints[i + 1]);
|
|
959
|
-
}
|
|
960
|
-
return lineLength;
|
|
961
|
-
}
|
|
962
|
-
var DEFAULT_COLOR = [0, 0, 0, 255];
|
|
963
|
-
var DEFAULT_DIRECTION = { forward: true, backward: false };
|
|
964
|
-
function createPathMarkers({
|
|
965
|
-
data,
|
|
966
|
-
getPath = (x, context) => x.path,
|
|
967
|
-
getDirection = (x) => x.direction,
|
|
968
|
-
getColor = (x) => DEFAULT_COLOR,
|
|
969
|
-
getMarkerPercentages = (x, info) => [0.5],
|
|
970
|
-
projectFlat
|
|
971
|
-
}) {
|
|
972
|
-
const markers = [];
|
|
973
|
-
for (const object of data) {
|
|
974
|
-
const path = getPath(object, null);
|
|
975
|
-
const direction = getDirection(object) || DEFAULT_DIRECTION;
|
|
976
|
-
const color = getColor(object);
|
|
977
|
-
const vPoints = path.map((p) => new import_core2.Vector2(p));
|
|
978
|
-
const vPointsReverse = vPoints.slice(0).reverse();
|
|
979
|
-
const lineLength = getLineLength(vPoints);
|
|
980
|
-
const percentages = getMarkerPercentages(object, { lineLength });
|
|
981
|
-
for (const percentage of percentages) {
|
|
982
|
-
if (direction.forward) {
|
|
983
|
-
const marker = createMarkerAlongPath({
|
|
984
|
-
path: vPoints,
|
|
985
|
-
percentage,
|
|
986
|
-
lineLength,
|
|
987
|
-
color,
|
|
988
|
-
object,
|
|
989
|
-
projectFlat
|
|
990
|
-
});
|
|
991
|
-
markers.push(marker);
|
|
992
|
-
}
|
|
993
|
-
if (direction.backward) {
|
|
994
|
-
const marker = createMarkerAlongPath({
|
|
995
|
-
path: vPointsReverse,
|
|
996
|
-
percentage,
|
|
997
|
-
lineLength,
|
|
998
|
-
color,
|
|
999
|
-
object,
|
|
1000
|
-
projectFlat
|
|
1001
|
-
});
|
|
1002
|
-
markers.push(marker);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
return markers;
|
|
1007
|
-
}
|
|
1008
|
-
function createMarkerAlongPath({
|
|
1009
|
-
path,
|
|
1010
|
-
percentage,
|
|
1011
|
-
lineLength,
|
|
1012
|
-
color,
|
|
1013
|
-
object,
|
|
1014
|
-
projectFlat
|
|
1015
|
-
}) {
|
|
1016
|
-
const distanceAlong = lineLength * percentage;
|
|
1017
|
-
let currentDistance = 0;
|
|
1018
|
-
let previousDistance = 0;
|
|
1019
|
-
let i = 0;
|
|
1020
|
-
for (i = 0; i < path.length - 1; i++) {
|
|
1021
|
-
currentDistance += path[i].distance(path[i + 1]);
|
|
1022
|
-
if (currentDistance > distanceAlong) {
|
|
1023
|
-
break;
|
|
1024
|
-
}
|
|
1025
|
-
previousDistance = currentDistance;
|
|
1026
|
-
}
|
|
1027
|
-
if (i === path.length - 1) {
|
|
1028
|
-
i -= 1;
|
|
1029
|
-
}
|
|
1030
|
-
const vDirection = path[i + 1].clone().subtract(path[i]).normalize();
|
|
1031
|
-
const along = distanceAlong - previousDistance;
|
|
1032
|
-
const vCenter = vDirection.clone().multiply(new import_core2.Vector2(along, along)).add(path[i]);
|
|
1033
|
-
const vDirection2 = new import_core2.Vector2(projectFlat(path[i + 1])).subtract(projectFlat(path[i]));
|
|
1034
|
-
const angle = vDirection2.verticalAngle() * 180 / Math.PI;
|
|
1035
|
-
return { position: [vCenter.x, vCenter.y, 0], angle, color, object };
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
// ../layers/src/path-marker-layer/polyline.ts
|
|
1039
|
-
var import_core3 = require("@math.gl/core");
|
|
1040
|
-
function getClosestPointOnLine({ p, p1, p2, clampToLine = true }) {
|
|
1041
|
-
const lineVector = new import_core3.Vector3(p2).subtract(p1);
|
|
1042
|
-
const pointVector = new import_core3.Vector3(p).subtract(p1);
|
|
1043
|
-
let dotProduct = lineVector.dot(pointVector);
|
|
1044
|
-
if (clampToLine) {
|
|
1045
|
-
dotProduct = (0, import_core3.clamp)(dotProduct, 0, 1);
|
|
1046
|
-
}
|
|
1047
|
-
return lineVector.lerp(p1, p2, dotProduct);
|
|
1048
|
-
}
|
|
1049
|
-
function getClosestPointOnPolyline({ p, points }) {
|
|
1050
|
-
p = new import_core3.Vector3(p);
|
|
1051
|
-
let pClosest = null;
|
|
1052
|
-
let distanceSquared = Infinity;
|
|
1053
|
-
let index = -1;
|
|
1054
|
-
for (let i = 0; i < points.length - 1; ++i) {
|
|
1055
|
-
const p1 = points[i];
|
|
1056
|
-
const p2 = points[i + 1];
|
|
1057
|
-
const pClosestOnLine = getClosestPointOnLine({ p, p1, p2 });
|
|
1058
|
-
const distanceToLineSquared = p.distanceSquared(pClosestOnLine);
|
|
1059
|
-
if (distanceToLineSquared < distanceSquared) {
|
|
1060
|
-
distanceSquared = distanceToLineSquared;
|
|
1061
|
-
pClosest = pClosestOnLine;
|
|
1062
|
-
index = i;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
return {
|
|
1066
|
-
point: pClosest,
|
|
1067
|
-
index,
|
|
1068
|
-
p1: points[index],
|
|
1069
|
-
p2: points[index + 1],
|
|
1070
|
-
distanceSquared,
|
|
1071
|
-
distance: Math.sqrt(distanceSquared)
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// ../layers/src/path-marker-layer/path-marker-layer.ts
|
|
1076
|
-
var DISTANCE_FOR_MULTI_ARROWS = 0.1;
|
|
1077
|
-
var ARROW_HEAD_SIZE = 0.2;
|
|
1078
|
-
var ARROW_TAIL_WIDTH = 0.05;
|
|
1079
|
-
var DEFAULT_MARKER_LAYER = import_mesh_layers.SimpleMeshLayer;
|
|
1080
|
-
var DEFAULT_MARKER_LAYER_PROPS = {
|
|
1081
|
-
mesh: new Arrow2DGeometry({ headSize: ARROW_HEAD_SIZE, tailWidth: ARROW_TAIL_WIDTH })
|
|
1082
|
-
};
|
|
1083
|
-
var defaultProps2 = Object.assign(
|
|
1084
|
-
{},
|
|
1085
|
-
PathOutlineLayer.defaultProps,
|
|
1086
|
-
{
|
|
1087
|
-
MarkerLayer: DEFAULT_MARKER_LAYER,
|
|
1088
|
-
markerLayerProps: DEFAULT_MARKER_LAYER_PROPS,
|
|
1089
|
-
sizeScale: 100,
|
|
1090
|
-
fp64: false,
|
|
1091
|
-
highlightIndex: -1,
|
|
1092
|
-
highlightPoint: null,
|
|
1093
|
-
getPath: (x) => x.path,
|
|
1094
|
-
getColor: (x) => x.color,
|
|
1095
|
-
getMarkerColor: (x) => [0, 0, 0, 255],
|
|
1096
|
-
getDirection: (x) => x.direction,
|
|
1097
|
-
getMarkerPercentages: (object, { lineLength }) => lineLength > DISTANCE_FOR_MULTI_ARROWS ? [0.25, 0.5, 0.75] : [0.5]
|
|
1098
|
-
}
|
|
1099
|
-
);
|
|
1100
|
-
var PathMarkerLayer = class extends import_core4.CompositeLayer {
|
|
1101
|
-
state = void 0;
|
|
1102
|
-
initializeState() {
|
|
1103
|
-
this.state = {
|
|
1104
|
-
markers: [],
|
|
1105
|
-
mesh: new Arrow2DGeometry({ headSize: ARROW_HEAD_SIZE, tailWidth: ARROW_TAIL_WIDTH }),
|
|
1106
|
-
closestPoint: null,
|
|
1107
|
-
closestPoints: []
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
projectFlat(xyz, viewport, coordinateSystem, coordinateOrigin) {
|
|
1111
|
-
if (coordinateSystem === import_core4.COORDINATE_SYSTEM.METER_OFFSETS) {
|
|
1112
|
-
const [dx, dy] = viewport.metersToLngLatDelta(xyz);
|
|
1113
|
-
const [x, y] = coordinateOrigin;
|
|
1114
|
-
return viewport.projectFlat([x + dx, dy + y]);
|
|
1115
|
-
} else if (coordinateSystem === import_core4.COORDINATE_SYSTEM.LNGLAT_OFFSETS) {
|
|
1116
|
-
const [dx, dy] = xyz;
|
|
1117
|
-
const [x, y] = coordinateOrigin;
|
|
1118
|
-
return viewport.projectFlat([x + dx, dy + y]);
|
|
1119
|
-
}
|
|
1120
|
-
return viewport.projectFlat(xyz);
|
|
1121
|
-
}
|
|
1122
|
-
updateState({ props, oldProps, changeFlags }) {
|
|
1123
|
-
if (changeFlags.dataChanged || changeFlags.updateTriggersChanged) {
|
|
1124
|
-
const {
|
|
1125
|
-
data,
|
|
1126
|
-
getPath,
|
|
1127
|
-
getDirection,
|
|
1128
|
-
getMarkerColor,
|
|
1129
|
-
getMarkerPercentages,
|
|
1130
|
-
coordinateSystem,
|
|
1131
|
-
coordinateOrigin
|
|
1132
|
-
} = this.props;
|
|
1133
|
-
const { viewport } = this.context;
|
|
1134
|
-
const projectFlat = (o) => this.projectFlat(o, viewport, coordinateSystem, coordinateOrigin);
|
|
1135
|
-
this.state.markers = createPathMarkers({
|
|
1136
|
-
data,
|
|
1137
|
-
getPath,
|
|
1138
|
-
getDirection,
|
|
1139
|
-
getColor: getMarkerColor,
|
|
1140
|
-
getMarkerPercentages,
|
|
1141
|
-
projectFlat
|
|
1142
|
-
});
|
|
1143
|
-
this._recalculateClosestPoint();
|
|
1144
|
-
}
|
|
1145
|
-
if (changeFlags.propsChanged) {
|
|
1146
|
-
if (props.point !== oldProps.point) {
|
|
1147
|
-
this._recalculateClosestPoint();
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
_recalculateClosestPoint() {
|
|
1152
|
-
const { highlightPoint, highlightIndex } = this.props;
|
|
1153
|
-
if (highlightPoint && highlightIndex >= 0) {
|
|
1154
|
-
const object = this.props.data[highlightIndex];
|
|
1155
|
-
const points = this.props.getPath(object, null);
|
|
1156
|
-
const { point: point14 } = getClosestPointOnPolyline({ points, p: highlightPoint });
|
|
1157
|
-
this.state.closestPoints = [{ position: point14 }];
|
|
1158
|
-
} else {
|
|
1159
|
-
this.state.closestPoints = [];
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
getPickingInfo({ info }) {
|
|
1163
|
-
return Object.assign(info, {
|
|
1164
|
-
// override object with picked feature
|
|
1165
|
-
object: info.object && info.object.path || info.object
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
renderLayers() {
|
|
1169
|
-
return [
|
|
1170
|
-
new PathOutlineLayer(
|
|
1171
|
-
this.props,
|
|
1172
|
-
this.getSubLayerProps({
|
|
1173
|
-
id: "paths",
|
|
1174
|
-
// Note: data has to be passed explicitly like this to avoid being empty
|
|
1175
|
-
data: this.props.data
|
|
1176
|
-
})
|
|
1177
|
-
),
|
|
1178
|
-
new this.props.MarkerLayer(
|
|
1179
|
-
this.getSubLayerProps(
|
|
1180
|
-
Object.assign({}, this.props.markerLayerProps, {
|
|
1181
|
-
id: "markers",
|
|
1182
|
-
data: this.state.markers,
|
|
1183
|
-
getOrientation: (x) => [0, -x.angle, 0],
|
|
1184
|
-
getColor: (x) => x.color,
|
|
1185
|
-
sizeScale: this.props.sizeScale,
|
|
1186
|
-
fp64: this.props.fp64,
|
|
1187
|
-
pickable: false,
|
|
1188
|
-
parameters: {
|
|
1189
|
-
blend: false,
|
|
1190
|
-
depthTest: false
|
|
1191
|
-
}
|
|
1192
|
-
})
|
|
1193
|
-
)
|
|
1194
|
-
),
|
|
1195
|
-
this.state.closestPoints && new import_layers5.ScatterplotLayer({
|
|
1196
|
-
id: `${this.props.id}-highlight`,
|
|
1197
|
-
data: this.state.closestPoints,
|
|
1198
|
-
fp64: this.props.fp64
|
|
1199
|
-
})
|
|
1200
|
-
];
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
__publicField(PathMarkerLayer, "layerName", "PathMarkerLayer");
|
|
1204
|
-
__publicField(PathMarkerLayer, "defaultProps", defaultProps2);
|
|
1205
|
-
|
|
1206
664
|
// dist/lib/layers/segments-layer.js
|
|
665
|
+
var import_layers4 = require("@deck.gl-community/layers");
|
|
1207
666
|
var NEBULA_TO_DECK_DIRECTIONS = {
|
|
1208
667
|
[ArrowStyles.NONE]: { forward: false, backward: false },
|
|
1209
668
|
[ArrowStyles.FORWARD]: { forward: true, backward: false },
|
|
@@ -1259,7 +718,7 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
1259
718
|
render({ nebula }) {
|
|
1260
719
|
const defaultColor = [0, 0, 0, 255];
|
|
1261
720
|
const { objects, updateTrigger } = this.deckCache;
|
|
1262
|
-
return new PathMarkerLayer({
|
|
721
|
+
return new import_layers4.PathMarkerLayer({
|
|
1263
722
|
id: `segments-${this.id}`,
|
|
1264
723
|
data: objects,
|
|
1265
724
|
opacity: 1,
|
|
@@ -1285,7 +744,7 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
1285
744
|
highlightColor: toDeckColor(this.highlightColor),
|
|
1286
745
|
dashJustified: this.dashed,
|
|
1287
746
|
getDashArray: this.dashed ? (nf) => nf.style.dashArray : void 0,
|
|
1288
|
-
markerLayerProps: this.markerLayerProps || PathMarkerLayer.defaultProps.markerLayerProps,
|
|
747
|
+
markerLayerProps: this.markerLayerProps || import_layers4.PathMarkerLayer.defaultProps.markerLayerProps,
|
|
1289
748
|
nebulaLayer: this
|
|
1290
749
|
});
|
|
1291
750
|
}
|
|
@@ -1293,12 +752,12 @@ var SegmentsLayer = class extends NebulaLayer {
|
|
|
1293
752
|
|
|
1294
753
|
// dist/lib/nebula-core.js
|
|
1295
754
|
var import_eventemitter32 = require("eventemitter3");
|
|
1296
|
-
var
|
|
755
|
+
var import_core2 = require("@deck.gl/core");
|
|
1297
756
|
var LOGGER_PREFIX = "Nebula: ";
|
|
1298
757
|
var NebulaCore = class {
|
|
1299
758
|
init(props) {
|
|
1300
759
|
this.props = props;
|
|
1301
|
-
this.wmViewport = new
|
|
760
|
+
this.wmViewport = new import_core2.WebMercatorViewport(this.props.viewport);
|
|
1302
761
|
["click", "mousemove", "mouseup", "mousedown"].forEach((name) => document.addEventListener(name, this._onMouseEvent, true));
|
|
1303
762
|
}
|
|
1304
763
|
detach() {
|
|
@@ -1307,7 +766,7 @@ var NebulaCore = class {
|
|
|
1307
766
|
updateProps(newProps) {
|
|
1308
767
|
this.props = newProps;
|
|
1309
768
|
const { viewport } = this.props;
|
|
1310
|
-
this.wmViewport = new
|
|
769
|
+
this.wmViewport = new import_core2.WebMercatorViewport(viewport);
|
|
1311
770
|
}
|
|
1312
771
|
props = null;
|
|
1313
772
|
deckgl = null;
|
|
@@ -1508,7 +967,7 @@ var NebulaCore = class {
|
|
|
1508
967
|
};
|
|
1509
968
|
|
|
1510
969
|
// dist/editable-layers/editable-geojson-layer.js
|
|
1511
|
-
var
|
|
970
|
+
var import_layers6 = require("@deck.gl/layers");
|
|
1512
971
|
|
|
1513
972
|
// dist/edit-modes/geojson-edit-mode.js
|
|
1514
973
|
var import_union = __toESM(require("@turf/union"), 1);
|
|
@@ -4527,9 +3986,9 @@ var DeleteMode = class extends GeoJsonEditMode {
|
|
|
4527
3986
|
var PROJECTED_PIXEL_SIZE_MULTIPLIER2 = 2 / 3;
|
|
4528
3987
|
|
|
4529
3988
|
// dist/editable-layers/editable-layer.js
|
|
4530
|
-
var
|
|
3989
|
+
var import_core3 = require("@deck.gl/core");
|
|
4531
3990
|
var EVENT_TYPES = ["click", "pointermove", "panstart", "panmove", "panend", "keyup", "dblclick"];
|
|
4532
|
-
var EditableLayer = class extends
|
|
3991
|
+
var EditableLayer = class extends import_core3.CompositeLayer {
|
|
4533
3992
|
state = void 0;
|
|
4534
3993
|
// Overridable interaction event handlers
|
|
4535
3994
|
onLayerClick(event) {
|
|
@@ -4722,7 +4181,7 @@ var EditableLayer = class extends import_core6.CompositeLayer {
|
|
|
4722
4181
|
__publicField(EditableLayer, "layerName", "EditableLayer");
|
|
4723
4182
|
|
|
4724
4183
|
// dist/editable-layers/editable-path-layer.js
|
|
4725
|
-
var
|
|
4184
|
+
var import_layers5 = require("@deck.gl/layers");
|
|
4726
4185
|
var uniformBlock = `uniform pickingLineWidthUniforms {
|
|
4727
4186
|
float extraPixels;
|
|
4728
4187
|
} pickingLineWidth;
|
|
@@ -4735,11 +4194,11 @@ var pickingUniforms = {
|
|
|
4735
4194
|
extraPixels: "f32"
|
|
4736
4195
|
}
|
|
4737
4196
|
};
|
|
4738
|
-
var
|
|
4739
|
-
...
|
|
4197
|
+
var defaultProps = {
|
|
4198
|
+
...import_layers5.PathLayer.defaultProps,
|
|
4740
4199
|
pickingLineWidthExtraPixels: { type: "number", min: 0, value: Number.MAX_SAFE_INTEGER }
|
|
4741
4200
|
};
|
|
4742
|
-
var EditablePathLayer = class extends
|
|
4201
|
+
var EditablePathLayer = class extends import_layers5.PathLayer {
|
|
4743
4202
|
getShaders() {
|
|
4744
4203
|
const shaders = super.getShaders();
|
|
4745
4204
|
shaders.vs = insertBefore(shaders.vs, "vec3 width;", `
|
|
@@ -4760,7 +4219,7 @@ var EditablePathLayer = class extends import_layers6.PathLayer {
|
|
|
4760
4219
|
super.draw(props);
|
|
4761
4220
|
}
|
|
4762
4221
|
};
|
|
4763
|
-
EditablePathLayer.defaultProps =
|
|
4222
|
+
EditablePathLayer.defaultProps = defaultProps;
|
|
4764
4223
|
EditablePathLayer.layerName = "EditablePathLayer";
|
|
4765
4224
|
|
|
4766
4225
|
// dist/editable-layers/editable-geojson-layer.js
|
|
@@ -4818,7 +4277,7 @@ function getEditHandleRadius(handle) {
|
|
|
4818
4277
|
return DEFAULT_EDITING_INTERMEDIATE_POINT_RADIUS;
|
|
4819
4278
|
}
|
|
4820
4279
|
}
|
|
4821
|
-
var
|
|
4280
|
+
var defaultProps2 = {
|
|
4822
4281
|
mode: DEFAULT_EDIT_MODE,
|
|
4823
4282
|
// Edit and interaction events
|
|
4824
4283
|
onEdit: () => {
|
|
@@ -4950,7 +4409,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
4950
4409
|
getLineWidth: [this.props.selectedFeatureIndexes, this.props.mode]
|
|
4951
4410
|
}
|
|
4952
4411
|
});
|
|
4953
|
-
let layers = [new
|
|
4412
|
+
let layers = [new import_layers6.GeoJsonLayer(subLayerProps)];
|
|
4954
4413
|
layers = layers.concat(this.createGuidesLayers(), this.createTooltipsLayers());
|
|
4955
4414
|
return layers;
|
|
4956
4415
|
}
|
|
@@ -5064,7 +4523,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
5064
4523
|
};
|
|
5065
4524
|
if (this.props.editHandleType === "icon") {
|
|
5066
4525
|
subLayerProps["points-icon"] = {
|
|
5067
|
-
type:
|
|
4526
|
+
type: import_layers6.IconLayer,
|
|
5068
4527
|
iconAtlas: this.props.editHandleIconAtlas,
|
|
5069
4528
|
iconMapping: this.props.editHandleIconMapping,
|
|
5070
4529
|
sizeUnits: this.props.editHandleIconSizeUnits,
|
|
@@ -5077,7 +4536,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
5077
4536
|
};
|
|
5078
4537
|
} else {
|
|
5079
4538
|
subLayerProps["points-circle"] = {
|
|
5080
|
-
type:
|
|
4539
|
+
type: import_layers6.ScatterplotLayer,
|
|
5081
4540
|
radiusScale: this.props.editHandlePointRadiusScale,
|
|
5082
4541
|
stroked: this.props.editHandlePointOutline,
|
|
5083
4542
|
getLineWidth: this.props.editHandlePointStrokeWidth,
|
|
@@ -5090,7 +4549,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
5090
4549
|
billboard: this.props.billboard
|
|
5091
4550
|
};
|
|
5092
4551
|
}
|
|
5093
|
-
const layer = new
|
|
4552
|
+
const layer = new import_layers6.GeoJsonLayer(this.getSubLayerProps({
|
|
5094
4553
|
id: "guides",
|
|
5095
4554
|
data: guides,
|
|
5096
4555
|
fp64: this.props.fp64,
|
|
@@ -5113,7 +4572,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
5113
4572
|
createTooltipsLayers() {
|
|
5114
4573
|
const mode = this.getActiveMode();
|
|
5115
4574
|
const tooltips = mode.getTooltips(this.getModeProps(this.props));
|
|
5116
|
-
const layer = new
|
|
4575
|
+
const layer = new import_layers6.TextLayer({
|
|
5117
4576
|
getSize: DEFAULT_TOOLTIP_FONT_SIZE,
|
|
5118
4577
|
...this.getSubLayerProps({
|
|
5119
4578
|
id: "tooltips",
|
|
@@ -5161,7 +4620,7 @@ var EditableGeoJsonLayer = class extends EditableLayer {
|
|
|
5161
4620
|
}
|
|
5162
4621
|
};
|
|
5163
4622
|
__publicField(EditableGeoJsonLayer, "layerName", "EditableGeoJsonLayer");
|
|
5164
|
-
__publicField(EditableGeoJsonLayer, "defaultProps",
|
|
4623
|
+
__publicField(EditableGeoJsonLayer, "defaultProps", defaultProps2);
|
|
5165
4624
|
|
|
5166
4625
|
// dist/editable-layers/editable-h3-cluster-layer.js
|
|
5167
4626
|
var import_geo_layers = require("@deck.gl/geo-layers");
|
|
@@ -5171,7 +4630,7 @@ var EMPTY_FEATURE_COLLECTION = {
|
|
|
5171
4630
|
type: "FeatureCollection",
|
|
5172
4631
|
features: []
|
|
5173
4632
|
};
|
|
5174
|
-
var
|
|
4633
|
+
var defaultProps3 = {
|
|
5175
4634
|
mode: DEFAULT_EDIT_MODE2,
|
|
5176
4635
|
...EditableGeoJsonLayer.defaultProps,
|
|
5177
4636
|
// h3 layer
|
|
@@ -5310,11 +4769,11 @@ var EditableH3ClusterLayer = class extends EditableLayer {
|
|
|
5310
4769
|
}
|
|
5311
4770
|
};
|
|
5312
4771
|
__publicField(EditableH3ClusterLayer, "layerName", "EditableH3ClusterLayer");
|
|
5313
|
-
__publicField(EditableH3ClusterLayer, "defaultProps",
|
|
4772
|
+
__publicField(EditableH3ClusterLayer, "defaultProps", defaultProps3);
|
|
5314
4773
|
|
|
5315
4774
|
// dist/editable-layers/selection-layer.js
|
|
5316
|
-
var
|
|
5317
|
-
var
|
|
4775
|
+
var import_core4 = require("@deck.gl/core");
|
|
4776
|
+
var import_layers7 = require("@deck.gl/layers");
|
|
5318
4777
|
var import_helpers16 = require("@turf/helpers");
|
|
5319
4778
|
var import_buffer3 = __toESM(require("@turf/buffer"), 1);
|
|
5320
4779
|
var import_difference4 = __toESM(require("@turf/difference"), 1);
|
|
@@ -5330,7 +4789,7 @@ var MODE_MAP = {
|
|
|
5330
4789
|
var MODE_CONFIG_MAP = {
|
|
5331
4790
|
[SELECTION_TYPE2.RECTANGLE]: { dragToDraw: true }
|
|
5332
4791
|
};
|
|
5333
|
-
var
|
|
4792
|
+
var defaultProps4 = {
|
|
5334
4793
|
selectionType: SELECTION_TYPE2.RECTANGLE,
|
|
5335
4794
|
layerIds: [],
|
|
5336
4795
|
onSelect: () => {
|
|
@@ -5365,7 +4824,7 @@ var PASS_THROUGH_PROPS = [
|
|
|
5365
4824
|
"getTentativeFillColor",
|
|
5366
4825
|
"getTentativeLineWidth"
|
|
5367
4826
|
];
|
|
5368
|
-
var SelectionLayer = class extends
|
|
4827
|
+
var SelectionLayer = class extends import_core4.CompositeLayer {
|
|
5369
4828
|
state = void 0;
|
|
5370
4829
|
_selectRectangleObjects(coordinates) {
|
|
5371
4830
|
const { layerIds, onSelect } = this.props;
|
|
@@ -5449,7 +4908,7 @@ var SelectionLayer = class extends import_core7.CompositeLayer {
|
|
|
5449
4908
|
];
|
|
5450
4909
|
if (pendingPolygonSelection) {
|
|
5451
4910
|
const { bigPolygon } = pendingPolygonSelection;
|
|
5452
|
-
layers.push(new
|
|
4911
|
+
layers.push(new import_layers7.PolygonLayer(this.getSubLayerProps({
|
|
5453
4912
|
id: LAYER_ID_BLOCKER,
|
|
5454
4913
|
pickable: true,
|
|
5455
4914
|
stroked: false,
|
|
@@ -5467,19 +4926,19 @@ var SelectionLayer = class extends import_core7.CompositeLayer {
|
|
|
5467
4926
|
}
|
|
5468
4927
|
};
|
|
5469
4928
|
__publicField(SelectionLayer, "layerName", "SelectionLayer");
|
|
5470
|
-
__publicField(SelectionLayer, "defaultProps",
|
|
4929
|
+
__publicField(SelectionLayer, "defaultProps", defaultProps4);
|
|
5471
4930
|
|
|
5472
4931
|
// dist/editable-layers/elevated-edit-handle-layer.js
|
|
5473
|
-
var
|
|
5474
|
-
var
|
|
5475
|
-
var
|
|
5476
|
-
var ElevatedEditHandleLayer = class extends
|
|
4932
|
+
var import_core5 = require("@deck.gl/core");
|
|
4933
|
+
var import_layers8 = require("@deck.gl/layers");
|
|
4934
|
+
var defaultProps5 = {};
|
|
4935
|
+
var ElevatedEditHandleLayer = class extends import_core5.CompositeLayer {
|
|
5477
4936
|
renderLayers() {
|
|
5478
|
-
const handles = new
|
|
4937
|
+
const handles = new import_layers8.ScatterplotLayer(Object.assign({}, this.props, {
|
|
5479
4938
|
id: `${this.props.id}-ScatterplotLayer`,
|
|
5480
4939
|
data: this.props.data
|
|
5481
4940
|
}));
|
|
5482
|
-
const lines = new
|
|
4941
|
+
const lines = new import_layers8.LineLayer(Object.assign({}, this.props, {
|
|
5483
4942
|
id: `${this.props.id}-LineLayer`,
|
|
5484
4943
|
data: this.props.data,
|
|
5485
4944
|
pickable: false,
|
|
@@ -5492,12 +4951,12 @@ var ElevatedEditHandleLayer = class extends import_core8.CompositeLayer {
|
|
|
5492
4951
|
}
|
|
5493
4952
|
};
|
|
5494
4953
|
__publicField(ElevatedEditHandleLayer, "layerName", "ElevatedEditHandleLayer");
|
|
5495
|
-
__publicField(ElevatedEditHandleLayer, "defaultProps",
|
|
4954
|
+
__publicField(ElevatedEditHandleLayer, "defaultProps", defaultProps5);
|
|
5496
4955
|
|
|
5497
4956
|
// dist/widgets/edit-mode-tray-widget.js
|
|
5498
4957
|
var import_jsx_runtime = require("preact/jsx-runtime");
|
|
5499
4958
|
var import_preact = require("preact");
|
|
5500
|
-
var
|
|
4959
|
+
var import_core6 = require("@deck.gl/core");
|
|
5501
4960
|
var ROOT_STYLE = {
|
|
5502
4961
|
position: "absolute",
|
|
5503
4962
|
display: "flex",
|
|
@@ -5541,7 +5000,7 @@ var BUTTON_LABEL_STYLE = {
|
|
|
5541
5000
|
marginTop: "2px",
|
|
5542
5001
|
lineHeight: "12px"
|
|
5543
5002
|
};
|
|
5544
|
-
var _EditModeTrayWidget = class extends
|
|
5003
|
+
var _EditModeTrayWidget = class extends import_core6.Widget {
|
|
5545
5004
|
placement = "top-left";
|
|
5546
5005
|
className = "deck-widget-edit-mode-tray";
|
|
5547
5006
|
layout = "vertical";
|