@deck.gl/extensions 9.3.0-alpha.5 → 9.3.0-beta.1
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/data-filter/shader-module.d.ts +18 -4
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js.map +1 -1
- package/dist/dist.dev.js +251 -11
- package/dist/fp64/fp64-extension.d.ts.map +1 -1
- package/dist/fp64/fp64-extension.js +2 -3
- package/dist/fp64/fp64-extension.js.map +1 -1
- package/dist/index.cjs +230 -11
- package/dist/index.cjs.map +3 -3
- package/dist/path-style/path-style-extension.d.ts +2 -1
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +53 -14
- package/dist/path-style/path-style-extension.js.map +1 -1
- package/dist/path-style/shaders.glsl.d.ts +18 -0
- package/dist/path-style/shaders.glsl.d.ts.map +1 -1
- package/dist/path-style/shaders.glsl.js +182 -0
- package/dist/path-style/shaders.glsl.js.map +1 -1
- package/dist.min.js +217 -53
- package/package.json +6 -5
- package/src/data-filter/shader-module.ts +22 -7
- package/src/fp64/fp64-extension.ts +2 -5
- package/src/path-style/path-style-extension.ts +67 -14
- package/src/path-style/shaders.glsl.ts +213 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
1
|
+
import type { ShaderModule, UniformTypes } from '@luma.gl/shadertools';
|
|
2
2
|
import type { DataFilterExtensionOptions, DataFilterExtensionProps } from "./data-filter-extension.js";
|
|
3
3
|
export type Defines = {
|
|
4
4
|
/**
|
|
@@ -23,11 +23,25 @@ export type DataFilterModuleProps = {
|
|
|
23
23
|
extensions: any[];
|
|
24
24
|
categoryBitMask?: CategoryBitMask;
|
|
25
25
|
} & DataFilterExtensionProps;
|
|
26
|
-
type
|
|
27
|
-
|
|
26
|
+
type DataFilterUniforms = {
|
|
27
|
+
useSoftMargin: boolean;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
transformSize: boolean;
|
|
30
|
+
transformColor: boolean;
|
|
31
|
+
min: [number, number, number, number];
|
|
32
|
+
softMin: [number, number, number, number];
|
|
33
|
+
softMax: [number, number, number, number];
|
|
34
|
+
max: [number, number, number, number];
|
|
35
|
+
min64High: [number, number, number, number];
|
|
36
|
+
max64High: [number, number, number, number];
|
|
37
|
+
categoryBitMask: [number, number, number, number];
|
|
38
|
+
};
|
|
39
|
+
type DataFilterUniformTypeMap = Required<UniformTypes<DataFilterUniforms>>;
|
|
40
|
+
type UniformTypesFunc = (opts: DataFilterExtensionOptions) => DataFilterUniformTypeMap;
|
|
41
|
+
export declare const dataFilter: ShaderModule<DataFilterModuleProps, DataFilterUniforms> & {
|
|
28
42
|
uniformTypesFromOptions: UniformTypesFunc;
|
|
29
43
|
};
|
|
30
|
-
export declare const dataFilter64: ShaderModule<DataFilterModuleProps> & {
|
|
44
|
+
export declare const dataFilter64: ShaderModule<DataFilterModuleProps, DataFilterUniforms> & {
|
|
31
45
|
uniformTypesFromOptions: UniformTypesFunc;
|
|
32
46
|
};
|
|
33
47
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAC,0BAA0B,EAAE,wBAAwB,EAAC,mCAAgC;AAKlG,MAAM,MAAM,OAAO,GAAG;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IACzD;;OAEG;IACH,qBAAqB,CAAC,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BAAwB,CAAC;AAmBvF,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,GAAG;IACjF,uBAAuB,EAAE,gBAAgB,CAAC;CAQ3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,GAAG;IACnF,uBAAuB,EAAE,gBAAgB,CAAC;CAQ3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-module.js","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;
|
|
1
|
+
{"version":3,"file":"shader-module.js","sourceRoot":"","sources":["../../src/data-filter/shader-module.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AA8BpC,MAAM,YAAY,GAAG,UAAU,CAAC;;;;;;;;;;;;;;CAc/B,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKzB,CAAC;AAEF,MAAM,EAAE,GAAG;EACT,YAAY;EACZ,MAAM;CACP,CAAC;AAEF,MAAM,QAAQ,GAAG,UAAU,CAAC;;CAE3B,CAAC;AAEF,MAAM,EAAE,GAAG;EACT,YAAY;EACZ,QAAQ;CACT,CAAC;AAwBF,8BAA8B;AAC9B,SAAS,WAAW,CAAC,IAAiC;IACpD,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,EACJ,WAAW,GAAG,CAAC,CAAC,CAAC,EA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}
|
package/dist/dist.dev.js
CHANGED
|
@@ -2736,7 +2736,7 @@ vec4 project_position_to_clipspace(
|
|
|
2736
2736
|
var Fp64Extension = class extends import_core6.LayerExtension {
|
|
2737
2737
|
getShaders() {
|
|
2738
2738
|
const { coordinateSystem } = this.props;
|
|
2739
|
-
if (coordinateSystem !==
|
|
2739
|
+
if (coordinateSystem !== "lnglat" && coordinateSystem !== "default") {
|
|
2740
2740
|
throw new Error("fp64: coordinateSystem must be LNGLAT");
|
|
2741
2741
|
}
|
|
2742
2742
|
return {
|
|
@@ -2825,6 +2825,209 @@ in float vDashOffset;
|
|
|
2825
2825
|
}
|
|
2826
2826
|
}
|
|
2827
2827
|
}
|
|
2828
|
+
`
|
|
2829
|
+
}
|
|
2830
|
+
};
|
|
2831
|
+
var scatterplotDashShaders = {
|
|
2832
|
+
inject: {
|
|
2833
|
+
"vs:#decl": `
|
|
2834
|
+
in vec2 instanceDashArrays;
|
|
2835
|
+
out vec2 vDashArray;
|
|
2836
|
+
`,
|
|
2837
|
+
"vs:#main-end": `
|
|
2838
|
+
vDashArray = instanceDashArrays;
|
|
2839
|
+
`,
|
|
2840
|
+
"fs:#decl": `
|
|
2841
|
+
layout(std140) uniform pathStyleUniforms {
|
|
2842
|
+
bool dashGapPickable;
|
|
2843
|
+
} pathStyle;
|
|
2844
|
+
|
|
2845
|
+
in vec2 vDashArray;
|
|
2846
|
+
|
|
2847
|
+
#define PI 3.141592653589793
|
|
2848
|
+
`,
|
|
2849
|
+
"fs:#main-start": `
|
|
2850
|
+
bool inDashGap = false;
|
|
2851
|
+
float dashUnitLength = vDashArray.x + vDashArray.y;
|
|
2852
|
+
if (dashUnitLength > 0.0 && scatterplot.stroked > 0.5) {
|
|
2853
|
+
float _distToCenter = length(unitPosition) * outerRadiusPixels;
|
|
2854
|
+
float innerRadius = innerUnitRadius * outerRadiusPixels;
|
|
2855
|
+
if (_distToCenter >= innerRadius) {
|
|
2856
|
+
float strokeWidth = (1.0 - innerUnitRadius) * outerRadiusPixels;
|
|
2857
|
+
float midStrokeRadius = (innerUnitRadius + 1.0) * 0.5 * outerRadiusPixels;
|
|
2858
|
+
float angle = atan(unitPosition.y, unitPosition.x) + PI;
|
|
2859
|
+
float circumference = 2.0 * PI * midStrokeRadius;
|
|
2860
|
+
float posAlongStroke = (angle / (2.0 * PI)) * circumference / strokeWidth;
|
|
2861
|
+
float unitOffset = mod(posAlongStroke, dashUnitLength);
|
|
2862
|
+
if (unitOffset > vDashArray.x) {
|
|
2863
|
+
if (scatterplot.filled > 0.5) {
|
|
2864
|
+
inDashGap = true;
|
|
2865
|
+
} else {
|
|
2866
|
+
if (!(pathStyle.dashGapPickable && bool(picking.isActive))) {
|
|
2867
|
+
discard;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
`,
|
|
2874
|
+
"fs:#main-end": `
|
|
2875
|
+
if (inDashGap) {
|
|
2876
|
+
float alphaFactor = fragColor.a / max(vLineColor.a, 0.001);
|
|
2877
|
+
fragColor = vec4(vFillColor.rgb, vFillColor.a * alphaFactor);
|
|
2878
|
+
fragColor = picking_filterPickingColor(fragColor);
|
|
2879
|
+
fragColor = picking_filterHighlightColor(fragColor);
|
|
2880
|
+
}
|
|
2881
|
+
`
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
var textBackgroundDashShaders = {
|
|
2885
|
+
inject: {
|
|
2886
|
+
"vs:#decl": `
|
|
2887
|
+
in vec2 instanceDashArrays;
|
|
2888
|
+
out vec2 vDashArray;
|
|
2889
|
+
`,
|
|
2890
|
+
"vs:#main-end": `
|
|
2891
|
+
vDashArray = instanceDashArrays;
|
|
2892
|
+
`,
|
|
2893
|
+
"fs:#decl": `
|
|
2894
|
+
layout(std140) uniform pathStyleUniforms {
|
|
2895
|
+
bool dashGapPickable;
|
|
2896
|
+
} pathStyle;
|
|
2897
|
+
|
|
2898
|
+
in vec2 vDashArray;
|
|
2899
|
+
|
|
2900
|
+
#define PI 3.141592653589793
|
|
2901
|
+
|
|
2902
|
+
// Calculate position along rounded rectangle perimeter in stroke-width units
|
|
2903
|
+
float getPerimeterPosition(vec2 fragUV, vec2 dims, vec4 radii, float lineWidth) {
|
|
2904
|
+
float width = dims.x;
|
|
2905
|
+
float height = dims.y;
|
|
2906
|
+
|
|
2907
|
+
float maxRadius = min(width, height) * 0.5;
|
|
2908
|
+
float rBL = min(radii.w, maxRadius);
|
|
2909
|
+
float rTL = min(radii.z, maxRadius);
|
|
2910
|
+
float rTR = min(radii.x, maxRadius);
|
|
2911
|
+
float rBR = min(radii.y, maxRadius);
|
|
2912
|
+
|
|
2913
|
+
vec2 p = fragUV * dims;
|
|
2914
|
+
|
|
2915
|
+
float leftLen = height - rBL - rTL;
|
|
2916
|
+
float topLen = width - rTL - rTR;
|
|
2917
|
+
float rightLen = height - rTR - rBR;
|
|
2918
|
+
float bottomLen = width - rBR - rBL;
|
|
2919
|
+
|
|
2920
|
+
float arcBL = PI * 0.5 * rBL;
|
|
2921
|
+
float arcTL = PI * 0.5 * rTL;
|
|
2922
|
+
float arcTR = PI * 0.5 * rTR;
|
|
2923
|
+
float arcBR = PI * 0.5 * rBR;
|
|
2924
|
+
|
|
2925
|
+
float pos = 0.0;
|
|
2926
|
+
|
|
2927
|
+
float distLeft = p.x;
|
|
2928
|
+
float distRight = width - p.x;
|
|
2929
|
+
float distBottom = p.y;
|
|
2930
|
+
float distTop = height - p.y;
|
|
2931
|
+
float minDist = min(min(distLeft, distRight), min(distBottom, distTop));
|
|
2932
|
+
|
|
2933
|
+
if (p.x < rBL && p.y < rBL) {
|
|
2934
|
+
vec2 c = vec2(rBL, rBL);
|
|
2935
|
+
vec2 d = p - c;
|
|
2936
|
+
float angle = atan(-d.x, -d.y);
|
|
2937
|
+
pos = angle / (PI * 0.5) * arcBL;
|
|
2938
|
+
} else if (p.x < rTL && p.y > height - rTL) {
|
|
2939
|
+
vec2 c = vec2(rTL, height - rTL);
|
|
2940
|
+
vec2 d = p - c;
|
|
2941
|
+
float angle = atan(d.y, -d.x);
|
|
2942
|
+
pos = arcBL + leftLen + angle / (PI * 0.5) * arcTL;
|
|
2943
|
+
} else if (p.x > width - rTR && p.y > height - rTR) {
|
|
2944
|
+
vec2 c = vec2(width - rTR, height - rTR);
|
|
2945
|
+
vec2 d = p - c;
|
|
2946
|
+
float angle = atan(d.x, d.y);
|
|
2947
|
+
pos = arcBL + leftLen + arcTL + topLen + angle / (PI * 0.5) * arcTR;
|
|
2948
|
+
} else if (p.x > width - rBR && p.y < rBR) {
|
|
2949
|
+
vec2 c = vec2(width - rBR, rBR);
|
|
2950
|
+
vec2 d = p - c;
|
|
2951
|
+
float angle = atan(-d.y, d.x);
|
|
2952
|
+
pos = arcBL + leftLen + arcTL + topLen + arcTR + rightLen + angle / (PI * 0.5) * arcBR;
|
|
2953
|
+
} else if (minDist == distLeft) {
|
|
2954
|
+
pos = arcBL + clamp(p.y - rBL, 0.0, leftLen);
|
|
2955
|
+
} else if (minDist == distTop) {
|
|
2956
|
+
pos = arcBL + leftLen + arcTL + clamp(p.x - rTL, 0.0, topLen);
|
|
2957
|
+
} else if (minDist == distRight) {
|
|
2958
|
+
pos = arcBL + leftLen + arcTL + topLen + arcTR + clamp(height - rTR - p.y, 0.0, rightLen);
|
|
2959
|
+
} else {
|
|
2960
|
+
pos = arcBL + leftLen + arcTL + topLen + arcTR + rightLen + arcBR + clamp(width - rBR - p.x, 0.0, bottomLen);
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
return pos / lineWidth;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// Simple rectangular perimeter calculation (no rounded corners)
|
|
2967
|
+
float getRectPerimeterPosition(vec2 fragUV, vec2 dims, float lineWidth) {
|
|
2968
|
+
float width = dims.x;
|
|
2969
|
+
float height = dims.y;
|
|
2970
|
+
|
|
2971
|
+
float distLeft = fragUV.x * width;
|
|
2972
|
+
float distRight = (1.0 - fragUV.x) * width;
|
|
2973
|
+
float distBottom = fragUV.y * height;
|
|
2974
|
+
float distTop = (1.0 - fragUV.y) * height;
|
|
2975
|
+
|
|
2976
|
+
float minDist = min(min(distLeft, distRight), min(distBottom, distTop));
|
|
2977
|
+
|
|
2978
|
+
float pos = 0.0;
|
|
2979
|
+
if (minDist == distLeft) {
|
|
2980
|
+
pos = fragUV.y * height;
|
|
2981
|
+
} else if (minDist == distTop) {
|
|
2982
|
+
pos = height + fragUV.x * width;
|
|
2983
|
+
} else if (minDist == distRight) {
|
|
2984
|
+
pos = height + width + (1.0 - fragUV.y) * height;
|
|
2985
|
+
} else {
|
|
2986
|
+
pos = 2.0 * height + width + (1.0 - fragUV.x) * width;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
return pos / lineWidth;
|
|
2990
|
+
}
|
|
2991
|
+
`,
|
|
2992
|
+
"fs:#main-start": `
|
|
2993
|
+
bool inDashGap = false;
|
|
2994
|
+
float dashUnitLength = vDashArray.x + vDashArray.y;
|
|
2995
|
+
if (dashUnitLength > 0.0 && textBackground.stroked) {
|
|
2996
|
+
float distToEdge;
|
|
2997
|
+
bool hasRoundedCorners = textBackground.borderRadius != vec4(0.0);
|
|
2998
|
+
if (hasRoundedCorners) {
|
|
2999
|
+
distToEdge = round_rect(uv, dimensions, textBackground.borderRadius);
|
|
3000
|
+
} else {
|
|
3001
|
+
distToEdge = rect(uv, dimensions);
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
if (distToEdge <= vLineWidth && distToEdge >= 0.0) {
|
|
3005
|
+
float posAlongStroke;
|
|
3006
|
+
if (hasRoundedCorners) {
|
|
3007
|
+
posAlongStroke = getPerimeterPosition(uv, dimensions, textBackground.borderRadius, vLineWidth);
|
|
3008
|
+
} else {
|
|
3009
|
+
posAlongStroke = getRectPerimeterPosition(uv, dimensions, vLineWidth);
|
|
3010
|
+
}
|
|
3011
|
+
float unitOffset = mod(posAlongStroke, dashUnitLength);
|
|
3012
|
+
if (unitOffset > vDashArray.x) {
|
|
3013
|
+
if (vFillColor.a > 0.0) {
|
|
3014
|
+
inDashGap = true;
|
|
3015
|
+
} else {
|
|
3016
|
+
if (!(pathStyle.dashGapPickable && bool(picking.isActive))) {
|
|
3017
|
+
discard;
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
`,
|
|
3024
|
+
"fs:#main-end": `
|
|
3025
|
+
if (inDashGap) {
|
|
3026
|
+
float alphaFactor = fragColor.a / max(vLineColor.a, 0.001);
|
|
3027
|
+
fragColor = vec4(vFillColor.rgb, vFillColor.a * alphaFactor);
|
|
3028
|
+
fragColor = picking_filterPickingColor(fragColor);
|
|
3029
|
+
fragColor = picking_filterHighlightColor(fragColor);
|
|
3030
|
+
}
|
|
2828
3031
|
`
|
|
2829
3032
|
}
|
|
2830
3033
|
};
|
|
@@ -2869,13 +3072,41 @@ in float instanceOffsets;
|
|
|
2869
3072
|
} = {}) {
|
|
2870
3073
|
super({ dash: dash || highPrecisionDash, offset, highPrecisionDash });
|
|
2871
3074
|
}
|
|
3075
|
+
getLayerType(layer) {
|
|
3076
|
+
if ("pathTesselator" in layer.state) {
|
|
3077
|
+
return "path";
|
|
3078
|
+
}
|
|
3079
|
+
const layerName = layer.constructor.layerName;
|
|
3080
|
+
if (layerName === "ScatterplotLayer") {
|
|
3081
|
+
return "scatterplot";
|
|
3082
|
+
}
|
|
3083
|
+
if (layerName === "TextBackgroundLayer") {
|
|
3084
|
+
return "textBackground";
|
|
3085
|
+
}
|
|
3086
|
+
return null;
|
|
3087
|
+
}
|
|
2872
3088
|
isEnabled(layer) {
|
|
2873
|
-
return
|
|
3089
|
+
return this.getLayerType(layer) !== null;
|
|
2874
3090
|
}
|
|
2875
3091
|
getShaders(extension) {
|
|
2876
|
-
|
|
3092
|
+
const layerType = extension.getLayerType(this);
|
|
3093
|
+
if (!layerType) {
|
|
2877
3094
|
return null;
|
|
2878
3095
|
}
|
|
3096
|
+
if (layerType === "scatterplot" || layerType === "textBackground") {
|
|
3097
|
+
if (!extension.opts.dash) {
|
|
3098
|
+
return null;
|
|
3099
|
+
}
|
|
3100
|
+
const inject7 = layerType === "scatterplot" ? scatterplotDashShaders.inject : textBackgroundDashShaders.inject;
|
|
3101
|
+
const pathStyle2 = {
|
|
3102
|
+
name: "pathStyle",
|
|
3103
|
+
inject: inject7,
|
|
3104
|
+
uniformTypes: {
|
|
3105
|
+
dashGapPickable: "i32"
|
|
3106
|
+
}
|
|
3107
|
+
};
|
|
3108
|
+
return { modules: [pathStyle2] };
|
|
3109
|
+
}
|
|
2879
3110
|
let result = {};
|
|
2880
3111
|
const defines = {};
|
|
2881
3112
|
if (extension.opts.dash) {
|
|
@@ -2903,13 +3134,14 @@ in float instanceOffsets;
|
|
|
2903
3134
|
}
|
|
2904
3135
|
initializeState(context, extension) {
|
|
2905
3136
|
const attributeManager = this.getAttributeManager();
|
|
2906
|
-
|
|
3137
|
+
const layerType = extension.getLayerType(this);
|
|
3138
|
+
if (!attributeManager || !layerType) {
|
|
2907
3139
|
return;
|
|
2908
3140
|
}
|
|
2909
3141
|
if (extension.opts.dash) {
|
|
2910
3142
|
attributeManager.addInstanced({
|
|
2911
3143
|
instanceDashArrays: { size: 2, accessor: "getDashArray" },
|
|
2912
|
-
...extension.opts.highPrecisionDash ? {
|
|
3144
|
+
...layerType === "path" && extension.opts.highPrecisionDash ? {
|
|
2913
3145
|
instanceDashOffsets: {
|
|
2914
3146
|
size: 1,
|
|
2915
3147
|
accessor: "getPath",
|
|
@@ -2918,7 +3150,7 @@ in float instanceOffsets;
|
|
|
2918
3150
|
} : {}
|
|
2919
3151
|
});
|
|
2920
3152
|
}
|
|
2921
|
-
if (extension.opts.offset) {
|
|
3153
|
+
if (layerType === "path" && extension.opts.offset) {
|
|
2922
3154
|
attributeManager.addInstanced({
|
|
2923
3155
|
instanceOffsets: { size: 1, accessor: "getOffset" }
|
|
2924
3156
|
});
|
|
@@ -2929,11 +3161,19 @@ in float instanceOffsets;
|
|
|
2929
3161
|
return;
|
|
2930
3162
|
}
|
|
2931
3163
|
if (extension.opts.dash) {
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
3164
|
+
const layerType = extension.getLayerType(this);
|
|
3165
|
+
if (layerType === "scatterplot" || layerType === "textBackground") {
|
|
3166
|
+
const pathStyleProps = {
|
|
3167
|
+
dashGapPickable: Boolean(this.props.dashGapPickable)
|
|
3168
|
+
};
|
|
3169
|
+
this.setShaderModuleProps({ pathStyle: pathStyleProps });
|
|
3170
|
+
} else {
|
|
3171
|
+
const pathStyleProps = {
|
|
3172
|
+
dashAlignMode: this.props.dashJustified ? 1 : 0,
|
|
3173
|
+
dashGapPickable: Boolean(this.props.dashGapPickable)
|
|
3174
|
+
};
|
|
3175
|
+
this.setShaderModuleProps({ pathStyle: pathStyleProps });
|
|
3176
|
+
}
|
|
2937
3177
|
}
|
|
2938
3178
|
}
|
|
2939
3179
|
getDashOffsets(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fp64-extension.d.ts","sourceRoot":"","sources":["../../src/fp64/fp64-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"fp64-extension.d.ts","sourceRoot":"","sources":["../../src/fp64/fp64-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEzC,yEAAyE;AACzE,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAC,aAAa,SAAmB;IAEvC,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG;IAW5B,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI;CAItD"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// deck.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { LayerExtension
|
|
4
|
+
import { LayerExtension } from '@deck.gl/core';
|
|
5
5
|
import project64 from "./project64.js";
|
|
6
6
|
/** @deprecated Adds the legacy 64-bit precision to geospatial layers. */
|
|
7
7
|
class Fp64Extension extends LayerExtension {
|
|
8
8
|
getShaders() {
|
|
9
9
|
const { coordinateSystem } = this.props;
|
|
10
|
-
if (coordinateSystem !==
|
|
11
|
-
coordinateSystem !== COORDINATE_SYSTEM.DEFAULT) {
|
|
10
|
+
if (coordinateSystem !== 'lnglat' && coordinateSystem !== 'default') {
|
|
12
11
|
throw new Error('fp64: coordinateSystem must be LNGLAT');
|
|
13
12
|
}
|
|
14
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fp64-extension.js","sourceRoot":"","sources":["../../src/fp64/fp64-extension.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"fp64-extension.js","sourceRoot":"","sources":["../../src/fp64/fp64-extension.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,SAAS,uBAAoB;AAIpC,yEAAyE;AACzE,MAAqB,aAAc,SAAQ,cAAc;IAGvD,UAAU;QACR,MAAM,EAAC,gBAAgB,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACtC,IAAI,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC,SAAS,CAAC;SACrB,CAAC;IACJ,CAAC;IAED,IAAI,CAAc,MAAW,EAAE,SAAe;QAC5C,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,oBAAoB,CAAC,EAAC,SAAS,EAAE,EAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;IACrD,CAAC;;AAhBM,2BAAa,GAAG,eAAe,CAAC;eADpB,aAAa"}
|