@antv/l7-layers 2.25.2 → 2.25.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/es/line/models/arc_3d.js +2 -2
- package/es/point/shaders/text/text_frag.glsl +3 -1
- package/es/utils/extrude_polyline.js +4 -3
- package/es/utils/scale.js +13 -6
- package/lib/line/models/arc_3d.js +2 -2
- package/lib/point/shaders/text/text_frag.glsl +3 -1
- package/lib/utils/extrude_polyline.js +4 -3
- package/lib/utils/scale.js +13 -6
- package/package.json +6 -6
package/es/line/models/arc_3d.js
CHANGED
|
@@ -31,8 +31,8 @@ export default class Arc3DModel extends BaseModel {
|
|
|
31
31
|
}
|
|
32
32
|
this.texture = createTexture2D({
|
|
33
33
|
data: this.iconService.getCanvas(),
|
|
34
|
-
mag: gl.
|
|
35
|
-
min: gl.
|
|
34
|
+
mag: gl.LINEAR,
|
|
35
|
+
min: gl.LINEAR,
|
|
36
36
|
premultiplyAlpha: false,
|
|
37
37
|
width: 1024,
|
|
38
38
|
height: this.iconService.canvasHeight || 128
|
|
@@ -34,7 +34,9 @@ void main() {
|
|
|
34
34
|
|
|
35
35
|
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// 根据 stroke 的 alpha 值调整混合权重,避免透明 stroke 影响文本颜色
|
|
38
|
+
float stroke_mix_factor = smoothstep(0., 0.5, 1.- dist) * v_stroke_color.a;
|
|
39
|
+
outputColor = mix(v_color, v_stroke_color, stroke_mix_factor);
|
|
38
40
|
|
|
39
41
|
outputColor.a *= alpha;
|
|
40
42
|
// 作为 mask 模板时需要丢弃透明的像素
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { aProjectFlat } from '@antv/l7-utils';
|
|
3
3
|
import { vec2 } from 'gl-matrix';
|
|
4
4
|
const tmp = vec2.create();
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
5
|
const capEnd = vec2.create();
|
|
7
6
|
const lineA = vec2.create();
|
|
8
7
|
const lineB = vec2.create();
|
|
@@ -304,9 +303,11 @@ export default class ExtrudePolyline {
|
|
|
304
303
|
distanceRadio) {
|
|
305
304
|
normals.push(normal[0], normal[1], 0);
|
|
306
305
|
normals.push(normal[0], normal[1], 0);
|
|
307
|
-
|
|
306
|
+
// 修复:正确处理 z 坐标,当 point[2] 不存在时使用 0,但保留传入的高度值
|
|
307
|
+
const z = point[2] !== undefined ? point[2] : 0;
|
|
308
|
+
positions.push(point[0], point[1], z, distanceRadio, -thickness, z);
|
|
308
309
|
this.complex.indexes.push(this.currentIndex);
|
|
309
|
-
positions.push(point[0], point[1],
|
|
310
|
+
positions.push(point[0], point[1], z, distanceRadio, thickness, z);
|
|
310
311
|
this.complex.indexes.push(this.currentIndex);
|
|
311
312
|
this.currentIndex++;
|
|
312
313
|
}
|
package/es/utils/scale.js
CHANGED
|
@@ -55,9 +55,9 @@ export function scaleLinear() {
|
|
|
55
55
|
const r0 = range[0];
|
|
56
56
|
const r1 = range[range.length - 1];
|
|
57
57
|
|
|
58
|
-
// 处理相等的 domain
|
|
58
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
59
59
|
if (d0 === d1) {
|
|
60
|
-
return r0;
|
|
60
|
+
return (r0 + r1) / 2;
|
|
61
61
|
}
|
|
62
62
|
let t = (x - d0) / (d1 - d0);
|
|
63
63
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
|
@@ -124,8 +124,10 @@ export function scalePow() {
|
|
|
124
124
|
const d1 = domain[domain.length - 1];
|
|
125
125
|
const r0 = range[0];
|
|
126
126
|
const r1 = range[range.length - 1];
|
|
127
|
+
|
|
128
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
127
129
|
if (d0 === d1) {
|
|
128
|
-
return r0;
|
|
130
|
+
return (r0 + r1) / 2;
|
|
129
131
|
}
|
|
130
132
|
let t = (x - d0) / (d1 - d0);
|
|
131
133
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
|
@@ -206,8 +208,10 @@ export function scaleLog() {
|
|
|
206
208
|
const d1 = domain[domain.length - 1];
|
|
207
209
|
const r0 = range[0];
|
|
208
210
|
const r1 = range[range.length - 1];
|
|
211
|
+
|
|
212
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
209
213
|
if (d0 === d1) {
|
|
210
|
-
return r0;
|
|
214
|
+
return (r0 + r1) / 2;
|
|
211
215
|
}
|
|
212
216
|
const absD0 = Math.abs(d0) || 1;
|
|
213
217
|
const absD1 = Math.abs(d1) || 1;
|
|
@@ -316,8 +320,9 @@ export function scaleQuantize() {
|
|
|
316
320
|
function scale(x) {
|
|
317
321
|
const d0 = domain[0];
|
|
318
322
|
const d1 = domain[domain.length - 1];
|
|
323
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
319
324
|
if (d0 === d1) {
|
|
320
|
-
return _range[
|
|
325
|
+
return _range[Math.floor(_range.length / 2)];
|
|
321
326
|
}
|
|
322
327
|
const t = (x - d0) / (d1 - d0);
|
|
323
328
|
const i = Math.max(0, Math.min(n - 1, Math.floor(t * n)));
|
|
@@ -531,8 +536,10 @@ export function scaleTime() {
|
|
|
531
536
|
const d1 = domain[domain.length - 1];
|
|
532
537
|
const r0 = range[0];
|
|
533
538
|
const r1 = range[range.length - 1];
|
|
539
|
+
|
|
540
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
534
541
|
if (d0 === d1) {
|
|
535
|
-
return r0;
|
|
542
|
+
return (r0 + r1) / 2;
|
|
536
543
|
}
|
|
537
544
|
let t = (x - d0) / (d1 - d0);
|
|
538
545
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
|
@@ -38,8 +38,8 @@ class Arc3DModel extends _BaseModel.default {
|
|
|
38
38
|
}
|
|
39
39
|
this.texture = createTexture2D({
|
|
40
40
|
data: this.iconService.getCanvas(),
|
|
41
|
-
mag: _l7Core.gl.
|
|
42
|
-
min: _l7Core.gl.
|
|
41
|
+
mag: _l7Core.gl.LINEAR,
|
|
42
|
+
min: _l7Core.gl.LINEAR,
|
|
43
43
|
premultiplyAlpha: false,
|
|
44
44
|
width: 1024,
|
|
45
45
|
height: this.iconService.canvasHeight || 128
|
|
@@ -34,7 +34,9 @@ void main() {
|
|
|
34
34
|
|
|
35
35
|
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// 根据 stroke 的 alpha 值调整混合权重,避免透明 stroke 影响文本颜色
|
|
38
|
+
float stroke_mix_factor = smoothstep(0., 0.5, 1.- dist) * v_stroke_color.a;
|
|
39
|
+
outputColor = mix(v_color, v_stroke_color, stroke_mix_factor);
|
|
38
40
|
|
|
39
41
|
outputColor.a *= alpha;
|
|
40
42
|
// 作为 mask 模板时需要丢弃透明的像素
|
|
@@ -13,7 +13,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
14
|
var _glMatrix = require("gl-matrix");
|
|
15
15
|
const tmp = _glMatrix.vec2.create();
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
16
|
const capEnd = _glMatrix.vec2.create();
|
|
18
17
|
const lineA = _glMatrix.vec2.create();
|
|
19
18
|
const lineB = _glMatrix.vec2.create();
|
|
@@ -315,9 +314,11 @@ class ExtrudePolyline {
|
|
|
315
314
|
distanceRadio) {
|
|
316
315
|
normals.push(normal[0], normal[1], 0);
|
|
317
316
|
normals.push(normal[0], normal[1], 0);
|
|
318
|
-
|
|
317
|
+
// 修复:正确处理 z 坐标,当 point[2] 不存在时使用 0,但保留传入的高度值
|
|
318
|
+
const z = point[2] !== undefined ? point[2] : 0;
|
|
319
|
+
positions.push(point[0], point[1], z, distanceRadio, -thickness, z);
|
|
319
320
|
this.complex.indexes.push(this.currentIndex);
|
|
320
|
-
positions.push(point[0], point[1],
|
|
321
|
+
positions.push(point[0], point[1], z, distanceRadio, thickness, z);
|
|
321
322
|
this.complex.indexes.push(this.currentIndex);
|
|
322
323
|
this.currentIndex++;
|
|
323
324
|
}
|
package/lib/utils/scale.js
CHANGED
|
@@ -70,9 +70,9 @@ function scaleLinear() {
|
|
|
70
70
|
const r0 = range[0];
|
|
71
71
|
const r1 = range[range.length - 1];
|
|
72
72
|
|
|
73
|
-
// 处理相等的 domain
|
|
73
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
74
74
|
if (d0 === d1) {
|
|
75
|
-
return r0;
|
|
75
|
+
return (r0 + r1) / 2;
|
|
76
76
|
}
|
|
77
77
|
let t = (x - d0) / (d1 - d0);
|
|
78
78
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
|
@@ -139,8 +139,10 @@ function scalePow() {
|
|
|
139
139
|
const d1 = domain[domain.length - 1];
|
|
140
140
|
const r0 = range[0];
|
|
141
141
|
const r1 = range[range.length - 1];
|
|
142
|
+
|
|
143
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
142
144
|
if (d0 === d1) {
|
|
143
|
-
return r0;
|
|
145
|
+
return (r0 + r1) / 2;
|
|
144
146
|
}
|
|
145
147
|
let t = (x - d0) / (d1 - d0);
|
|
146
148
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
|
@@ -221,8 +223,10 @@ function scaleLog() {
|
|
|
221
223
|
const d1 = domain[domain.length - 1];
|
|
222
224
|
const r0 = range[0];
|
|
223
225
|
const r1 = range[range.length - 1];
|
|
226
|
+
|
|
227
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
224
228
|
if (d0 === d1) {
|
|
225
|
-
return r0;
|
|
229
|
+
return (r0 + r1) / 2;
|
|
226
230
|
}
|
|
227
231
|
const absD0 = Math.abs(d0) || 1;
|
|
228
232
|
const absD1 = Math.abs(d1) || 1;
|
|
@@ -331,8 +335,9 @@ function scaleQuantize() {
|
|
|
331
335
|
function scale(x) {
|
|
332
336
|
const d0 = domain[0];
|
|
333
337
|
const d1 = domain[domain.length - 1];
|
|
338
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
334
339
|
if (d0 === d1) {
|
|
335
|
-
return _range[
|
|
340
|
+
return _range[Math.floor(_range.length / 2)];
|
|
336
341
|
}
|
|
337
342
|
const t = (x - d0) / (d1 - d0);
|
|
338
343
|
const i = Math.max(0, Math.min(n - 1, Math.floor(t * n)));
|
|
@@ -546,8 +551,10 @@ function scaleTime() {
|
|
|
546
551
|
const d1 = domain[domain.length - 1];
|
|
547
552
|
const r0 = range[0];
|
|
548
553
|
const r1 = range[range.length - 1];
|
|
554
|
+
|
|
555
|
+
// 处理相等的 domain - 返回 range 中值,避免所有值映射到最小值
|
|
549
556
|
if (d0 === d1) {
|
|
550
|
-
return r0;
|
|
557
|
+
return (r0 + r1) / 2;
|
|
551
558
|
}
|
|
552
559
|
let t = (x - d0) / (d1 - d0);
|
|
553
560
|
if (_clamp) t = Math.max(0, Math.min(1, t));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.4",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "https://github.com/orgs/antvis/people",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"earcut": "^2.2.1",
|
|
27
27
|
"eventemitter3": "^4.0.0",
|
|
28
28
|
"gl-matrix": "^3.1.0",
|
|
29
|
-
"@antv/l7-
|
|
30
|
-
"@antv/l7-
|
|
31
|
-
"@antv/l7-source": "2.25.
|
|
32
|
-
"@antv/l7-utils": "2.25.
|
|
29
|
+
"@antv/l7-maps": "2.25.4",
|
|
30
|
+
"@antv/l7-core": "2.25.4",
|
|
31
|
+
"@antv/l7-source": "2.25.4",
|
|
32
|
+
"@antv/l7-utils": "2.25.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/earcut": "^2.1.0",
|
|
36
36
|
"@types/gl-matrix": "^2.4.5",
|
|
37
|
-
"@antv/l7-test-utils": "^2.25.
|
|
37
|
+
"@antv/l7-test-utils": "^2.25.4"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public",
|