@antv/l7-layers 2.25.9 → 2.28.10
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/citybuilding/models/build.d.ts +3 -2
- package/es/core/BaseModel.js +32 -6
- package/es/core/CommonStyleAttribute.d.ts +2 -1
- package/es/core/CommonStyleAttribute.js +23 -1
- package/es/core/constant.js +4 -2
- package/es/core/interface.d.ts +1 -0
- package/es/earth/models/atmosphere.d.ts +3 -2
- package/es/earth/models/base.d.ts +3 -2
- package/es/earth/models/bloomsphere.d.ts +3 -2
- package/es/geometry/models/billboard.d.ts +3 -2
- package/es/geometry/models/plane.d.ts +3 -2
- package/es/heatmap/models/grid.d.ts +3 -2
- package/es/heatmap/models/grid3d.d.ts +3 -2
- package/es/heatmap/models/heatmap.d.ts +3 -2
- package/es/heatmap/models/hexagon.d.ts +3 -2
- package/es/image/models/image.d.ts +3 -2
- package/es/line/models/arc.d.ts +3 -2
- package/es/line/models/arc_3d.d.ts +3 -2
- package/es/line/models/flow.d.ts +3 -2
- package/es/line/models/great_circle.d.ts +3 -2
- package/es/line/models/line.d.ts +3 -2
- package/es/line/models/simple_line.d.ts +3 -2
- package/es/line/models/wall.d.ts +3 -2
- package/es/plugins/index.d.ts +1 -1
- package/es/point/index.js +2 -2
- package/es/point/models/billboard_point.d.ts +3 -2
- package/es/point/models/earthExtrude.d.ts +3 -2
- package/es/point/models/earthFill.d.ts +3 -2
- package/es/point/models/extrude.d.ts +3 -2
- package/es/point/models/fill.d.ts +3 -2
- package/es/point/models/fillImage.d.ts +3 -2
- package/es/point/models/image.d.ts +3 -2
- package/es/point/models/normal.d.ts +3 -2
- package/es/point/models/radar.d.ts +3 -2
- package/es/point/models/text.d.ts +3 -2
- package/es/point/shaders/billboard/billboard_point_vert.glsl +33 -1
- package/es/point/shaders/earthFill/earthFill_vert.glsl +37 -3
- package/es/point/shaders/fill/fill_vert.glsl +38 -3
- package/es/point/shaders/fillImage/fillImage_vert.glsl +34 -1
- package/es/point/shaders/image/image_vert.glsl +31 -0
- package/es/point/shaders/normal/normal_vert.glsl +30 -0
- package/es/point/shaders/radar/radar_vert.glsl +34 -3
- package/es/polygon/models/extrude.d.ts +3 -2
- package/es/polygon/models/extrusion.d.ts +3 -2
- package/es/polygon/models/fill.d.ts +3 -2
- package/es/polygon/models/ocean.d.ts +3 -2
- package/es/polygon/models/water.d.ts +3 -2
- package/es/raster/models/raster.d.ts +3 -2
- package/es/raster/models/rasterRgb.d.ts +3 -2
- package/es/raster/models/rasterTerrainRgb.d.ts +3 -2
- package/es/tile/tile/Tile.d.ts +2 -2
- package/es/tile/tile/index.d.ts +1 -1
- package/es/tile/tile/util.d.ts +1 -1
- package/es/utils/symbol-layout.d.ts +1 -1
- package/es/utils/symbol-layout.js +19 -9
- package/es/wind/models/wind.d.ts +3 -2
- package/lib/citybuilding/models/build.d.ts +3 -2
- package/lib/core/BaseModel.js +32 -6
- package/lib/core/CommonStyleAttribute.d.ts +2 -1
- package/lib/core/CommonStyleAttribute.js +23 -1
- package/lib/core/constant.js +4 -2
- package/lib/core/interface.d.ts +1 -0
- package/lib/earth/models/atmosphere.d.ts +3 -2
- package/lib/earth/models/base.d.ts +3 -2
- package/lib/earth/models/bloomsphere.d.ts +3 -2
- package/lib/geometry/models/billboard.d.ts +3 -2
- package/lib/geometry/models/plane.d.ts +3 -2
- package/lib/heatmap/models/grid.d.ts +3 -2
- package/lib/heatmap/models/grid3d.d.ts +3 -2
- package/lib/heatmap/models/heatmap.d.ts +3 -2
- package/lib/heatmap/models/hexagon.d.ts +3 -2
- package/lib/image/models/image.d.ts +3 -2
- package/lib/line/models/arc.d.ts +3 -2
- package/lib/line/models/arc_3d.d.ts +3 -2
- package/lib/line/models/flow.d.ts +3 -2
- package/lib/line/models/great_circle.d.ts +3 -2
- package/lib/line/models/line.d.ts +3 -2
- package/lib/line/models/simple_line.d.ts +3 -2
- package/lib/line/models/wall.d.ts +3 -2
- package/lib/plugins/index.d.ts +1 -1
- package/lib/point/index.js +2 -2
- package/lib/point/models/billboard_point.d.ts +3 -2
- package/lib/point/models/earthExtrude.d.ts +3 -2
- package/lib/point/models/earthFill.d.ts +3 -2
- package/lib/point/models/extrude.d.ts +3 -2
- package/lib/point/models/fill.d.ts +3 -2
- package/lib/point/models/fillImage.d.ts +3 -2
- package/lib/point/models/image.d.ts +3 -2
- package/lib/point/models/normal.d.ts +3 -2
- package/lib/point/models/radar.d.ts +3 -2
- package/lib/point/models/text.d.ts +3 -2
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +33 -1
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +37 -3
- package/lib/point/shaders/fill/fill_vert.glsl +38 -3
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +34 -1
- package/lib/point/shaders/image/image_vert.glsl +31 -0
- package/lib/point/shaders/normal/normal_vert.glsl +30 -0
- package/lib/point/shaders/radar/radar_vert.glsl +34 -3
- package/lib/polygon/models/extrude.d.ts +3 -2
- package/lib/polygon/models/extrusion.d.ts +3 -2
- package/lib/polygon/models/fill.d.ts +3 -2
- package/lib/polygon/models/ocean.d.ts +3 -2
- package/lib/polygon/models/water.d.ts +3 -2
- package/lib/raster/models/raster.d.ts +3 -2
- package/lib/raster/models/rasterRgb.d.ts +3 -2
- package/lib/raster/models/rasterTerrainRgb.d.ts +3 -2
- package/lib/tile/tile/Tile.d.ts +2 -2
- package/lib/tile/tile/index.d.ts +1 -1
- package/lib/tile/tile/util.d.ts +1 -1
- package/lib/utils/symbol-layout.d.ts +1 -1
- package/lib/utils/symbol-layout.js +19 -9
- package/lib/wind/models/wind.d.ts +3 -2
- package/package.json +6 -6
|
@@ -17,6 +17,35 @@ out float v_radius;
|
|
|
17
17
|
#pragma include "projection"
|
|
18
18
|
#pragma include "picking"
|
|
19
19
|
|
|
20
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
21
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
22
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
23
|
+
if (anchor < 0.5) {
|
|
24
|
+
return extrude;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec2 offset = vec2(0.0);
|
|
28
|
+
|
|
29
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
30
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
31
|
+
// top-right, right, bottom-right -> shift left
|
|
32
|
+
offset.x = -1.0;
|
|
33
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
34
|
+
// bottom-left, left, top-left -> shift right
|
|
35
|
+
offset.x = 1.0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
39
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
40
|
+
// top, top-right, top-left -> shift down
|
|
41
|
+
offset.y = -1.0;
|
|
42
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
43
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
44
|
+
offset.y = 1.0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return extrude + offset;
|
|
48
|
+
}
|
|
20
49
|
|
|
21
50
|
void main() {
|
|
22
51
|
vec3 extrude = a_Extrude;
|
|
@@ -37,10 +66,15 @@ void main() {
|
|
|
37
66
|
// float antialiased_blur = -max(u_blur, antialiasblur);
|
|
38
67
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);
|
|
39
68
|
|
|
40
|
-
//
|
|
41
|
-
|
|
69
|
+
// apply anchor to extrude direction
|
|
70
|
+
vec2 anchoredExtrude = applyAnchor(extrude.xy, anchor);
|
|
71
|
+
|
|
72
|
+
// TODP: sign() 是为了兼容地球模式,同时避免 anchor 偏移后为 0 时除以零产生 NaN
|
|
73
|
+
// 注意:v_data 必须使用原始 extrude 而非 anchoredExtrude,因为 SDF 形状计算需要基于原始形状坐标系
|
|
74
|
+
// anchoredExtrude 只用于位置偏移,不改变形状本身的 SDF 采样
|
|
75
|
+
v_data = vec4(sign(extrude.x), sign(extrude.y), antialiasblur,shape_type);
|
|
42
76
|
|
|
43
|
-
gl_Position = u_ViewProjectionMatrix * vec4(a_Position +
|
|
77
|
+
gl_Position = u_ViewProjectionMatrix * vec4(a_Position + anchoredExtrude * newSize * 0.1 + vec3(offsets,0.0), 1.0);
|
|
44
78
|
|
|
45
79
|
setPickingColor(a_PickingColor);
|
|
46
80
|
}
|
|
@@ -24,6 +24,36 @@ out float v_radius;
|
|
|
24
24
|
#pragma include "picking"
|
|
25
25
|
#pragma include "rotation_2d"
|
|
26
26
|
|
|
27
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
28
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
29
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
30
|
+
if (anchor < 0.5) {
|
|
31
|
+
return extrude;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
vec2 offset = vec2(0.0);
|
|
35
|
+
|
|
36
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
37
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
38
|
+
// top-right, right, bottom-right -> shift left
|
|
39
|
+
offset.x = -1.0;
|
|
40
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
41
|
+
// bottom-left, left, top-left -> shift right
|
|
42
|
+
offset.x = 1.0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
46
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
47
|
+
// top, top-right, top-left -> shift down
|
|
48
|
+
offset.y = -1.0;
|
|
49
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
50
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
51
|
+
offset.y = 1.0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return extrude + offset;
|
|
55
|
+
}
|
|
56
|
+
|
|
27
57
|
void main() {
|
|
28
58
|
// 透明度计算
|
|
29
59
|
v_stroke = stroke;
|
|
@@ -51,13 +81,18 @@ void main() {
|
|
|
51
81
|
// float antialiased_blur = -max(u_blur, antialiasblur);
|
|
52
82
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);
|
|
53
83
|
|
|
54
|
-
|
|
84
|
+
// apply anchor to extrude direction
|
|
85
|
+
vec2 anchoredExtrude = applyAnchor(extrude.xy, anchor);
|
|
86
|
+
|
|
87
|
+
vec2 offset = (anchoredExtrude * (newSize + u_stroke_width) + offsets);
|
|
55
88
|
|
|
56
89
|
offset = project_pixel(offset);
|
|
57
90
|
offset = rotate_matrix(offset,rotation);
|
|
58
91
|
|
|
59
|
-
// TODP:
|
|
60
|
-
v_data
|
|
92
|
+
// TODP: sign() 是为了兼容地球模式,同时避免 anchor 偏移后为 0 时除以零产生 NaN
|
|
93
|
+
// 注意:v_data 必须使用原始 extrude 而非 anchoredExtrude,因为 SDF 形状计算需要基于原始形状坐标系
|
|
94
|
+
// anchoredExtrude 只用于位置偏移,不改变形状本身的 SDF 采样
|
|
95
|
+
v_data = vec4(sign(extrude.x), sign(extrude.y), antialiasblur,shape_type);
|
|
61
96
|
|
|
62
97
|
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
|
|
63
98
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|
|
@@ -20,6 +20,36 @@ out float v_opacity;
|
|
|
20
20
|
#pragma include "picking"
|
|
21
21
|
#pragma include "rotation_2d"
|
|
22
22
|
|
|
23
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
24
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
25
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
26
|
+
if (anchor < 0.5) {
|
|
27
|
+
return extrude;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
vec2 offset = vec2(0.0);
|
|
31
|
+
|
|
32
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
33
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
34
|
+
// top-right, right, bottom-right -> shift left
|
|
35
|
+
offset.x = -1.0;
|
|
36
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
37
|
+
// bottom-left, left, top-left -> shift right
|
|
38
|
+
offset.x = 1.0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
42
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
43
|
+
// top, top-right, top-left -> shift down
|
|
44
|
+
offset.y = -1.0;
|
|
45
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
46
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
47
|
+
offset.y = 1.0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return extrude + offset;
|
|
51
|
+
}
|
|
52
|
+
|
|
23
53
|
void main() {
|
|
24
54
|
vec3 extrude = a_Extrude;
|
|
25
55
|
v_uv = (a_Extrude.xy + 1.0) / 2.0;
|
|
@@ -32,8 +62,11 @@ void main() {
|
|
|
32
62
|
newSize = newSize * u_PixelsPerMeter.z;
|
|
33
63
|
}
|
|
34
64
|
|
|
65
|
+
// apply anchor to extrude direction
|
|
66
|
+
vec2 anchoredExtrude = applyAnchor(extrude.xy, anchor);
|
|
67
|
+
|
|
35
68
|
// vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
|
|
36
|
-
vec2 offset =
|
|
69
|
+
vec2 offset = anchoredExtrude.xy * newSize + offsets;
|
|
37
70
|
|
|
38
71
|
offset = rotate_matrix(offset, rotation);
|
|
39
72
|
|
|
@@ -17,6 +17,32 @@ out float v_opacity;
|
|
|
17
17
|
#pragma include "projection"
|
|
18
18
|
#pragma include "picking"
|
|
19
19
|
|
|
20
|
+
// 根据 anchor 值计算点精灵的像素偏移
|
|
21
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
22
|
+
vec2 applyAnchorPoint(float anchor, float pointSize) {
|
|
23
|
+
if (anchor < 0.5) {
|
|
24
|
+
return vec2(0.0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec2 offset = vec2(0.0);
|
|
28
|
+
|
|
29
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
30
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
31
|
+
offset.x = -pointSize * 0.5;
|
|
32
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
33
|
+
offset.x = pointSize * 0.5;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
37
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
38
|
+
offset.y = -pointSize * 0.5;
|
|
39
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
40
|
+
offset.y = pointSize * 0.5;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return offset;
|
|
44
|
+
}
|
|
45
|
+
|
|
20
46
|
void main() {
|
|
21
47
|
// cal style mapping - 数据纹理映射部分的计算
|
|
22
48
|
v_color = a_Color;
|
|
@@ -43,5 +69,10 @@ void main() {
|
|
|
43
69
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
44
70
|
|
|
45
71
|
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
72
|
+
|
|
73
|
+
// apply anchor offset in screen space
|
|
74
|
+
vec2 anchorOffset = applyAnchorPoint(anchor, gl_PointSize);
|
|
75
|
+
gl_Position.xy += anchorOffset / u_ViewportSize * 2.0 * gl_Position.w;
|
|
76
|
+
|
|
46
77
|
setPickingColor(a_PickingColor);
|
|
47
78
|
}
|
|
@@ -12,6 +12,32 @@ out vec4 v_color;
|
|
|
12
12
|
#pragma include "projection"
|
|
13
13
|
#pragma include "project"
|
|
14
14
|
|
|
15
|
+
// 根据 anchor 值计算点精灵的像素偏移
|
|
16
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
17
|
+
vec2 applyAnchorPoint(float anchor, float pointSize) {
|
|
18
|
+
if (anchor < 0.5) {
|
|
19
|
+
return vec2(0.0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
vec2 offset = vec2(0.0);
|
|
23
|
+
|
|
24
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
25
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
26
|
+
offset.x = -pointSize * 0.5;
|
|
27
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
28
|
+
offset.x = pointSize * 0.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
32
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
33
|
+
offset.y = -pointSize * 0.5;
|
|
34
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
35
|
+
offset.y = pointSize * 0.5;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return offset;
|
|
39
|
+
}
|
|
40
|
+
|
|
15
41
|
void main() {
|
|
16
42
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
17
43
|
|
|
@@ -19,4 +45,8 @@ void main() {
|
|
|
19
45
|
gl_Position = project_common_position_to_clipspace(project_pos);
|
|
20
46
|
|
|
21
47
|
gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
|
|
48
|
+
|
|
49
|
+
// apply anchor offset in screen space
|
|
50
|
+
vec2 anchorOffset = applyAnchorPoint(anchor, gl_PointSize);
|
|
51
|
+
gl_Position.xy += anchorOffset / u_ViewportSize * 2.0 * gl_Position.w;
|
|
22
52
|
}
|
|
@@ -19,6 +19,34 @@ out vec2 v_extrude;
|
|
|
19
19
|
#pragma include "projection"
|
|
20
20
|
#pragma include "picking"
|
|
21
21
|
|
|
22
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
23
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
24
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
25
|
+
if (anchor < 0.5) {
|
|
26
|
+
return extrude;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec2 offset = vec2(0.0);
|
|
30
|
+
|
|
31
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
32
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
33
|
+
offset.x = -1.0;
|
|
34
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
35
|
+
offset.x = 1.0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
39
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
40
|
+
// top, top-right, top-left -> shift down
|
|
41
|
+
offset.y = -1.0;
|
|
42
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
43
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
44
|
+
offset.y = 1.0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return extrude + offset;
|
|
48
|
+
}
|
|
49
|
+
|
|
22
50
|
void main() {
|
|
23
51
|
float newSize = setPickingSize(a_Size);
|
|
24
52
|
|
|
@@ -27,7 +55,10 @@ void main() {
|
|
|
27
55
|
cos(time), sin(time),
|
|
28
56
|
-sin(time), cos(time)
|
|
29
57
|
);
|
|
30
|
-
|
|
58
|
+
|
|
59
|
+
// apply anchor to extrude direction before rotation
|
|
60
|
+
vec2 anchoredExtrude = applyAnchor(a_Extrude.xy, anchor);
|
|
61
|
+
v_extrude = rotateMatrix * anchoredExtrude;
|
|
31
62
|
|
|
32
63
|
v_color = a_Color;
|
|
33
64
|
v_color.a *= opacity;
|
|
@@ -40,11 +71,11 @@ void main() {
|
|
|
40
71
|
}
|
|
41
72
|
v_radius = newSize;
|
|
42
73
|
|
|
43
|
-
vec2 offset = (
|
|
74
|
+
vec2 offset = (anchoredExtrude * (newSize));
|
|
44
75
|
|
|
45
76
|
offset = project_pixel(offset);
|
|
46
77
|
|
|
47
|
-
v_data = vec4(
|
|
78
|
+
v_data = vec4(anchoredExtrude.x, anchoredExtrude.y, antialiasblur, -1.0);
|
|
48
79
|
|
|
49
80
|
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
|
|
50
81
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|
|
@@ -10,9 +10,10 @@ export default class ExtrudeModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
NORMAL: number;
|
|
18
19
|
UV: number;
|
|
@@ -10,9 +10,10 @@ export default class ExtrusionModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
NORMAL: number;
|
|
18
19
|
EXTRUSION_BASE: number;
|
|
@@ -10,9 +10,10 @@ export default class FillModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
LINEAR: number;
|
|
17
18
|
};
|
|
18
19
|
getUninforms(): {
|
|
@@ -10,9 +10,10 @@ export default class OceanModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
private texture1;
|
|
@@ -10,9 +10,10 @@ export default class WaterModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
private texture;
|
|
@@ -10,9 +10,10 @@ export default class RasterModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
protected texture: ITexture2D;
|
|
@@ -10,9 +10,10 @@ export default class RasterModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
protected texture: ITexture2D;
|
|
@@ -10,9 +10,10 @@ export default class RasterTerrainRGB extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
protected texture: ITexture2D;
|
package/es/tile/tile/Tile.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
47
47
|
enablePropagation?: boolean | undefined;
|
|
48
48
|
fitBoundsOptions?: unknown;
|
|
49
49
|
name?: string | undefined;
|
|
50
|
-
blend?: "
|
|
50
|
+
blend?: "normal" | "additive" | "subtractive" | "min" | "max" | "none" | undefined;
|
|
51
51
|
depth?: boolean | undefined;
|
|
52
52
|
pickedFeatureID?: number | undefined;
|
|
53
53
|
enableMultiPassRenderer?: boolean | undefined;
|
|
@@ -85,7 +85,7 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
85
85
|
pickBufferScale?: number | undefined;
|
|
86
86
|
stencil?: boolean | undefined;
|
|
87
87
|
debug?: boolean | undefined;
|
|
88
|
-
renderer?: "
|
|
88
|
+
renderer?: "device" | "regl" | undefined;
|
|
89
89
|
antialias?: boolean | undefined;
|
|
90
90
|
preserveDrawingBuffer?: boolean | undefined;
|
|
91
91
|
enableWebGPU?: boolean | undefined;
|
package/es/tile/tile/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import RasterTerrainRGBTile from './RasterTerrainRGBTile';
|
|
|
7
7
|
import RasterTile from './RasterTile';
|
|
8
8
|
import VectorTile from './VectorTile';
|
|
9
9
|
export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
|
|
10
|
-
export declare function getTileFactory(layer: ILayer): typeof
|
|
10
|
+
export declare function getTileFactory(layer: ILayer): typeof VectorTile | typeof DebugTile | typeof MaskLayer | typeof RasterRGBTile | typeof RasterTile | typeof RasterTerrainRGBTile | typeof ImageTile;
|
|
11
11
|
export * from '../interface';
|
|
12
12
|
export * from './Tile';
|
package/es/tile/tile/util.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import LineLayer from '../../line';
|
|
2
2
|
import PointLayer from '../../point/index';
|
|
3
3
|
import PolygonLayer from '../../polygon';
|
|
4
|
-
export declare function getTileLayer(type: string): typeof
|
|
4
|
+
export declare function getTileLayer(type: string): typeof PointLayer | typeof PolygonLayer | typeof LineLayer;
|
|
5
5
|
export declare function isNeedMask(type: string): boolean;
|
|
@@ -2,7 +2,7 @@ interface IPoint {
|
|
|
2
2
|
x: number;
|
|
3
3
|
y: number;
|
|
4
4
|
}
|
|
5
|
-
export type anchorType = '
|
|
5
|
+
export type anchorType = 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | 'bottom-center';
|
|
6
6
|
export interface IGlyphQuad {
|
|
7
7
|
tr: IPoint;
|
|
8
8
|
tl: IPoint;
|
|
@@ -21,14 +21,15 @@ function getAnchorAlignment(anchor) {
|
|
|
21
21
|
horizontalAlign = 0.5;
|
|
22
22
|
}
|
|
23
23
|
switch (anchor) {
|
|
24
|
-
case 'bottom':
|
|
25
|
-
case 'bottom-right':
|
|
26
|
-
case 'bottom-left':
|
|
27
|
-
verticalAlign = 1;
|
|
28
|
-
break;
|
|
29
24
|
case 'top':
|
|
30
25
|
case 'top-right':
|
|
31
26
|
case 'top-left':
|
|
27
|
+
verticalAlign = 1;
|
|
28
|
+
break;
|
|
29
|
+
case 'bottom':
|
|
30
|
+
case 'bottom-right':
|
|
31
|
+
case 'bottom-left':
|
|
32
|
+
case 'bottom-center':
|
|
32
33
|
verticalAlign = 0;
|
|
33
34
|
break;
|
|
34
35
|
default:
|
|
@@ -59,9 +60,18 @@ function justifyLine(positionedGlyphs, glyphMap, start, end, justify) {
|
|
|
59
60
|
// justify right=1 left=0 center=0.5
|
|
60
61
|
// horizontalAlign right=1 left=0 center=0.5
|
|
61
62
|
// verticalAlign right=1 left=0 center=0.5
|
|
62
|
-
function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lineCount) {
|
|
63
|
+
function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lineCount, yOffset) {
|
|
63
64
|
const shiftX = (justify - horizontalAlign) * maxLineLength;
|
|
64
|
-
|
|
65
|
+
let shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;
|
|
66
|
+
|
|
67
|
+
// 补偿 yOffset 使 top/bottom 锚点正确对齐
|
|
68
|
+
// top: 文字往下移 |yOffset| 像素(远离坐标点)
|
|
69
|
+
// bottom: 文字往上移 |yOffset| 像素(远离坐标点)
|
|
70
|
+
if (verticalAlign === 1) {
|
|
71
|
+
shiftY += yOffset;
|
|
72
|
+
} else if (verticalAlign === 0) {
|
|
73
|
+
shiftY -= yOffset;
|
|
74
|
+
}
|
|
65
75
|
for (const glyphs of positionedGlyphs) {
|
|
66
76
|
glyphs.x += shiftX;
|
|
67
77
|
glyphs.y += shiftY;
|
|
@@ -107,7 +117,7 @@ function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustif
|
|
|
107
117
|
horizontalAlign,
|
|
108
118
|
verticalAlign
|
|
109
119
|
} = getAnchorAlignment(textAnchor);
|
|
110
|
-
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lines.length);
|
|
120
|
+
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lines.length, yOffset);
|
|
111
121
|
|
|
112
122
|
// 计算包围盒
|
|
113
123
|
const height = y - yOffset;
|
|
@@ -160,7 +170,7 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
|
|
|
160
170
|
horizontalAlign,
|
|
161
171
|
verticalAlign
|
|
162
172
|
} = getAnchorAlignment(textAnchor);
|
|
163
|
-
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, iconfonts.length);
|
|
173
|
+
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, iconfonts.length, yOffset);
|
|
164
174
|
|
|
165
175
|
// 计算包围盒
|
|
166
176
|
const height = y - yOffset;
|
package/es/wind/models/wind.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export default class WindModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
protected texture: ITexture2D;
|
|
@@ -10,9 +10,10 @@ export default class CityBuildModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
NORMAL: number;
|
|
18
19
|
UV: number;
|
package/lib/core/BaseModel.js
CHANGED
|
@@ -15,10 +15,37 @@ var _stencil = require("../utils/stencil");
|
|
|
15
15
|
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
16
16
|
var _constant = require("./constant");
|
|
17
17
|
var _utils = require("./utils");
|
|
18
|
+
function anchorToNumber(anchor) {
|
|
19
|
+
if (typeof anchor === 'number') {
|
|
20
|
+
return anchor;
|
|
21
|
+
}
|
|
22
|
+
switch (anchor) {
|
|
23
|
+
case 'center':
|
|
24
|
+
return 0;
|
|
25
|
+
case 'top':
|
|
26
|
+
return 1;
|
|
27
|
+
case 'top-right':
|
|
28
|
+
return 2;
|
|
29
|
+
case 'right':
|
|
30
|
+
return 3;
|
|
31
|
+
case 'bottom-right':
|
|
32
|
+
return 4;
|
|
33
|
+
case 'bottom':
|
|
34
|
+
return 5;
|
|
35
|
+
case 'bottom-left':
|
|
36
|
+
return 6;
|
|
37
|
+
case 'left':
|
|
38
|
+
return 7;
|
|
39
|
+
case 'top-left':
|
|
40
|
+
return 8;
|
|
41
|
+
case 'bottom-center':
|
|
42
|
+
return 9;
|
|
43
|
+
default:
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
18
47
|
// 属性索引宏定义前缀,使用命名空间避免 define 名称重复情况
|
|
19
48
|
const DEFINE_ATTRIBUTE_LOCATION_PREFIX = 'ATTRIBUTE_LOCATION_';
|
|
20
|
-
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
49
|
class BaseModel {
|
|
23
50
|
/**
|
|
24
51
|
* Attribute Layout Location in Shader
|
|
@@ -149,19 +176,16 @@ class BaseModel {
|
|
|
149
176
|
return false;
|
|
150
177
|
})();
|
|
151
178
|
}
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
179
|
buildModels() {
|
|
154
180
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
155
181
|
throw new Error('Method not implemented.');
|
|
156
182
|
})();
|
|
157
183
|
}
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
159
184
|
initModels() {
|
|
160
185
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
161
186
|
throw new Error('Method not implemented.');
|
|
162
187
|
})();
|
|
163
188
|
}
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
165
189
|
clearModels(refresh = true) {
|
|
166
190
|
return;
|
|
167
191
|
}
|
|
@@ -169,7 +193,6 @@ class BaseModel {
|
|
|
169
193
|
throw new Error('Method not implemented.');
|
|
170
194
|
}
|
|
171
195
|
prerender() {}
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
173
196
|
render(renderOptions) {
|
|
174
197
|
throw new Error('Method not implemented.');
|
|
175
198
|
}
|
|
@@ -214,6 +237,9 @@ class BaseModel {
|
|
|
214
237
|
if (key === 'stroke') {
|
|
215
238
|
value = (0, _l7Utils.rgb2arr)(value);
|
|
216
239
|
}
|
|
240
|
+
if (key === 'anchor') {
|
|
241
|
+
value = anchorToNumber(value);
|
|
242
|
+
}
|
|
217
243
|
options['u_' + key] = value;
|
|
218
244
|
}
|
|
219
245
|
});
|
|
@@ -11,6 +11,7 @@ export declare const COMMON_ATTRIBUTE_LOCATION: {
|
|
|
11
11
|
readonly OPACITY: 5;
|
|
12
12
|
readonly OFFSETS: 6;
|
|
13
13
|
readonly ROTATION: 7;
|
|
14
|
-
readonly
|
|
14
|
+
readonly ANCHOR: 8;
|
|
15
|
+
readonly MAX: 9;
|
|
15
16
|
};
|
|
16
17
|
export declare function getCommonStyleAttributeOptions(name: string): Partial<IStyleAttribute> | undefined;
|