@antv/l7-layers 2.13.4 → 2.13.6
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/core/BaseLayer.d.ts +3 -1
- package/es/core/BaseLayer.js +31 -6
- package/es/line/models/line.d.ts +1 -0
- package/es/line/models/line.js +11 -5
- package/es/plugins/DataMappingPlugin.js +6 -3
- package/es/plugins/DataSourcePlugin.js +14 -9
- package/es/plugins/FeatureScalePlugin.js +8 -4
- package/es/plugins/LayerModelPlugin.d.ts +1 -0
- package/es/plugins/LayerModelPlugin.js +64 -38
- package/es/point/models/fill.js +3 -8
- package/es/point/models/fillmage.js +5 -9
- package/es/point/models/image.js +6 -9
- package/es/point/models/text.d.ts +1 -0
- package/es/point/models/text.js +88 -71
- package/es/tile/service/TilePickService.d.ts +2 -2
- package/es/tile/tileFactory/Tile.d.ts +1 -0
- package/es/tile/tileFactory/VectorTile.js +5 -4
- package/lib/core/BaseLayer.js +30 -5
- package/lib/line/models/line.js +10 -5
- package/lib/plugins/DataMappingPlugin.js +5 -2
- package/lib/plugins/DataSourcePlugin.js +13 -8
- package/lib/plugins/FeatureScalePlugin.js +7 -3
- package/lib/plugins/LayerModelPlugin.js +65 -38
- package/lib/point/models/fill.js +2 -6
- package/lib/point/models/fillmage.js +6 -10
- package/lib/point/models/image.js +6 -9
- package/lib/point/models/text.js +87 -70
- package/lib/tile/tileFactory/VectorTile.js +6 -5
- package/package.json +6 -6
|
@@ -15,6 +15,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
15
15
|
|
|
16
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
17
|
|
|
18
|
+
var _l7Core = require("@antv/l7-core");
|
|
19
|
+
|
|
18
20
|
var _inversify = require("inversify");
|
|
19
21
|
|
|
20
22
|
require("reflect-metadata");
|
|
@@ -33,9 +35,9 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
(0, _createClass2.default)(LayerModelPlugin, [{
|
|
36
|
-
key: "
|
|
38
|
+
key: "build",
|
|
37
39
|
value: function () {
|
|
38
|
-
var
|
|
40
|
+
var _build = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer) {
|
|
39
41
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
40
42
|
while (1) {
|
|
41
43
|
switch (_context.prev = _context.next) {
|
|
@@ -47,9 +49,6 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
47
49
|
return layer.buildModels();
|
|
48
50
|
|
|
49
51
|
case 3:
|
|
50
|
-
layer.styleNeedUpdate = false;
|
|
51
|
-
|
|
52
|
-
case 4:
|
|
53
52
|
case "end":
|
|
54
53
|
return _context.stop();
|
|
55
54
|
}
|
|
@@ -57,36 +56,60 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
57
56
|
}, _callee);
|
|
58
57
|
}));
|
|
59
58
|
|
|
60
|
-
function
|
|
61
|
-
return
|
|
59
|
+
function build(_x) {
|
|
60
|
+
return _build.apply(this, arguments);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
return
|
|
63
|
+
return build;
|
|
65
64
|
}()
|
|
66
65
|
}, {
|
|
67
|
-
key: "
|
|
66
|
+
key: "initLayerModel",
|
|
68
67
|
value: function () {
|
|
69
|
-
var
|
|
68
|
+
var _initLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layer) {
|
|
70
69
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
71
70
|
while (1) {
|
|
72
71
|
switch (_context2.prev = _context2.next) {
|
|
73
72
|
case 0:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// 初始化 Model
|
|
73
|
+
_context2.next = 2;
|
|
74
|
+
return this.build(layer);
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
case 2:
|
|
77
|
+
layer.styleNeedUpdate = false;
|
|
80
78
|
|
|
81
79
|
case 3:
|
|
82
80
|
case "end":
|
|
83
81
|
return _context2.stop();
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
|
-
}, _callee2);
|
|
84
|
+
}, _callee2, this);
|
|
87
85
|
}));
|
|
88
86
|
|
|
89
|
-
function
|
|
87
|
+
function initLayerModel(_x2) {
|
|
88
|
+
return _initLayerModel.apply(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return initLayerModel;
|
|
92
|
+
}()
|
|
93
|
+
}, {
|
|
94
|
+
key: "prepareLayerModel",
|
|
95
|
+
value: function () {
|
|
96
|
+
var _prepareLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(layer) {
|
|
97
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
98
|
+
while (1) {
|
|
99
|
+
switch (_context3.prev = _context3.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
_context3.next = 2;
|
|
102
|
+
return this.build(layer);
|
|
103
|
+
|
|
104
|
+
case 2:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context3.stop();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, _callee3, this);
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
function prepareLayerModel(_x3) {
|
|
90
113
|
return _prepareLayerModel.apply(this, arguments);
|
|
91
114
|
}
|
|
92
115
|
|
|
@@ -97,69 +120,73 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
97
120
|
value: function apply(layer) {
|
|
98
121
|
var _this = this;
|
|
99
122
|
|
|
100
|
-
layer.hooks.init.tapPromise('LayerModelPlugin', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
101
|
-
return _regenerator.default.wrap(function
|
|
123
|
+
layer.hooks.init.tapPromise('LayerModelPlugin', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
124
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
102
125
|
while (1) {
|
|
103
|
-
switch (
|
|
126
|
+
switch (_context4.prev = _context4.next) {
|
|
104
127
|
case 0:
|
|
105
128
|
if (!layer.getSource().isTile) {
|
|
106
|
-
|
|
129
|
+
_context4.next = 4;
|
|
107
130
|
break;
|
|
108
131
|
}
|
|
109
132
|
|
|
110
133
|
layer.prepareBuildModel();
|
|
111
134
|
layer.tileLayer = new _BaseLayer.default(layer);
|
|
112
|
-
return
|
|
135
|
+
return _context4.abrupt("return");
|
|
113
136
|
|
|
114
137
|
case 4:
|
|
115
|
-
|
|
138
|
+
layer.log(_l7Core.IDebugLog.BuildModelStart);
|
|
139
|
+
_context4.next = 7;
|
|
116
140
|
return _this.initLayerModel(layer);
|
|
117
141
|
|
|
118
|
-
case
|
|
142
|
+
case 7:
|
|
143
|
+
layer.log(_l7Core.IDebugLog.BuildModelEnd);
|
|
144
|
+
|
|
145
|
+
case 8:
|
|
119
146
|
case "end":
|
|
120
|
-
return
|
|
147
|
+
return _context4.stop();
|
|
121
148
|
}
|
|
122
149
|
}
|
|
123
|
-
},
|
|
150
|
+
}, _callee4);
|
|
124
151
|
})));
|
|
125
152
|
layer.hooks.beforeRenderData.tapPromise('LayerModelPlugin', /*#__PURE__*/function () {
|
|
126
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
127
|
-
return _regenerator.default.wrap(function
|
|
153
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(flag) {
|
|
154
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
128
155
|
while (1) {
|
|
129
|
-
switch (
|
|
156
|
+
switch (_context5.prev = _context5.next) {
|
|
130
157
|
case 0:
|
|
131
158
|
if (flag) {
|
|
132
|
-
|
|
159
|
+
_context5.next = 2;
|
|
133
160
|
break;
|
|
134
161
|
}
|
|
135
162
|
|
|
136
|
-
return
|
|
163
|
+
return _context5.abrupt("return", false);
|
|
137
164
|
|
|
138
165
|
case 2:
|
|
139
166
|
if (!layer.getSource().isTile) {
|
|
140
|
-
|
|
167
|
+
_context5.next = 5;
|
|
141
168
|
break;
|
|
142
169
|
}
|
|
143
170
|
|
|
144
171
|
layer.tileLayer = new _BaseLayer.default(layer);
|
|
145
|
-
return
|
|
172
|
+
return _context5.abrupt("return", false);
|
|
146
173
|
|
|
147
174
|
case 5:
|
|
148
|
-
|
|
175
|
+
_context5.next = 7;
|
|
149
176
|
return _this.prepareLayerModel(layer);
|
|
150
177
|
|
|
151
178
|
case 7:
|
|
152
|
-
return
|
|
179
|
+
return _context5.abrupt("return", true);
|
|
153
180
|
|
|
154
181
|
case 8:
|
|
155
182
|
case "end":
|
|
156
|
-
return
|
|
183
|
+
return _context5.stop();
|
|
157
184
|
}
|
|
158
185
|
}
|
|
159
|
-
},
|
|
186
|
+
}, _callee5);
|
|
160
187
|
}));
|
|
161
188
|
|
|
162
|
-
return function (
|
|
189
|
+
return function (_x4) {
|
|
163
190
|
return _ref2.apply(this, arguments);
|
|
164
191
|
};
|
|
165
192
|
}());
|
package/lib/point/models/fill.js
CHANGED
|
@@ -163,13 +163,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
163
163
|
while (1) {
|
|
164
164
|
switch (_context.prev = _context.next) {
|
|
165
165
|
case 0:
|
|
166
|
-
_context.
|
|
167
|
-
return this.buildModels();
|
|
166
|
+
return _context.abrupt("return", this.buildModels());
|
|
168
167
|
|
|
169
|
-
case
|
|
170
|
-
return _context.abrupt("return", _context.sent);
|
|
171
|
-
|
|
172
|
-
case 3:
|
|
168
|
+
case 1:
|
|
173
169
|
case "end":
|
|
174
170
|
return _context.stop();
|
|
175
171
|
}
|
|
@@ -33,10 +33,10 @@ var _lodash = require("lodash");
|
|
|
33
33
|
|
|
34
34
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
35
35
|
|
|
36
|
-
var _triangulation = require("../../core/triangulation");
|
|
37
|
-
|
|
38
36
|
var _interface = require("../../core/interface");
|
|
39
37
|
|
|
38
|
+
var _triangulation = require("../../core/triangulation");
|
|
39
|
+
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
41
|
|
|
42
42
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -198,13 +198,9 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
198
198
|
case 0:
|
|
199
199
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
200
200
|
this.updateTexture();
|
|
201
|
-
_context.
|
|
202
|
-
return this.buildModels();
|
|
201
|
+
return _context.abrupt("return", this.buildModels());
|
|
203
202
|
|
|
204
|
-
case
|
|
205
|
-
return _context.abrupt("return", _context.sent);
|
|
206
|
-
|
|
207
|
-
case 5:
|
|
203
|
+
case 3:
|
|
208
204
|
case "end":
|
|
209
205
|
return _context.stop();
|
|
210
206
|
}
|
|
@@ -315,8 +311,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
315
311
|
var shape = feature.shape;
|
|
316
312
|
|
|
317
313
|
var _ref3 = iconMap[shape] || {
|
|
318
|
-
x:
|
|
319
|
-
y:
|
|
314
|
+
x: -64,
|
|
315
|
+
y: -64
|
|
320
316
|
},
|
|
321
317
|
x = _ref3.x,
|
|
322
318
|
y = _ref3.y;
|
|
@@ -166,13 +166,9 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
166
166
|
case 0:
|
|
167
167
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
168
168
|
this.updateTexture();
|
|
169
|
-
_context.
|
|
170
|
-
return this.buildModels();
|
|
169
|
+
return _context.abrupt("return", this.buildModels());
|
|
171
170
|
|
|
172
|
-
case
|
|
173
|
-
return _context.abrupt("return", _context.sent);
|
|
174
|
-
|
|
175
|
-
case 5:
|
|
171
|
+
case 3:
|
|
176
172
|
case "end":
|
|
177
173
|
return _context.stop();
|
|
178
174
|
}
|
|
@@ -282,11 +278,12 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
282
278
|
var shape = feature.shape;
|
|
283
279
|
|
|
284
280
|
var _ref3 = iconMap[shape] || {
|
|
285
|
-
x:
|
|
286
|
-
y:
|
|
281
|
+
x: -64,
|
|
282
|
+
y: -64
|
|
287
283
|
},
|
|
288
284
|
x = _ref3.x,
|
|
289
|
-
y = _ref3.y;
|
|
285
|
+
y = _ref3.y; // 非画布区域,默认的图标改为透明
|
|
286
|
+
|
|
290
287
|
|
|
291
288
|
return [x, y];
|
|
292
289
|
}
|
package/lib/point/models/text.js
CHANGED
|
@@ -140,11 +140,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
140
140
|
stroke = _ref2$stroke === void 0 ? '#fff' : _ref2$stroke,
|
|
141
141
|
_ref2$strokeWidth = _ref2.strokeWidth,
|
|
142
142
|
strokeWidth = _ref2$strokeWidth === void 0 ? 0 : _ref2$strokeWidth,
|
|
143
|
-
_ref2$textAnchor = _ref2.textAnchor,
|
|
144
|
-
textAnchor = _ref2$textAnchor === void 0 ? 'center' : _ref2$textAnchor,
|
|
145
|
-
textOffset = _ref2.textOffset,
|
|
146
|
-
_ref2$textAllowOverla = _ref2.textAllowOverlap,
|
|
147
|
-
textAllowOverlap = _ref2$textAllowOverla === void 0 ? false : _ref2$textAllowOverla,
|
|
148
143
|
_ref2$halo = _ref2.halo,
|
|
149
144
|
halo = _ref2$halo === void 0 ? 0.5 : _ref2$halo,
|
|
150
145
|
_ref2$gamma = _ref2.gamma,
|
|
@@ -161,11 +156,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
161
156
|
this.textCount = Object.keys(mapping).length;
|
|
162
157
|
}
|
|
163
158
|
|
|
164
|
-
this.preTextStyle =
|
|
165
|
-
textAnchor: textAnchor,
|
|
166
|
-
textAllowOverlap: textAllowOverlap,
|
|
167
|
-
textOffset: textOffset
|
|
168
|
-
};
|
|
159
|
+
this.preTextStyle = this.getTextStyle();
|
|
169
160
|
|
|
170
161
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
171
162
|
opacity: opacity,
|
|
@@ -221,8 +212,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
221
212
|
key: "initModels",
|
|
222
213
|
value: function () {
|
|
223
214
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
224
|
-
var _ref3, _ref3$textAnchor, textAnchor, _ref3$textAllowOverla, textAllowOverlap, textOffset;
|
|
225
|
-
|
|
226
215
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
227
216
|
while (1) {
|
|
228
217
|
switch (_context2.prev = _context2.next) {
|
|
@@ -230,19 +219,10 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
230
219
|
// 绑定事件
|
|
231
220
|
this.bindEvent();
|
|
232
221
|
this.extent = this.textExtent();
|
|
233
|
-
|
|
234
|
-
this.
|
|
235
|
-
textAnchor: textAnchor,
|
|
236
|
-
textAllowOverlap: textAllowOverlap,
|
|
237
|
-
textOffset: textOffset
|
|
238
|
-
};
|
|
239
|
-
_context2.next = 6;
|
|
240
|
-
return this.buildModels();
|
|
241
|
-
|
|
242
|
-
case 6:
|
|
243
|
-
return _context2.abrupt("return", _context2.sent);
|
|
222
|
+
this.preTextStyle = this.getTextStyle();
|
|
223
|
+
return _context2.abrupt("return", this.buildModels());
|
|
244
224
|
|
|
245
|
-
case
|
|
225
|
+
case 4:
|
|
246
226
|
case "end":
|
|
247
227
|
return _context2.stop();
|
|
248
228
|
}
|
|
@@ -260,13 +240,13 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
260
240
|
key: "buildModels",
|
|
261
241
|
value: function () {
|
|
262
242
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
263
|
-
var
|
|
243
|
+
var _ref3, _ref3$mask, mask, _ref3$maskInside, maskInside, _ref3$textAllowOverla, textAllowOverlap, model;
|
|
264
244
|
|
|
265
245
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
266
246
|
while (1) {
|
|
267
247
|
switch (_context3.prev = _context3.next) {
|
|
268
248
|
case 0:
|
|
269
|
-
|
|
249
|
+
_ref3 = this.layer.getLayerConfig(), _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? false : _ref3$mask, _ref3$maskInside = _ref3.maskInside, maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside, _ref3$textAllowOverla = _ref3.textAllowOverlap, textAllowOverlap = _ref3$textAllowOverla === void 0 ? false : _ref3$textAllowOverla; // this.mapping(); 重复调用
|
|
270
250
|
|
|
271
251
|
this.initGlyph(); //
|
|
272
252
|
|
|
@@ -306,60 +286,65 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
306
286
|
}
|
|
307
287
|
|
|
308
288
|
return buildModels;
|
|
309
|
-
}()
|
|
289
|
+
}() // 需要更新的场景
|
|
290
|
+
// 1. 文本偏移量发生改变
|
|
291
|
+
// 2. 文本锚点发生改变
|
|
292
|
+
// 3. 文本允许重叠发生改变
|
|
293
|
+
// 4. 文本字体发生改变
|
|
294
|
+
// 5. 文本字体粗细发生改变
|
|
295
|
+
|
|
310
296
|
}, {
|
|
311
297
|
key: "needUpdate",
|
|
312
298
|
value: function () {
|
|
313
299
|
var _needUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
314
|
-
var
|
|
300
|
+
var _ref4, _ref4$textAllowOverla, textAllowOverlap, _ref4$textAnchor, textAnchor, textOffset, padding, fontFamily, fontWeight, zoom, extent, flag;
|
|
315
301
|
|
|
316
302
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
317
303
|
while (1) {
|
|
318
304
|
switch (_context4.prev = _context4.next) {
|
|
319
305
|
case 0:
|
|
320
|
-
|
|
321
|
-
data = this.layer.getEncodedData();
|
|
306
|
+
_ref4 = this.getTextStyle(), _ref4$textAllowOverla = _ref4.textAllowOverlap, textAllowOverlap = _ref4$textAllowOverla === void 0 ? false : _ref4$textAllowOverla, _ref4$textAnchor = _ref4.textAnchor, textAnchor = _ref4$textAnchor === void 0 ? 'center' : _ref4$textAnchor, textOffset = _ref4.textOffset, padding = _ref4.padding, fontFamily = _ref4.fontFamily, fontWeight = _ref4.fontWeight;
|
|
322
307
|
|
|
323
|
-
if (!(
|
|
324
|
-
_context4.next =
|
|
308
|
+
if (!(!(0, _lodash.isEqual)(padding, this.preTextStyle.padding) || !(0, _lodash.isEqual)(textOffset, this.preTextStyle.textOffset) || !(0, _lodash.isEqual)(textAnchor, this.preTextStyle.textAnchor) || !(0, _lodash.isEqual)(fontFamily, this.preTextStyle.fontFamily) || !(0, _lodash.isEqual)(fontWeight, this.preTextStyle.fontWeight))) {
|
|
309
|
+
_context4.next = 5;
|
|
325
310
|
break;
|
|
326
311
|
}
|
|
327
312
|
|
|
328
|
-
_context4.next =
|
|
313
|
+
_context4.next = 4;
|
|
329
314
|
return this.mapping();
|
|
330
315
|
|
|
331
|
-
case
|
|
316
|
+
case 4:
|
|
332
317
|
return _context4.abrupt("return", true);
|
|
333
318
|
|
|
334
|
-
case
|
|
335
|
-
if (!
|
|
336
|
-
_context4.next =
|
|
319
|
+
case 5:
|
|
320
|
+
if (!textAllowOverlap) {
|
|
321
|
+
_context4.next = 7;
|
|
337
322
|
break;
|
|
338
323
|
}
|
|
339
324
|
|
|
340
325
|
return _context4.abrupt("return", false);
|
|
341
326
|
|
|
342
|
-
case
|
|
327
|
+
case 7:
|
|
343
328
|
// textAllowOverlap 发生改变
|
|
344
329
|
zoom = this.mapService.getZoom();
|
|
345
330
|
extent = this.mapService.getBounds();
|
|
346
331
|
flag = (0, _l7Utils.boundsContains)(this.extent, extent); // 文本不能压盖则进行过滤
|
|
347
332
|
|
|
348
|
-
if (!(Math.abs(this.currentZoom - zoom) >
|
|
349
|
-
_context4.next =
|
|
333
|
+
if (!(Math.abs(this.currentZoom - zoom) > 0.5 || !flag || textAllowOverlap !== this.preTextStyle.textAllowOverlap)) {
|
|
334
|
+
_context4.next = 14;
|
|
350
335
|
break;
|
|
351
336
|
}
|
|
352
337
|
|
|
353
|
-
_context4.next =
|
|
338
|
+
_context4.next = 13;
|
|
354
339
|
return this.reBuildModel();
|
|
355
340
|
|
|
356
|
-
case
|
|
341
|
+
case 13:
|
|
357
342
|
return _context4.abrupt("return", true);
|
|
358
343
|
|
|
359
|
-
case
|
|
344
|
+
case 14:
|
|
360
345
|
return _context4.abrupt("return", false);
|
|
361
346
|
|
|
362
|
-
case
|
|
347
|
+
case 15:
|
|
363
348
|
case "end":
|
|
364
349
|
return _context4.stop();
|
|
365
350
|
}
|
|
@@ -479,11 +464,9 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
479
464
|
}, {
|
|
480
465
|
key: "initTextFont",
|
|
481
466
|
value: function initTextFont() {
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
_ref6$fontFamily = _ref6.fontFamily,
|
|
486
|
-
fontFamily = _ref6$fontFamily === void 0 ? 'sans-serif' : _ref6$fontFamily;
|
|
467
|
+
var _this$getTextStyle = this.getTextStyle(),
|
|
468
|
+
fontWeight = _this$getTextStyle.fontWeight,
|
|
469
|
+
fontFamily = _this$getTextStyle.fontFamily;
|
|
487
470
|
|
|
488
471
|
var data = this.layer.getEncodedData();
|
|
489
472
|
var characterSet = [];
|
|
@@ -524,11 +507,9 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
524
507
|
}, {
|
|
525
508
|
key: "initIconFontTex",
|
|
526
509
|
value: function initIconFontTex() {
|
|
527
|
-
var
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
_ref7$fontFamily = _ref7.fontFamily,
|
|
531
|
-
fontFamily = _ref7$fontFamily === void 0 ? 'sans-serif' : _ref7$fontFamily;
|
|
510
|
+
var _this$getTextStyle2 = this.getTextStyle(),
|
|
511
|
+
fontWeight = _this$getTextStyle2.fontWeight,
|
|
512
|
+
fontFamily = _this$getTextStyle2.fontFamily;
|
|
532
513
|
|
|
533
514
|
var data = this.layer.getEncodedData();
|
|
534
515
|
var characterSet = [];
|
|
@@ -548,6 +529,44 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
548
529
|
iconfont: true
|
|
549
530
|
});
|
|
550
531
|
}
|
|
532
|
+
}, {
|
|
533
|
+
key: "getTextStyle",
|
|
534
|
+
value: function getTextStyle() {
|
|
535
|
+
var _ref5 = this.layer.getLayerConfig(),
|
|
536
|
+
_ref5$fontWeight = _ref5.fontWeight,
|
|
537
|
+
fontWeight = _ref5$fontWeight === void 0 ? '400' : _ref5$fontWeight,
|
|
538
|
+
_ref5$fontFamily = _ref5.fontFamily,
|
|
539
|
+
fontFamily = _ref5$fontFamily === void 0 ? 'sans-serif' : _ref5$fontFamily,
|
|
540
|
+
_ref5$textAllowOverla = _ref5.textAllowOverlap,
|
|
541
|
+
textAllowOverlap = _ref5$textAllowOverla === void 0 ? false : _ref5$textAllowOverla,
|
|
542
|
+
_ref5$padding = _ref5.padding,
|
|
543
|
+
padding = _ref5$padding === void 0 ? [0, 0] : _ref5$padding,
|
|
544
|
+
_ref5$textAnchor = _ref5.textAnchor,
|
|
545
|
+
textAnchor = _ref5$textAnchor === void 0 ? 'center' : _ref5$textAnchor,
|
|
546
|
+
_ref5$textOffset = _ref5.textOffset,
|
|
547
|
+
textOffset = _ref5$textOffset === void 0 ? [0, 0] : _ref5$textOffset,
|
|
548
|
+
_ref5$opacity = _ref5.opacity,
|
|
549
|
+
opacity = _ref5$opacity === void 0 ? 1 : _ref5$opacity,
|
|
550
|
+
_ref5$strokeOpacity = _ref5.strokeOpacity,
|
|
551
|
+
strokeOpacity = _ref5$strokeOpacity === void 0 ? 1 : _ref5$strokeOpacity,
|
|
552
|
+
_ref5$strokeWidth = _ref5.strokeWidth,
|
|
553
|
+
strokeWidth = _ref5$strokeWidth === void 0 ? 0 : _ref5$strokeWidth,
|
|
554
|
+
_ref5$stroke = _ref5.stroke,
|
|
555
|
+
stroke = _ref5$stroke === void 0 ? '#000' : _ref5$stroke;
|
|
556
|
+
|
|
557
|
+
return {
|
|
558
|
+
fontWeight: fontWeight,
|
|
559
|
+
fontFamily: fontFamily,
|
|
560
|
+
textAllowOverlap: textAllowOverlap,
|
|
561
|
+
padding: padding,
|
|
562
|
+
textAnchor: textAnchor,
|
|
563
|
+
textOffset: textOffset,
|
|
564
|
+
opacity: opacity,
|
|
565
|
+
strokeOpacity: strokeOpacity,
|
|
566
|
+
strokeWidth: strokeWidth,
|
|
567
|
+
stroke: stroke
|
|
568
|
+
};
|
|
569
|
+
}
|
|
551
570
|
/**
|
|
552
571
|
* 生成文字布局(对照文字纹理字典提取对应文字的位置很好信息)
|
|
553
572
|
*/
|
|
@@ -560,12 +579,12 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
560
579
|
// 更新文字布局
|
|
561
580
|
var mapping = this.fontService.mapping;
|
|
562
581
|
|
|
563
|
-
var
|
|
564
|
-
|
|
565
|
-
spacing =
|
|
566
|
-
|
|
567
|
-
textAnchor =
|
|
568
|
-
textOffset =
|
|
582
|
+
var _ref6 = this.layer.getLayerConfig(),
|
|
583
|
+
_ref6$spacing = _ref6.spacing,
|
|
584
|
+
spacing = _ref6$spacing === void 0 ? 2 : _ref6$spacing,
|
|
585
|
+
_ref6$textAnchor = _ref6.textAnchor,
|
|
586
|
+
textAnchor = _ref6$textAnchor === void 0 ? 'center' : _ref6$textAnchor,
|
|
587
|
+
textOffset = _ref6.textOffset;
|
|
569
588
|
|
|
570
589
|
var data = this.layer.getEncodedData();
|
|
571
590
|
this.glyphInfo = data.map(function (feature) {
|
|
@@ -600,15 +619,14 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
600
619
|
value: function filterGlyphs() {
|
|
601
620
|
var _this3 = this;
|
|
602
621
|
|
|
603
|
-
var
|
|
604
|
-
|
|
605
|
-
padding =
|
|
606
|
-
|
|
607
|
-
textAllowOverlap =
|
|
622
|
+
var _ref7 = this.layer.getLayerConfig(),
|
|
623
|
+
_ref7$padding = _ref7.padding,
|
|
624
|
+
padding = _ref7$padding === void 0 ? [0, 0] : _ref7$padding,
|
|
625
|
+
_ref7$textAllowOverla = _ref7.textAllowOverlap,
|
|
626
|
+
textAllowOverlap = _ref7$textAllowOverla === void 0 ? false : _ref7$textAllowOverla;
|
|
608
627
|
|
|
609
628
|
if (textAllowOverlap) {
|
|
610
629
|
// 如果允许文本覆盖
|
|
611
|
-
// this.layer.setEncodedData(this.glyphInfo);
|
|
612
630
|
return;
|
|
613
631
|
}
|
|
614
632
|
|
|
@@ -667,8 +685,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
667
685
|
iconfont = _this$layer$getLayerC2 === void 0 ? false : _this$layer$getLayerC2; // 1.生成文字纹理(或是生成 iconfont)
|
|
668
686
|
|
|
669
687
|
|
|
670
|
-
iconfont ? this.initIconFontTex() : this.initTextFont(); //
|
|
671
|
-
// 2.生成文字布局
|
|
688
|
+
iconfont ? this.initIconFontTex() : this.initTextFont(); // 2.生成文字布局
|
|
672
689
|
|
|
673
690
|
this.generateGlyphLayout(iconfont);
|
|
674
691
|
}
|
|
@@ -699,13 +716,13 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
699
716
|
key: "reBuildModel",
|
|
700
717
|
value: function () {
|
|
701
718
|
var _reBuildModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
702
|
-
var
|
|
719
|
+
var _ref8, _ref8$mask, mask, _ref8$maskInside, maskInside, model;
|
|
703
720
|
|
|
704
721
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
705
722
|
while (1) {
|
|
706
723
|
switch (_context5.prev = _context5.next) {
|
|
707
724
|
case 0:
|
|
708
|
-
|
|
725
|
+
_ref8 = this.layer.getLayerConfig(), _ref8$mask = _ref8.mask, mask = _ref8$mask === void 0 ? false : _ref8$mask, _ref8$maskInside = _ref8.maskInside, maskInside = _ref8$maskInside === void 0 ? true : _ref8$maskInside;
|
|
709
726
|
this.filterGlyphs();
|
|
710
727
|
_context5.next = 4;
|
|
711
728
|
return this.layer.buildLayerModel({
|
|
@@ -23,12 +23,12 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
23
23
|
|
|
24
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
25
|
|
|
26
|
+
var _mask = _interopRequireDefault(require("../../mask"));
|
|
27
|
+
|
|
26
28
|
var _Tile2 = _interopRequireDefault(require("./Tile"));
|
|
27
29
|
|
|
28
30
|
var _util = require("./util");
|
|
29
31
|
|
|
30
|
-
var _mask = _interopRequireDefault(require("../../mask"));
|
|
31
|
-
|
|
32
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
33
33
|
|
|
34
34
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -117,7 +117,7 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
|
|
|
117
117
|
switch (_context2.prev = _context2.next) {
|
|
118
118
|
case 0:
|
|
119
119
|
mask = new _mask.default({
|
|
120
|
-
layerType:
|
|
120
|
+
layerType: 'MaskLayer'
|
|
121
121
|
}).source({
|
|
122
122
|
type: 'FeatureCollection',
|
|
123
123
|
features: [this.sourceTile.bboxPolygon]
|
|
@@ -190,8 +190,8 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
|
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
192
|
* 在一个 Tile 中可能存在一个相同 ID 的 feature
|
|
193
|
-
* @param id
|
|
194
|
-
* @returns
|
|
193
|
+
* @param id
|
|
194
|
+
* @returns
|
|
195
195
|
*/
|
|
196
196
|
|
|
197
197
|
}, {
|
|
@@ -203,6 +203,7 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
|
|
|
203
203
|
return [];
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
console.log(layer.getSource().data.dataArray, id);
|
|
206
207
|
var res = layer.getSource().data.dataArray.filter(function (d) {
|
|
207
208
|
return d._id === id;
|
|
208
209
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.6",
|
|
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.13.
|
|
31
|
-
"@antv/l7-maps": "2.13.
|
|
32
|
-
"@antv/l7-source": "2.13.
|
|
33
|
-
"@antv/l7-utils": "2.13.
|
|
30
|
+
"@antv/l7-core": "2.13.6",
|
|
31
|
+
"@antv/l7-maps": "2.13.6",
|
|
32
|
+
"@antv/l7-source": "2.13.6",
|
|
33
|
+
"@antv/l7-utils": "2.13.6",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/gl-matrix": "^2.4.5",
|
|
62
62
|
"@types/lodash": "^4.14.138"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "dc11ec312f2078704e548ba540d3289e1f752441",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|