@antv/l7-layers 2.15.0 → 2.15.2

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.
@@ -800,7 +800,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
800
800
  highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
801
801
  activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
802
802
  });
803
- this.hooks.beforeSelect.call(encodePickingColor(id)) // @ts-ignore
803
+ this.hooks.beforeHighlight.call(encodePickingColor(id)) // @ts-ignore
804
804
  .then(function () {
805
805
  setTimeout(function () {
806
806
  _this6.reRender();
@@ -43,6 +43,8 @@ export default class TextModel extends BaseModel {
43
43
  * 生成文字布局(对照文字纹理字典提取对应文字的位置很好信息)
44
44
  */
45
45
  private generateGlyphLayout;
46
+ private getFontServiceMapping;
47
+ private getFontServiceCanvas;
46
48
  /**
47
49
  * 文字避让 depend on originCentorid
48
50
  */
@@ -130,9 +130,8 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
130
130
  _ref2$raisingHeight = _ref2.raisingHeight,
131
131
  raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight;
132
132
 
133
- var _this$fontService = this.fontService,
134
- canvas = _this$fontService.canvas,
135
- mapping = _this$fontService.mapping;
133
+ var mapping = this.getFontServiceMapping();
134
+ var canvas = this.getFontServiceCanvas();
136
135
 
137
136
  if (mapping && Object.keys(mapping).length !== this.textCount && canvas) {
138
137
  this.updateTexture();
@@ -557,8 +556,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
557
556
  value: function generateGlyphLayout(iconfont) {
558
557
  var _this2 = this;
559
558
 
560
- // 更新文字布局
561
- var mapping = this.fontService.mapping;
559
+ var mapping = this.getFontServiceMapping();
562
560
 
563
561
  var _ref6 = this.layer.getLayerConfig(),
564
562
  _ref6$spacing = _ref6.spacing,
@@ -591,6 +589,29 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
591
589
  return feature;
592
590
  });
593
591
  }
592
+ }, {
593
+ key: "getFontServiceMapping",
594
+ value: function getFontServiceMapping() {
595
+ var _ref7 = this.layer.getLayerConfig(),
596
+ _ref7$fontWeight = _ref7.fontWeight,
597
+ fontWeight = _ref7$fontWeight === void 0 ? '400' : _ref7$fontWeight,
598
+ _ref7$fontFamily = _ref7.fontFamily,
599
+ fontFamily = _ref7$fontFamily === void 0 ? 'sans-serif' : _ref7$fontFamily;
600
+
601
+ return this.fontService.getMappingByKey("".concat(fontFamily, "_").concat(fontWeight));
602
+ }
603
+ }, {
604
+ key: "getFontServiceCanvas",
605
+ value: function getFontServiceCanvas() {
606
+ var _ref8 = this.layer.getLayerConfig(),
607
+ _ref8$fontWeight = _ref8.fontWeight,
608
+ fontWeight = _ref8$fontWeight === void 0 ? '400' : _ref8$fontWeight,
609
+ _ref8$fontFamily = _ref8.fontFamily,
610
+ fontFamily = _ref8$fontFamily === void 0 ? 'sans-serif' : _ref8$fontFamily; // 更新文字布局
611
+
612
+
613
+ return this.fontService.getCanvasByKey("".concat(fontFamily, "_").concat(fontWeight));
614
+ }
594
615
  /**
595
616
  * 文字避让 depend on originCentorid
596
617
  */
@@ -600,11 +621,11 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
600
621
  value: function filterGlyphs() {
601
622
  var _this3 = this;
602
623
 
603
- var _ref7 = this.layer.getLayerConfig(),
604
- _ref7$padding = _ref7.padding,
605
- padding = _ref7$padding === void 0 ? [0, 0] : _ref7$padding,
606
- _ref7$textAllowOverla = _ref7.textAllowOverlap,
607
- textAllowOverlap = _ref7$textAllowOverla === void 0 ? false : _ref7$textAllowOverla;
624
+ var _ref9 = this.layer.getLayerConfig(),
625
+ _ref9$padding = _ref9.padding,
626
+ padding = _ref9$padding === void 0 ? [0, 0] : _ref9$padding,
627
+ _ref9$textAllowOverla = _ref9.textAllowOverlap,
628
+ textAllowOverlap = _ref9$textAllowOverla === void 0 ? false : _ref9$textAllowOverla;
608
629
 
609
630
  if (textAllowOverlap) {
610
631
  // 如果允许文本覆盖
@@ -678,7 +699,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
678
699
  key: "updateTexture",
679
700
  value: function updateTexture() {
680
701
  var createTexture2D = this.rendererService.createTexture2D;
681
- var canvas = this.fontService.canvas;
702
+ var canvas = this.getFontServiceCanvas();
682
703
  this.textureHeight = canvas.height;
683
704
 
684
705
  if (this.texture) {
@@ -801,7 +801,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
801
801
  highlightColor: (0, _lodash.isObject)(options) ? options.color : this.getLayerConfig().highlightColor,
802
802
  activeMix: (0, _lodash.isObject)(options) ? options.mix : this.getLayerConfig().activeMix
803
803
  });
804
- this.hooks.beforeSelect.call((0, _l7Utils.encodePickingColor)(id)) // @ts-ignore
804
+ this.hooks.beforeHighlight.call((0, _l7Utils.encodePickingColor)(id)) // @ts-ignore
805
805
  .then(function () {
806
806
  setTimeout(function () {
807
807
  _this6.reRender();
@@ -147,9 +147,8 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
147
147
  _ref2$raisingHeight = _ref2.raisingHeight,
148
148
  raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight;
149
149
 
150
- var _this$fontService = this.fontService,
151
- canvas = _this$fontService.canvas,
152
- mapping = _this$fontService.mapping;
150
+ var mapping = this.getFontServiceMapping();
151
+ var canvas = this.getFontServiceCanvas();
153
152
 
154
153
  if (mapping && Object.keys(mapping).length !== this.textCount && canvas) {
155
154
  this.updateTexture();
@@ -574,8 +573,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
574
573
  value: function generateGlyphLayout(iconfont) {
575
574
  var _this2 = this;
576
575
 
577
- // 更新文字布局
578
- var mapping = this.fontService.mapping;
576
+ var mapping = this.getFontServiceMapping();
579
577
 
580
578
  var _ref6 = this.layer.getLayerConfig(),
581
579
  _ref6$spacing = _ref6.spacing,
@@ -608,6 +606,29 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
608
606
  return feature;
609
607
  });
610
608
  }
609
+ }, {
610
+ key: "getFontServiceMapping",
611
+ value: function getFontServiceMapping() {
612
+ var _ref7 = this.layer.getLayerConfig(),
613
+ _ref7$fontWeight = _ref7.fontWeight,
614
+ fontWeight = _ref7$fontWeight === void 0 ? '400' : _ref7$fontWeight,
615
+ _ref7$fontFamily = _ref7.fontFamily,
616
+ fontFamily = _ref7$fontFamily === void 0 ? 'sans-serif' : _ref7$fontFamily;
617
+
618
+ return this.fontService.getMappingByKey("".concat(fontFamily, "_").concat(fontWeight));
619
+ }
620
+ }, {
621
+ key: "getFontServiceCanvas",
622
+ value: function getFontServiceCanvas() {
623
+ var _ref8 = this.layer.getLayerConfig(),
624
+ _ref8$fontWeight = _ref8.fontWeight,
625
+ fontWeight = _ref8$fontWeight === void 0 ? '400' : _ref8$fontWeight,
626
+ _ref8$fontFamily = _ref8.fontFamily,
627
+ fontFamily = _ref8$fontFamily === void 0 ? 'sans-serif' : _ref8$fontFamily; // 更新文字布局
628
+
629
+
630
+ return this.fontService.getCanvasByKey("".concat(fontFamily, "_").concat(fontWeight));
631
+ }
611
632
  /**
612
633
  * 文字避让 depend on originCentorid
613
634
  */
@@ -617,11 +638,11 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
617
638
  value: function filterGlyphs() {
618
639
  var _this3 = this;
619
640
 
620
- var _ref7 = this.layer.getLayerConfig(),
621
- _ref7$padding = _ref7.padding,
622
- padding = _ref7$padding === void 0 ? [0, 0] : _ref7$padding,
623
- _ref7$textAllowOverla = _ref7.textAllowOverlap,
624
- textAllowOverlap = _ref7$textAllowOverla === void 0 ? false : _ref7$textAllowOverla;
641
+ var _ref9 = this.layer.getLayerConfig(),
642
+ _ref9$padding = _ref9.padding,
643
+ padding = _ref9$padding === void 0 ? [0, 0] : _ref9$padding,
644
+ _ref9$textAllowOverla = _ref9.textAllowOverlap,
645
+ textAllowOverlap = _ref9$textAllowOverla === void 0 ? false : _ref9$textAllowOverla;
625
646
 
626
647
  if (textAllowOverlap) {
627
648
  // 如果允许文本覆盖
@@ -695,7 +716,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
695
716
  key: "updateTexture",
696
717
  value: function updateTexture() {
697
718
  var createTexture2D = this.rendererService.createTexture2D;
698
- var canvas = this.fontService.canvas;
719
+ var canvas = this.getFontServiceCanvas();
699
720
  this.textureHeight = canvas.height;
700
721
 
701
722
  if (this.texture) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.2.9",
30
- "@antv/l7-core": "2.15.0",
31
- "@antv/l7-maps": "2.15.0",
32
- "@antv/l7-source": "2.15.0",
33
- "@antv/l7-utils": "2.15.0",
30
+ "@antv/l7-core": "2.15.2",
31
+ "@antv/l7-maps": "2.15.2",
32
+ "@antv/l7-source": "2.15.2",
33
+ "@antv/l7-utils": "2.15.2",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -53,7 +53,7 @@
53
53
  "reflect-metadata": "^0.1.13"
54
54
  },
55
55
  "devDependencies": {
56
- "@antv/l7-test-utils": "2.15.0",
56
+ "@antv/l7-test-utils": "2.15.2",
57
57
  "@types/d3-array": "^2.0.0",
58
58
  "@types/d3-color": "^1.2.2",
59
59
  "@types/d3-interpolate": "1.1.6",
@@ -62,7 +62,7 @@
62
62
  "@types/gl-matrix": "^2.4.5",
63
63
  "@types/lodash": "^4.14.138"
64
64
  },
65
- "gitHead": "cc53366f3fc0867f2d4ca9b4b321b8792f8bb126",
65
+ "gitHead": "89b84277323240e51f75d4e486072b8bb17b0c93",
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }