@antv/l7-layers 2.28.11 → 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,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;
@@ -144,31 +144,29 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
144
144
  const lineStartIndex = positionedGlyphs.length;
145
145
  iconfonts.forEach(iconfont => {
146
146
  const glyph = glyphMap[iconfont];
147
- const baselineOffset = 0;
148
147
  if (glyph) {
148
+ // iconfont 的锚点应由 align 阶段统一处理,这里只保留纹理 buffer 补偿,避免 left/right 被预居中抵消
149
149
  positionedGlyphs.push({
150
150
  glyph: iconfont,
151
- // x,
151
+ x: x + 4,
152
+ y: 4 - glyph.height / 2,
152
153
  /**
153
154
  * iconfont
154
155
  * 在计算大小的时候计算的是 unicode 字符 如 
155
156
  * 在布局计算 icon 位置的时候应该始终保持居中(且 icon 只占一个字符的位置)
156
157
  */
157
- x: glyph.advance / 2,
158
- y: y + baselineOffset,
159
158
  vertical: false,
160
159
  // TODO:目前只支持水平方向
161
160
  scale: 1,
162
161
  metrics: glyph
163
162
  });
164
- x += glyph.advance + spacing;
163
+ x += glyph.width + spacing;
165
164
  }
166
165
 
167
- // 左右对齐
166
+ // iconfont 单独按字形纹理宽度计算布局,避免再次按文本 advance 做 justify 产生额外偏移
168
167
  if (positionedGlyphs.length !== lineStartIndex) {
169
168
  const lineLength = x - spacing;
170
169
  maxLineLength = Math.max(lineLength, maxLineLength);
171
- justifyLine(positionedGlyphs, glyphMap, lineStartIndex, positionedGlyphs.length - 1, justify);
172
170
  }
173
171
  x = 0;
174
172
  y -= lineHeight + 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.28.11",
3
+ "version": "2.28.13",
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-source": "2.28.11",
30
- "@antv/l7-utils": "2.28.11",
31
- "@antv/l7-core": "2.28.11",
32
- "@antv/l7-maps": "2.28.11"
29
+ "@antv/l7-core": "2.28.13",
30
+ "@antv/l7-maps": "2.28.13",
31
+ "@antv/l7-utils": "2.28.13",
32
+ "@antv/l7-source": "2.28.13"
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.28.11"
37
+ "@antv/l7-test-utils": "^2.28.13"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",