@antv/l7-layers 2.28.12 → 2.28.13

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.
Files changed (41) hide show
  1. package/es/core/interface.d.ts +4 -0
  2. package/es/plugins/DataMappingPlugin.js +3 -3
  3. package/es/plugins/index.d.ts +1 -1
  4. package/es/point/models/billboard_point.js +1 -1
  5. package/es/point/models/earthFill.js +1 -1
  6. package/es/point/models/fill.js +1 -1
  7. package/es/point/models/fillImage.js +1 -1
  8. package/es/point/models/image.js +1 -1
  9. package/es/point/models/normal.js +1 -1
  10. package/es/point/models/radar.js +1 -1
  11. package/es/point/models/text.d.ts +41 -6
  12. package/es/point/models/text.js +227 -25
  13. package/es/point/shaders/billboard/billboard_point_vert.glsl +4 -2
  14. package/es/point/shaders/image/image_vert.glsl +4 -2
  15. package/es/point/shaders/normal/normal_vert.glsl +4 -2
  16. package/es/point/shaders/text/text_frag.glsl +46 -6
  17. package/es/point/shaders/text/text_vert.glsl +15 -1
  18. package/es/tile/tile/Tile.d.ts +1 -1
  19. package/es/tile/tile/util.d.ts +1 -1
  20. package/es/utils/symbol-layout.js +5 -7
  21. package/lib/core/interface.d.ts +4 -0
  22. package/lib/plugins/DataMappingPlugin.js +3 -3
  23. package/lib/plugins/index.d.ts +1 -1
  24. package/lib/point/models/billboard_point.js +1 -1
  25. package/lib/point/models/earthFill.js +1 -1
  26. package/lib/point/models/fill.js +1 -1
  27. package/lib/point/models/fillImage.js +1 -1
  28. package/lib/point/models/image.js +1 -1
  29. package/lib/point/models/normal.js +1 -1
  30. package/lib/point/models/radar.js +1 -1
  31. package/lib/point/models/text.d.ts +41 -6
  32. package/lib/point/models/text.js +229 -25
  33. package/lib/point/shaders/billboard/billboard_point_vert.glsl +4 -2
  34. package/lib/point/shaders/image/image_vert.glsl +4 -2
  35. package/lib/point/shaders/normal/normal_vert.glsl +4 -2
  36. package/lib/point/shaders/text/text_frag.glsl +46 -6
  37. package/lib/point/shaders/text/text_vert.glsl +15 -1
  38. package/lib/tile/tile/Tile.d.ts +1 -1
  39. package/lib/tile/tile/util.d.ts +1 -1
  40. package/lib/utils/symbol-layout.js +5 -7
  41. package/package.json +6 -6
@@ -1,43 +1,125 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import { AttributeType, gl } from '@antv/l7-core';
5
5
  import { boundsContains, calculateCentroid, lodashUtil, padBounds, rgb2arr } from '@antv/l7-utils';
6
6
  import BaseModel from "../../core/BaseModel";
7
7
  import CollisionIndex from "../../utils/collision-index";
8
8
  import { getGlyphQuads, shapeText } from "../../utils/symbol-layout";
9
9
  /* babel-plugin-inline-import '../shaders/text/text_frag.glsl' */
10
- const textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\n\nuniform sampler2D u_sdf_map;\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nin vec2 v_uv;\nin float v_gamma_scale;\nin vec4 v_color;\nin vec4 v_stroke_color;\nin float v_fontScale;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;\n\n lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n // \u6839\u636E stroke \u7684 alpha \u503C\u8C03\u6574\u6DF7\u5408\u6743\u91CD\uFF0C\u907F\u514D\u900F\u660E stroke \u5F71\u54CD\u6587\u672C\u989C\u8272\n float stroke_mix_factor = smoothstep(0., 0.5, 1.- dist) * v_stroke_color.a;\n outputColor = mix(v_color, v_stroke_color, stroke_mix_factor);\n\n outputColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
10
+ const textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\n\nuniform sampler2D u_sdf_map;\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec4 u_background_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_background_radius : 0.0;\n float u_background_shape : 0.0;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nin vec2 v_uv;\nin vec2 v_backgroundUV;\nin vec2 v_backgroundSize;\nin float v_gamma_scale;\nin float v_textQuadType;\nin vec4 v_color;\nin vec4 v_stroke_color;\nin vec4 v_background_color;\nin float v_fontScale;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n if (v_textQuadType > 0.5) {\n vec2 halfSize = v_backgroundSize * 0.5;\n float radius = clamp(u_background_radius, 0.0, min(halfSize.x, halfSize.y));\n if (u_background_shape > 0.5) {\n radius = min(halfSize.x, halfSize.y);\n }\n\n vec2 centered = (v_backgroundUV - 0.5) * v_backgroundSize;\n vec2 q = abs(centered) - (halfSize - vec2(radius));\n float signedDistance = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius;\n float aa = max(fwidth(signedDistance), 1.0);\n float backgroundAlpha = (1.0 - smoothstep(0.0, aa, signedDistance)) * v_background_color.a;\n outputColor = vec4(v_background_color.rgb, backgroundAlpha);\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n return;\n }\n\n // get sdf from atlas\n float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;\n\n lowp float fill_buff = 6.0 / SDF_PX;\n lowp float stroke_buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float fill_alpha = smoothstep(\n fill_buff - gamma_scaled,\n fill_buff + gamma_scaled,\n dist\n ) * v_color.a;\n highp float outer_alpha = smoothstep(\n stroke_buff - gamma_scaled,\n stroke_buff + gamma_scaled,\n dist\n );\n highp float stroke_alpha = max(outer_alpha - fill_alpha / max(v_color.a, 0.0001), 0.0) * v_stroke_color.a;\n\n float out_alpha = clamp(fill_alpha + stroke_alpha, 0.0, 1.0);\n vec3 out_rgb = vec3(0.0);\n if (out_alpha > 0.0) {\n out_rgb = (v_color.rgb * fill_alpha + v_stroke_color.rgb * stroke_alpha) / out_alpha;\n }\n\n outputColor = vec4(out_rgb, out_alpha);\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
11
11
  /* babel-plugin-inline-import '../shaders/text/text_vert.glsl' */
12
- const textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nout vec2 v_uv;\nout float v_gamma_scale;\nout vec4 v_color;\nout vec4 v_stroke_color;\nout float v_fontScale;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_uv = a_tex / u_sdf_map_size;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n vec2 offset = rotate_matrix(a_textOffsets,rotation);\n\n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
12
+ const textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_QUAD_TYPE) in float a_textQuadType;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_BACKGROUND_UV) in vec2 a_backgroundUV;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_BACKGROUND_SIZE) in vec2 a_backgroundSize;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec4 u_background_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_background_radius : 0.0;\n float u_background_shape : 0.0;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nout vec2 v_uv;\nout vec2 v_backgroundUV;\nout vec2 v_backgroundSize;\nout float v_gamma_scale;\nout float v_textQuadType;\nout vec4 v_color;\nout vec4 v_stroke_color;\nout vec4 v_background_color;\nout float v_fontScale;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_uv = a_tex / u_sdf_map_size;\n v_backgroundUV = a_backgroundUV;\n v_backgroundSize = a_backgroundSize;\n v_textQuadType = a_textQuadType;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n v_background_color = vec4(u_background_color.xyz, u_background_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n vec2 offset = rotate_matrix(a_textOffsets,rotation);\n\n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = projected_position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
13
13
  const {
14
14
  isEqual
15
15
  } = lodashUtil;
16
+ const TEXT_BACKGROUND_SHAPE = {
17
+ rect: 0,
18
+ circle: 1,
19
+ 'circle-rect': 2
20
+ };
21
+ function normalizePadding(padding = [0, 0]) {
22
+ return Array.isArray(padding) ? padding : [padding, padding];
23
+ }
24
+ function hasBackground(backgroundColor) {
25
+ return rgb2arr(backgroundColor || '')[3] > 0;
26
+ }
27
+ function getBackgroundQuad(glyphQuads, backgroundPadding, backgroundShape) {
28
+ const x1Bounds = Math.min(...glyphQuads.map(quad => Math.min(quad.tl.x, quad.bl.x)));
29
+ const y1Bounds = Math.min(...glyphQuads.map(quad => Math.min(quad.tl.y, quad.tr.y)));
30
+ const x2Bounds = Math.max(...glyphQuads.map(quad => Math.max(quad.tr.x, quad.br.x)));
31
+ const y2Bounds = Math.max(...glyphQuads.map(quad => Math.max(quad.bl.y, quad.br.y)));
32
+ let x1 = x1Bounds - backgroundPadding[0];
33
+ let y1 = y1Bounds - backgroundPadding[1];
34
+ let x2 = x2Bounds + backgroundPadding[0];
35
+ let y2 = y2Bounds + backgroundPadding[1];
36
+ if (backgroundShape === 'circle') {
37
+ const centerX = (x1 + x2) / 2;
38
+ const centerY = (y1 + y2) / 2;
39
+ const diameter = Math.max(x2 - x1, y2 - y1);
40
+ x1 = centerX - diameter / 2;
41
+ x2 = centerX + diameter / 2;
42
+ y1 = centerY - diameter / 2;
43
+ y2 = centerY + diameter / 2;
44
+ }
45
+ return {
46
+ tl: {
47
+ x: x1,
48
+ y: y1
49
+ },
50
+ tr: {
51
+ x: x2,
52
+ y: y1
53
+ },
54
+ br: {
55
+ x: x2,
56
+ y: y2
57
+ },
58
+ bl: {
59
+ x: x1,
60
+ y: y2
61
+ },
62
+ size: [x2 - x1, y2 - y1]
63
+ };
64
+ }
16
65
  export function TextTrianglation(feature) {
66
+ return buildTextTriangles.call(this, feature, 'all');
67
+ }
68
+ export function TextBackgroundTrianglation(feature) {
69
+ return buildTextTriangles.call(this, feature, 'background');
70
+ }
71
+ export function TextGlyphTrianglation(feature) {
72
+ return buildTextTriangles.call(this, feature, 'glyph');
73
+ }
74
+ function buildTextTriangles(feature, mode) {
17
75
  // @ts-ignore
18
76
  const that = this;
19
77
  const id = feature.id;
20
78
  const vertices = [];
21
79
  const indices = [];
80
+ const pushQuad = (quad, index, coord) => {
81
+ const baseIndex = index * 4;
82
+ const tex = 'tex' in quad && quad.tex ? quad.tex : {
83
+ x: 0,
84
+ y: 0,
85
+ width: 0,
86
+ height: 0
87
+ };
88
+ const bgUV = 'quadType' in quad && quad.quadType > 0 ? [[0, 0], [1, 0], [1, 1], [0, 1]] : [[0, 0], [0, 0], [0, 0], [0, 0]];
89
+ const bgSize = 'size' in quad ? quad.size : [0, 0];
90
+ const quadType = 'quadType' in quad ? quad.quadType : 0;
91
+ vertices.push(...coord, tex.x, tex.y + tex.height, quad.tl.x, quad.tl.y, quadType, bgUV[0][0], bgUV[0][1], bgSize[0], bgSize[1], ...coord, tex.x + tex.width, tex.y + tex.height, quad.tr.x, quad.tr.y, quadType, bgUV[1][0], bgUV[1][1], bgSize[0], bgSize[1], ...coord, tex.x + tex.width, tex.y, quad.br.x, quad.br.y, quadType, bgUV[2][0], bgUV[2][1], bgSize[0], bgSize[1], ...coord, tex.x, tex.y, quad.bl.x, quad.bl.y, quadType, bgUV[3][0], bgUV[3][1], bgSize[0], bgSize[1]);
92
+ indices.push(baseIndex, baseIndex + 1, baseIndex + 2, baseIndex + 2, baseIndex + 3, baseIndex);
93
+ };
22
94
  if (!that.glyphInfoMap || !that.glyphInfoMap[id]) {
23
95
  return {
24
96
  vertices: [],
25
97
  // [ x, y, z, tex.x,tex.y, offset.x. offset.y]
26
98
  indices: [],
27
- size: 7
99
+ size: 12
28
100
  };
29
101
  }
30
- const centroid = that.glyphInfoMap[id].centroid; // 计算中心点
102
+ const textRenderInfo = that.glyphInfoMap[id];
103
+ const centroid = textRenderInfo.centroid; // 计算中心点
31
104
  const coord = centroid.length === 2 ? [centroid[0], centroid[1], 0] : centroid;
32
- that.glyphInfoMap[id].glyphQuads.forEach((quad, index) => {
33
- vertices.push(...coord, quad.tex.x, quad.tex.y + quad.tex.height, quad.tl.x, quad.tl.y, ...coord, quad.tex.x + quad.tex.width, quad.tex.y + quad.tex.height, quad.tr.x, quad.tr.y, ...coord, quad.tex.x + quad.tex.width, quad.tex.y, quad.br.x, quad.br.y, ...coord, quad.tex.x, quad.tex.y, quad.bl.x, quad.bl.y);
34
- indices.push(0 + index * 4, 1 + index * 4, 2 + index * 4, 2 + index * 4, 3 + index * 4, 0 + index * 4);
35
- });
105
+ let quadIndex = 0;
106
+ if (mode !== 'glyph' && textRenderInfo.backgroundQuad) {
107
+ pushQuad(_objectSpread(_objectSpread({}, textRenderInfo.backgroundQuad), {}, {
108
+ quadType: 1
109
+ }), quadIndex, coord);
110
+ quadIndex += 1;
111
+ }
112
+ if (mode !== 'background') {
113
+ textRenderInfo.glyphQuads.forEach(quad => {
114
+ pushQuad(quad, quadIndex, coord);
115
+ quadIndex += 1;
116
+ });
117
+ }
36
118
  return {
37
119
  vertices,
38
120
  // [ x, y, z, tex.x,tex.y, offset.x. offset.y]
39
121
  indices,
40
- size: 7
122
+ size: 12
41
123
  };
42
124
  }
43
125
  export default class TextModel extends BaseModel {
@@ -55,9 +137,11 @@ export default class TextModel extends BaseModel {
55
137
  _defineProperty(this, "textCount", 0);
56
138
  _defineProperty(this, "preTextStyle", {});
57
139
  _defineProperty(this, "mapping", /*#__PURE__*/_asyncToGenerator(function* () {
140
+ _this.rawEncodeData = _this.layer.getEncodedData();
58
141
  _this.initGlyph(); //
59
142
  _this.updateTexture();
60
143
  yield _this.reBuildModel();
144
+ _this.layer.renderLayers();
61
145
  }));
62
146
  }
63
147
  get attributeLocation() {
@@ -65,7 +149,10 @@ export default class TextModel extends BaseModel {
65
149
  MAX: super.attributeLocation.MAX,
66
150
  SIZE: 9,
67
151
  TEXT_OFFSETS: 10,
68
- UV: 11
152
+ UV: 11,
153
+ TEXT_QUAD_TYPE: 12,
154
+ TEXT_BACKGROUND_UV: 13,
155
+ TEXT_BACKGROUND_SIZE: 14
69
156
  });
70
157
  }
71
158
  getUninforms() {
@@ -77,9 +164,14 @@ export default class TextModel extends BaseModel {
77
164
  });
78
165
  }
79
166
  getCommonUniformsInfo() {
167
+ var _TEXT_BACKGROUND_SHAP;
80
168
  const {
81
169
  stroke = '#fff',
170
+ strokeOpacity = 1,
82
171
  strokeWidth = 0,
172
+ backgroundColor = 'rgba(0, 0, 0, 0)',
173
+ backgroundRadius = 0,
174
+ backgroundShape = 'rect',
83
175
  halo = 0.5,
84
176
  gamma = 2.0,
85
177
  raisingHeight = 0
@@ -91,11 +183,16 @@ export default class TextModel extends BaseModel {
91
183
  this.textCount = Object.keys(mapping).length;
92
184
  }
93
185
  this.preTextStyle = this.getTextStyle();
186
+ const strokeColor = rgb2arr(stroke);
187
+ const bgColor = rgb2arr(backgroundColor);
94
188
  const commonOptions = {
95
- u_stroke_color: rgb2arr(stroke),
189
+ u_stroke_color: [strokeColor[0], strokeColor[1], strokeColor[2], strokeColor[3] * strokeOpacity],
190
+ u_background_color: bgColor,
96
191
  u_sdf_map_size: [(canvas === null || canvas === void 0 ? void 0 : canvas.width) || 1, (canvas === null || canvas === void 0 ? void 0 : canvas.height) || 1],
97
192
  u_raisingHeight: Number(raisingHeight),
98
193
  u_stroke_width: strokeWidth,
194
+ u_background_radius: backgroundRadius,
195
+ u_background_shape: (_TEXT_BACKGROUND_SHAP = TEXT_BACKGROUND_SHAPE[backgroundShape]) !== null && _TEXT_BACKGROUND_SHAP !== void 0 ? _TEXT_BACKGROUND_SHAP : TEXT_BACKGROUND_SHAPE.rect,
99
196
  u_gamma_scale: gamma,
100
197
  u_halo_blur: halo
101
198
  };
@@ -118,7 +215,8 @@ export default class TextModel extends BaseModel {
118
215
  var _this3 = this;
119
216
  return _asyncToGenerator(function* () {
120
217
  const {
121
- textAllowOverlap = false
218
+ textAllowOverlap = false,
219
+ backgroundColor
122
220
  } = _this3.layer.getLayerConfig();
123
221
 
124
222
  // this.mapping(); 重复调用
@@ -127,18 +225,32 @@ export default class TextModel extends BaseModel {
127
225
  if (!textAllowOverlap) {
128
226
  _this3.filterGlyphs();
129
227
  }
130
- const model = yield _this3.layer.buildLayerModel({
228
+ const textModel = yield _this3.layer.buildLayerModel({
229
+ moduleName: 'pointText',
230
+ vertexShader: textVert,
231
+ fragmentShader: textFrag,
232
+ defines: _this3.getDefines(),
233
+ inject: _this3.getInject(),
234
+ triangulation: TextGlyphTrianglation.bind(_this3),
235
+ depth: {
236
+ enable: false
237
+ }
238
+ });
239
+ if (!hasBackground(backgroundColor)) {
240
+ return [textModel];
241
+ }
242
+ const backgroundModel = yield _this3.layer.buildLayerModel({
131
243
  moduleName: 'pointText',
132
244
  vertexShader: textVert,
133
245
  fragmentShader: textFrag,
134
246
  defines: _this3.getDefines(),
135
247
  inject: _this3.getInject(),
136
- triangulation: TextTrianglation.bind(_this3),
248
+ triangulation: TextBackgroundTrianglation.bind(_this3),
137
249
  depth: {
138
250
  enable: false
139
251
  }
140
252
  });
141
- return [model];
253
+ return [backgroundModel, textModel];
142
254
  })();
143
255
  }
144
256
  // 需要更新的场景
@@ -155,10 +267,13 @@ export default class TextModel extends BaseModel {
155
267
  textAnchor = 'center',
156
268
  textOffset,
157
269
  padding,
270
+ backgroundColor,
271
+ backgroundPadding,
272
+ backgroundShape,
158
273
  fontFamily,
159
274
  fontWeight
160
275
  } = _this4.getTextStyle();
161
- if (!isEqual(padding, _this4.preTextStyle.padding) || !isEqual(textOffset, _this4.preTextStyle.textOffset) || !isEqual(textAnchor, _this4.preTextStyle.textAnchor) || !isEqual(fontFamily, _this4.preTextStyle.fontFamily) || !isEqual(fontWeight, _this4.preTextStyle.fontWeight)) {
276
+ if (!isEqual(padding, _this4.preTextStyle.padding) || backgroundColor !== _this4.preTextStyle.backgroundColor || !isEqual(backgroundPadding, _this4.preTextStyle.backgroundPadding) || backgroundShape !== _this4.preTextStyle.backgroundShape || !isEqual(textOffset, _this4.preTextStyle.textOffset) || !isEqual(textAnchor, _this4.preTextStyle.textAnchor) || !isEqual(fontFamily, _this4.preTextStyle.fontFamily) || !isEqual(fontWeight, _this4.preTextStyle.fontWeight)) {
162
277
  yield _this4.mapping();
163
278
  return true;
164
279
  }
@@ -225,6 +340,57 @@ export default class TextModel extends BaseModel {
225
340
  }
226
341
  }
227
342
  });
343
+ this.styleAttributeService.registerStyleAttribute({
344
+ name: 'textQuadType',
345
+ type: AttributeType.Attribute,
346
+ descriptor: {
347
+ name: 'a_textQuadType',
348
+ shaderLocation: this.attributeLocation.TEXT_QUAD_TYPE,
349
+ buffer: {
350
+ usage: gl.DYNAMIC_DRAW,
351
+ data: [],
352
+ type: gl.FLOAT
353
+ },
354
+ size: 1,
355
+ update: (feature, featureIdx, vertex) => {
356
+ return [vertex[7]];
357
+ }
358
+ }
359
+ });
360
+ this.styleAttributeService.registerStyleAttribute({
361
+ name: 'textBackgroundUv',
362
+ type: AttributeType.Attribute,
363
+ descriptor: {
364
+ name: 'a_backgroundUV',
365
+ shaderLocation: this.attributeLocation.TEXT_BACKGROUND_UV,
366
+ buffer: {
367
+ usage: gl.DYNAMIC_DRAW,
368
+ data: [],
369
+ type: gl.FLOAT
370
+ },
371
+ size: 2,
372
+ update: (feature, featureIdx, vertex) => {
373
+ return [vertex[8], vertex[9]];
374
+ }
375
+ }
376
+ });
377
+ this.styleAttributeService.registerStyleAttribute({
378
+ name: 'textBackgroundSize',
379
+ type: AttributeType.Attribute,
380
+ descriptor: {
381
+ name: 'a_backgroundSize',
382
+ shaderLocation: this.attributeLocation.TEXT_BACKGROUND_SIZE,
383
+ buffer: {
384
+ usage: gl.DYNAMIC_DRAW,
385
+ data: [],
386
+ type: gl.FLOAT
387
+ },
388
+ size: 2,
389
+ update: (feature, featureIdx, vertex) => {
390
+ return [vertex[10], vertex[11]];
391
+ }
392
+ }
393
+ });
228
394
 
229
395
  // point layer size;
230
396
  this.styleAttributeService.registerStyleAttribute({
@@ -323,6 +489,10 @@ export default class TextModel extends BaseModel {
323
489
  padding = [0, 0],
324
490
  textAnchor = 'center',
325
491
  textOffset = [0, 0],
492
+ backgroundColor = 'rgba(0, 0, 0, 0)',
493
+ backgroundPadding = [0, 0],
494
+ backgroundRadius = 0,
495
+ backgroundShape = 'rect',
326
496
  opacity = 1,
327
497
  strokeOpacity = 1,
328
498
  strokeWidth = 0,
@@ -333,6 +503,10 @@ export default class TextModel extends BaseModel {
333
503
  fontFamily,
334
504
  textAllowOverlap,
335
505
  padding,
506
+ backgroundColor,
507
+ backgroundPadding: normalizePadding(backgroundPadding),
508
+ backgroundRadius,
509
+ backgroundShape,
336
510
  textAnchor,
337
511
  textOffset,
338
512
  opacity,
@@ -350,7 +524,10 @@ export default class TextModel extends BaseModel {
350
524
  const {
351
525
  spacing = 2,
352
526
  textAnchor = 'center',
353
- textOffset
527
+ textOffset,
528
+ backgroundColor,
529
+ backgroundPadding = [0, 0],
530
+ backgroundShape = 'rect'
354
531
  } = this.layer.getLayerConfig();
355
532
  const data = this.rawEncodeData;
356
533
  this.glyphInfo = data.map(feature => {
@@ -367,6 +544,7 @@ export default class TextModel extends BaseModel {
367
544
  //
368
545
  iconfont);
369
546
  const glyphQuads = getGlyphQuads(shaping, offset, false);
547
+ const backgroundQuad = hasBackground(backgroundColor) ? getBackgroundQuad(glyphQuads, normalizePadding(backgroundPadding), backgroundShape) : undefined;
370
548
  feature.shaping = shaping;
371
549
  feature.glyphQuads = glyphQuads;
372
550
  // feature.centroid = calculteCentroid(coordinates);
@@ -375,6 +553,7 @@ export default class TextModel extends BaseModel {
375
553
  this.glyphInfoMap[id] = {
376
554
  shaping,
377
555
  glyphQuads,
556
+ backgroundQuad,
378
557
  centroid: calculateCentroid(feature.coordinates)
379
558
  };
380
559
  return feature;
@@ -402,12 +581,16 @@ export default class TextModel extends BaseModel {
402
581
  filterGlyphs() {
403
582
  const {
404
583
  padding = [0, 0],
584
+ backgroundColor,
585
+ backgroundPadding = [0, 0],
405
586
  textAllowOverlap = false
406
587
  } = this.layer.getLayerConfig();
407
588
  if (textAllowOverlap) {
408
589
  // 如果允许文本覆盖
409
590
  return;
410
591
  }
592
+ const collisionPadding = normalizePadding(backgroundPadding);
593
+ const extraPadding = hasBackground(backgroundColor) ? collisionPadding : [0, 0];
411
594
  this.glyphInfoMap = {};
412
595
  this.currentZoom = this.mapService.getZoom();
413
596
  this.extent = this.textExtent();
@@ -428,10 +611,10 @@ export default class TextModel extends BaseModel {
428
611
  const {
429
612
  box
430
613
  } = collisionIndex.placeCollisionBox({
431
- x1: shaping.left * fontScale - padding[0],
432
- x2: shaping.right * fontScale + padding[0],
433
- y1: shaping.top * fontScale - padding[1],
434
- y2: shaping.bottom * fontScale + padding[1],
614
+ x1: shaping.left * fontScale - padding[0] - extraPadding[0],
615
+ x2: shaping.right * fontScale + padding[0] + extraPadding[0],
616
+ y1: shaping.top * fontScale - padding[1] - extraPadding[1],
617
+ y2: shaping.bottom * fontScale + padding[1] + extraPadding[1],
435
618
  anchorPointX: pixels.x,
436
619
  anchorPointY: pixels.y
437
620
  });
@@ -484,12 +667,31 @@ export default class TextModel extends BaseModel {
484
667
  reBuildModel() {
485
668
  var _this5 = this;
486
669
  return _asyncToGenerator(function* () {
670
+ const {
671
+ backgroundColor
672
+ } = _this5.layer.getLayerConfig();
673
+ _this5.rawEncodeData = _this5.layer.getEncodedData();
487
674
  _this5.filterGlyphs();
488
- const model = yield _this5.layer.buildLayerModel({
675
+ const textModel = yield _this5.layer.buildLayerModel({
676
+ moduleName: 'pointText',
677
+ vertexShader: textVert,
678
+ fragmentShader: textFrag,
679
+ triangulation: TextGlyphTrianglation.bind(_this5),
680
+ defines: _this5.getDefines(),
681
+ inject: _this5.getInject(),
682
+ depth: {
683
+ enable: false
684
+ }
685
+ });
686
+ if (!hasBackground(backgroundColor)) {
687
+ _this5.layer.models = [textModel];
688
+ return;
689
+ }
690
+ const backgroundModel = yield _this5.layer.buildLayerModel({
489
691
  moduleName: 'pointText',
490
692
  vertexShader: textVert,
491
693
  fragmentShader: textFrag,
492
- triangulation: TextTrianglation.bind(_this5),
694
+ triangulation: TextBackgroundTrianglation.bind(_this5),
493
695
  defines: _this5.getDefines(),
494
696
  inject: _this5.getInject(),
495
697
  depth: {
@@ -497,7 +699,7 @@ export default class TextModel extends BaseModel {
497
699
  }
498
700
  });
499
701
  // TODO 渲染流程待修改
500
- _this5.layer.models = [model];
702
+ _this5.layer.models = [backgroundModel, textModel];
501
703
  })();
502
704
  }
503
705
  }
@@ -27,6 +27,7 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
27
27
  }
28
28
 
29
29
  vec2 offset = vec2(0.0);
30
+ float gap = 2.0 * u_DevicePixelRatio; // 2px 间隔,考虑设备像素比
30
31
 
31
32
  // horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
32
33
  if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
@@ -36,10 +37,11 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
36
37
  }
37
38
 
38
39
  // vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
40
+ // bottom 和 top 增加 2px 间隔,避免图形紧贴参考点
39
41
  if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
40
- offset.y = -pointSize * 0.5;
42
+ offset.y = -pointSize * 0.5 - gap; // top: 图形在坐标下方,额外向下移 2px
41
43
  } else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
42
- offset.y = pointSize * 0.5;
44
+ offset.y = pointSize * 0.5 + gap; // bottom: 图形在坐标上方,额外向上移 2px
43
45
  }
44
46
 
45
47
  return offset;
@@ -25,6 +25,7 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
25
25
  }
26
26
 
27
27
  vec2 offset = vec2(0.0);
28
+ float gap = 2.0 * u_DevicePixelRatio; // 2px 间隔,考虑设备像素比
28
29
 
29
30
  // horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
30
31
  if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
@@ -34,10 +35,11 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
34
35
  }
35
36
 
36
37
  // vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
38
+ // bottom 和 top 增加 2px 间隔,避免图形紧贴参考点
37
39
  if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
38
- offset.y = -pointSize * 0.5;
40
+ offset.y = -pointSize * 0.5 - gap; // top: 图形在坐标下方,额外向下移 2px
39
41
  } else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
40
- offset.y = pointSize * 0.5;
42
+ offset.y = pointSize * 0.5 + gap; // bottom: 图形在坐标上方,额外向上移 2px
41
43
  }
42
44
 
43
45
  return offset;
@@ -20,6 +20,7 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
20
20
  }
21
21
 
22
22
  vec2 offset = vec2(0.0);
23
+ float gap = 2.0 * u_DevicePixelRatio; // 2px 间隔,考虑设备像素比
23
24
 
24
25
  // horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
25
26
  if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
@@ -29,10 +30,11 @@ vec2 applyAnchorPoint(float anchor, float pointSize) {
29
30
  }
30
31
 
31
32
  // vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
33
+ // bottom 和 top 增加 2px 间隔,避免图形紧贴参考点
32
34
  if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
33
- offset.y = -pointSize * 0.5;
35
+ offset.y = -pointSize * 0.5 - gap; // top: 图形在坐标下方,额外向下移 2px
34
36
  } else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
35
- offset.y = pointSize * 0.5;
37
+ offset.y = pointSize * 0.5 + gap; // bottom: 图形在坐标上方,额外向上移 2px
36
38
  }
37
39
 
38
40
  return offset;
@@ -5,17 +5,24 @@
5
5
  uniform sampler2D u_sdf_map;
6
6
  layout(std140) uniform commonUniforms {
7
7
  vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
8
+ vec4 u_background_color : [0.0, 0.0, 0.0, 0.0];
8
9
  vec2 u_sdf_map_size;
9
10
  float u_raisingHeight: 0.0;
10
11
  float u_stroke_width : 2;
12
+ float u_background_radius : 0.0;
13
+ float u_background_shape : 0.0;
11
14
  float u_gamma_scale : 0.5;
12
15
  float u_halo_blur : 0.5;
13
16
  };
14
17
 
15
18
  in vec2 v_uv;
19
+ in vec2 v_backgroundUV;
20
+ in vec2 v_backgroundSize;
16
21
  in float v_gamma_scale;
22
+ in float v_textQuadType;
17
23
  in vec4 v_color;
18
24
  in vec4 v_stroke_color;
25
+ in vec4 v_background_color;
19
26
  in float v_fontScale;
20
27
 
21
28
  out vec4 outputColor;
@@ -24,21 +31,54 @@ out vec4 outputColor;
24
31
  void main() {
25
32
  // get style data mapping
26
33
 
34
+ if (v_textQuadType > 0.5) {
35
+ vec2 halfSize = v_backgroundSize * 0.5;
36
+ float radius = clamp(u_background_radius, 0.0, min(halfSize.x, halfSize.y));
37
+ if (u_background_shape > 0.5) {
38
+ radius = min(halfSize.x, halfSize.y);
39
+ }
40
+
41
+ vec2 centered = (v_backgroundUV - 0.5) * v_backgroundSize;
42
+ vec2 q = abs(centered) - (halfSize - vec2(radius));
43
+ float signedDistance = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius;
44
+ float aa = max(fwidth(signedDistance), 1.0);
45
+ float backgroundAlpha = (1.0 - smoothstep(0.0, aa, signedDistance)) * v_background_color.a;
46
+ outputColor = vec4(v_background_color.rgb, backgroundAlpha);
47
+ if (outputColor.a < 0.01) {
48
+ discard;
49
+ }
50
+ outputColor = filterColor(outputColor);
51
+ return;
52
+ }
53
+
27
54
  // get sdf from atlas
28
55
  float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;
29
56
 
30
- lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
57
+ lowp float fill_buff = 6.0 / SDF_PX;
58
+ lowp float stroke_buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
31
59
  highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
32
60
 
33
61
  highp float gamma_scaled = gamma * v_gamma_scale;
34
62
 
35
- highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
63
+ highp float fill_alpha = smoothstep(
64
+ fill_buff - gamma_scaled,
65
+ fill_buff + gamma_scaled,
66
+ dist
67
+ ) * v_color.a;
68
+ highp float outer_alpha = smoothstep(
69
+ stroke_buff - gamma_scaled,
70
+ stroke_buff + gamma_scaled,
71
+ dist
72
+ );
73
+ highp float stroke_alpha = max(outer_alpha - fill_alpha / max(v_color.a, 0.0001), 0.0) * v_stroke_color.a;
36
74
 
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);
75
+ float out_alpha = clamp(fill_alpha + stroke_alpha, 0.0, 1.0);
76
+ vec3 out_rgb = vec3(0.0);
77
+ if (out_alpha > 0.0) {
78
+ out_rgb = (v_color.rgb * fill_alpha + v_stroke_color.rgb * stroke_alpha) / out_alpha;
79
+ }
40
80
 
41
- outputColor.a *= alpha;
81
+ outputColor = vec4(out_rgb, out_alpha);
42
82
  // 作为 mask 模板时需要丢弃透明的像素
43
83
  if (outputColor.a < 0.01) {
44
84
  discard;
@@ -8,20 +8,30 @@ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
8
8
  layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
9
9
  layout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;
10
10
  layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;
11
+ layout(location = ATTRIBUTE_LOCATION_TEXT_QUAD_TYPE) in float a_textQuadType;
12
+ layout(location = ATTRIBUTE_LOCATION_TEXT_BACKGROUND_UV) in vec2 a_backgroundUV;
13
+ layout(location = ATTRIBUTE_LOCATION_TEXT_BACKGROUND_SIZE) in vec2 a_backgroundSize;
11
14
 
12
15
  layout(std140) uniform commonUniforms {
13
16
  vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
17
+ vec4 u_background_color : [0.0, 0.0, 0.0, 0.0];
14
18
  vec2 u_sdf_map_size;
15
19
  float u_raisingHeight: 0.0;
16
20
  float u_stroke_width : 2;
21
+ float u_background_radius : 0.0;
22
+ float u_background_shape : 0.0;
17
23
  float u_gamma_scale : 0.5;
18
24
  float u_halo_blur : 0.5;
19
25
  };
20
26
 
21
27
  out vec2 v_uv;
28
+ out vec2 v_backgroundUV;
29
+ out vec2 v_backgroundSize;
22
30
  out float v_gamma_scale;
31
+ out float v_textQuadType;
23
32
  out vec4 v_color;
24
33
  out vec4 v_stroke_color;
34
+ out vec4 v_background_color;
25
35
  out float v_fontScale;
26
36
 
27
37
  #pragma include "projection"
@@ -32,11 +42,15 @@ void main() {
32
42
  // cal style mapping - 数据纹理映射部分的计算
33
43
 
34
44
  v_uv = a_tex / u_sdf_map_size;
45
+ v_backgroundUV = a_backgroundUV;
46
+ v_backgroundSize = a_backgroundSize;
47
+ v_textQuadType = a_textQuadType;
35
48
 
36
49
 
37
50
 
38
51
  v_color = vec4(a_Color.xyz, a_Color.w * opacity);
39
52
  v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);
53
+ v_background_color = vec4(u_background_color.xyz, u_background_color.w * opacity);
40
54
 
41
55
  // 文本缩放比例
42
56
  float fontScale = a_Size / FONT_SIZE;
@@ -59,7 +73,7 @@ void main() {
59
73
 
60
74
  gl_Position = vec4(
61
75
  projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
62
- v_gamma_scale = gl_Position.w;
76
+ v_gamma_scale = projected_position.w;
63
77
  setPickingColor(a_PickingColor);
64
78
 
65
79
  }
@@ -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?: "device" | "regl" | undefined;
88
+ renderer?: "regl" | "device" | undefined;
89
89
  antialias?: boolean | undefined;
90
90
  preserveDrawingBuffer?: boolean | undefined;
91
91
  enableWebGPU?: boolean | undefined;
@@ -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 PointLayer | typeof PolygonLayer | typeof LineLayer;
4
+ export declare function getTileLayer(type: string): typeof PolygonLayer | typeof LineLayer | typeof PointLayer;
5
5
  export declare function isNeedMask(type: string): boolean;