@antv/l7-scene 2.16.1 → 2.16.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.
package/es/boxSelect.js CHANGED
@@ -5,61 +5,41 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  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; } }
12
-
13
10
  import { DOM, getBBoxFromPoints } from '@antv/l7-utils';
14
11
  import { EventEmitter } from 'eventemitter3';
15
12
  export var BoxSelectEventList = ['selectstart', 'selecting', 'selectend'];
16
-
17
13
  // TODO: 将 BoxSelect 模块放在哪里比较合适
18
14
  var BoxSelect = /*#__PURE__*/function (_EventEmitter) {
19
15
  _inherits(BoxSelect, _EventEmitter);
20
-
21
16
  var _super = _createSuper(BoxSelect);
22
-
23
17
  function BoxSelect(scene) {
24
18
  var _this;
25
-
26
19
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
-
28
20
  _classCallCheck(this, BoxSelect);
29
-
30
21
  _this = _super.call(this);
31
-
32
22
  _defineProperty(_assertThisInitialized(_this), "isEnable", false);
33
-
34
23
  _defineProperty(_assertThisInitialized(_this), "onDragStart", function (e) {
35
24
  _this.box.style.display = 'block';
36
25
  _this.startEvent = _this.endEvent = e;
37
-
38
26
  _this.syncBoxBound();
39
-
40
27
  _this.emit('selectstart', _this.getLngLatBox(), _this.startEvent, _this.endEvent);
41
28
  });
42
-
43
29
  _defineProperty(_assertThisInitialized(_this), "onDragging", function (e) {
44
30
  _this.endEvent = e;
45
-
46
31
  _this.syncBoxBound();
47
-
48
32
  _this.emit('selecting', _this.getLngLatBox(), _this.startEvent, _this.endEvent);
49
33
  });
50
-
51
34
  _defineProperty(_assertThisInitialized(_this), "onDragEnd", function (e) {
52
35
  _this.endEvent = e;
53
36
  _this.box.style.display = 'none';
54
-
55
37
  _this.emit('selectend', _this.getLngLatBox(), _this.startEvent, _this.endEvent);
56
38
  });
57
-
58
39
  _this.scene = scene;
59
40
  _this.options = options;
60
41
  return _this;
61
42
  }
62
-
63
43
  _createClass(BoxSelect, [{
64
44
  key: "container",
65
45
  get: function get() {
@@ -71,25 +51,20 @@ var BoxSelect = /*#__PURE__*/function (_EventEmitter) {
71
51
  if (this.isEnable) {
72
52
  return;
73
53
  }
74
-
75
54
  var className = this.options.className;
76
55
  this.scene.setMapStatus({
77
56
  dragEnable: false
78
57
  });
79
58
  this.container.style.cursor = 'crosshair';
80
-
81
59
  if (!this.box) {
82
60
  var box = DOM.create('div', undefined, this.container);
83
61
  box.classList.add('l7-select-box');
84
-
85
62
  if (className) {
86
63
  box.classList.add(className);
87
64
  }
88
-
89
65
  box.style.display = 'none';
90
66
  this.box = box;
91
67
  }
92
-
93
68
  this.scene.on('dragstart', this.onDragStart);
94
69
  this.scene.on('dragging', this.onDragging);
95
70
  this.scene.on('dragend', this.onDragEnd);
@@ -101,7 +76,6 @@ var BoxSelect = /*#__PURE__*/function (_EventEmitter) {
101
76
  if (!this.isEnable) {
102
77
  return;
103
78
  }
104
-
105
79
  this.scene.setMapStatus({
106
80
  dragEnable: true
107
81
  });
@@ -115,11 +89,11 @@ var BoxSelect = /*#__PURE__*/function (_EventEmitter) {
115
89
  key: "syncBoxBound",
116
90
  value: function syncBoxBound() {
117
91
  var _this$startEvent = this.startEvent,
118
- x1 = _this$startEvent.x,
119
- y1 = _this$startEvent.y;
92
+ x1 = _this$startEvent.x,
93
+ y1 = _this$startEvent.y;
120
94
  var _this$endEvent = this.endEvent,
121
- x2 = _this$endEvent.x,
122
- y2 = _this$endEvent.y;
95
+ x2 = _this$endEvent.x,
96
+ y2 = _this$endEvent.y;
123
97
  var left = Math.min(x1, x2);
124
98
  var top = Math.min(y1, y2);
125
99
  var width = Math.abs(x1 - x2);
@@ -133,16 +107,14 @@ var BoxSelect = /*#__PURE__*/function (_EventEmitter) {
133
107
  key: "getLngLatBox",
134
108
  value: function getLngLatBox() {
135
109
  var _this$startEvent$lngL = this.startEvent.lngLat,
136
- lng1 = _this$startEvent$lngL.lng,
137
- lat1 = _this$startEvent$lngL.lat;
110
+ lng1 = _this$startEvent$lngL.lng,
111
+ lat1 = _this$startEvent$lngL.lat;
138
112
  var _this$endEvent$lngLat = this.endEvent.lngLat,
139
- lng2 = _this$endEvent$lngLat.lng,
140
- lat2 = _this$endEvent$lngLat.lat;
113
+ lng2 = _this$endEvent$lngLat.lng,
114
+ lat2 = _this$endEvent$lngLat.lat;
141
115
  return getBBoxFromPoints([[lng1, lat1], [lng2, lat2]]);
142
116
  }
143
117
  }]);
144
-
145
118
  return BoxSelect;
146
119
  }(EventEmitter);
147
-
148
120
  export { BoxSelect as default };
package/es/index.d.ts CHANGED
@@ -83,6 +83,7 @@ declare class Scene implements IPostProcessingPassPluggable, IMapController, ILa
83
83
  addMarkerLayer(layer: IMarkerLayer): void;
84
84
  removeMarkerLayer(layer: IMarkerLayer): void;
85
85
  removeAllMarkers(): void;
86
+ removeAllMakers(): void;
86
87
  addPopup(popup: IPopup): void;
87
88
  removePopup(popup: IPopup): void;
88
89
  on(type: string, handle: (...args: any[]) => void): void;
package/es/index.js CHANGED
@@ -10,7 +10,6 @@ import { MaskLayer } from '@antv/l7-layers';
10
10
  import { ReglRendererService } from '@antv/l7-renderer';
11
11
  import { DOM, isMini, setMiniScene } from '@antv/l7-utils';
12
12
  import BoxSelect, { BoxSelectEventList } from "./boxSelect";
13
-
14
13
  /**
15
14
  * 暴露 Scene API
16
15
  *
@@ -26,19 +25,20 @@ import BoxSelect, { BoxSelectEventList } from "./boxSelect";
26
25
  var Scene = /*#__PURE__*/function () {
27
26
  function Scene(config) {
28
27
  _classCallCheck(this, Scene);
29
-
30
28
  var id = config.id,
31
- map = config.map,
32
- canvas = config.canvas,
33
- hasBaseMap = config.hasBaseMap; // 创建场景容器
34
-
29
+ map = config.map,
30
+ canvas = config.canvas,
31
+ hasBaseMap = config.hasBaseMap;
32
+ // 创建场景容器
35
33
  var sceneContainer = createSceneContainer();
36
- this.container = sceneContainer; // 绑定地图服务
37
-
38
- map.setContainer(sceneContainer, id, canvas, hasBaseMap); // 绑定渲染引擎服务
34
+ this.container = sceneContainer;
35
+ // 绑定地图服务
36
+ map.setContainer(sceneContainer, id, canvas, hasBaseMap);
39
37
 
40
- sceneContainer.bind(TYPES.IRendererService).to(ReglRendererService).inSingletonScope(); // 依赖注入
38
+ // 绑定渲染引擎服务
39
+ sceneContainer.bind(TYPES.IRendererService).to(ReglRendererService).inSingletonScope();
41
40
 
41
+ // 依赖注入
42
42
  this.sceneService = sceneContainer.get(TYPES.ISceneService);
43
43
  this.mapService = sceneContainer.get(TYPES.IMapService);
44
44
  this.iconService = sceneContainer.get(TYPES.IIconService);
@@ -52,18 +52,18 @@ var Scene = /*#__PURE__*/function () {
52
52
  this.popupService = sceneContainer.get(TYPES.IPopupService);
53
53
  this.boxSelect = new BoxSelect(this, {});
54
54
  setMiniScene((config === null || config === void 0 ? void 0 : config.isMini) || false);
55
-
56
55
  if (isMini) {
57
56
  this.sceneService.initMiniScene(config);
58
57
  } else {
59
- this.initComponent(id); // 初始化 scene
58
+ this.initComponent(id);
60
59
 
61
- this.sceneService.init(config); // TODO: 初始化组件
60
+ // 初始化 scene
61
+ this.sceneService.init(config);
62
+ // TODO: 初始化组件
62
63
 
63
64
  this.initControl();
64
65
  }
65
66
  }
66
-
67
67
  _createClass(Scene, [{
68
68
  key: "map",
69
69
  get: function get() {
@@ -114,11 +114,11 @@ var Scene = /*#__PURE__*/function () {
114
114
  value: function getMapService() {
115
115
  return this.mapService;
116
116
  }
117
+
117
118
  /**
118
119
  * 对外暴露 debugService
119
120
  * @returns
120
121
  */
121
-
122
122
  }, {
123
123
  key: "getDebugService",
124
124
  value: function getDebugService() {
@@ -129,23 +129,18 @@ var Scene = /*#__PURE__*/function () {
129
129
  value: function () {
130
130
  var _exportPng = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(type) {
131
131
  return _regeneratorRuntime.wrap(function _callee$(_context) {
132
- while (1) {
133
- switch (_context.prev = _context.next) {
134
- case 0:
135
- return _context.abrupt("return", this.sceneService.exportPng(type));
136
-
137
- case 1:
138
- case "end":
139
- return _context.stop();
140
- }
132
+ while (1) switch (_context.prev = _context.next) {
133
+ case 0:
134
+ return _context.abrupt("return", this.sceneService.exportPng(type));
135
+ case 1:
136
+ case "end":
137
+ return _context.stop();
141
138
  }
142
139
  }, _callee, this);
143
140
  }));
144
-
145
141
  function exportPng(_x) {
146
142
  return _exportPng.apply(this, arguments);
147
143
  }
148
-
149
144
  return exportPng;
150
145
  }()
151
146
  }, {
@@ -153,30 +148,24 @@ var Scene = /*#__PURE__*/function () {
153
148
  value: function () {
154
149
  var _exportMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(type) {
155
150
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
156
- while (1) {
157
- switch (_context2.prev = _context2.next) {
158
- case 0:
159
- return _context2.abrupt("return", this.sceneService.exportPng(type));
160
-
161
- case 1:
162
- case "end":
163
- return _context2.stop();
164
- }
151
+ while (1) switch (_context2.prev = _context2.next) {
152
+ case 0:
153
+ return _context2.abrupt("return", this.sceneService.exportPng(type));
154
+ case 1:
155
+ case "end":
156
+ return _context2.stop();
165
157
  }
166
158
  }, _callee2, this);
167
159
  }));
168
-
169
160
  function exportMap(_x2) {
170
161
  return _exportMap.apply(this, arguments);
171
162
  }
172
-
173
163
  return exportMap;
174
164
  }()
175
165
  }, {
176
166
  key: "registerRenderService",
177
167
  value: function registerRenderService(render) {
178
168
  var _this = this;
179
-
180
169
  if (this.sceneService.loaded) {
181
170
  var renderSerivce = new render(this);
182
171
  renderSerivce.init();
@@ -191,27 +180,26 @@ var Scene = /*#__PURE__*/function () {
191
180
  key: "setBgColor",
192
181
  value: function setBgColor(color) {
193
182
  this.mapService.setBgColor(color);
194
- } // layer 管理
183
+ }
195
184
 
185
+ // layer 管理
196
186
  }, {
197
187
  key: "addLayer",
198
188
  value: function addLayer(layer) {
199
189
  var _this2 = this;
200
-
201
190
  // 为当前图层创建一个容器
202
191
  // TODO: 初始化的时候设置 容器
203
192
  var layerContainer = createLayerContainer(this.container);
204
193
  layer.setContainer(layerContainer, this.container);
205
- this.sceneService.addLayer(layer); // mask 在 scene loaded 之后执行
194
+ this.sceneService.addLayer(layer);
206
195
 
196
+ // mask 在 scene loaded 之后执行
207
197
  if (layer.inited) {
208
198
  var maskInstance = this.initMask(layer);
209
199
  this.addMask(maskInstance, layer.id);
210
200
  } else {
211
201
  layer.on('inited', function () {
212
202
  var maskInstance = _this2.initMask(layer); // 初始化 mask
213
-
214
-
215
203
  _this2.addMask(maskInstance, layer.id);
216
204
  });
217
205
  }
@@ -220,17 +208,15 @@ var Scene = /*#__PURE__*/function () {
220
208
  key: "initMask",
221
209
  value: function initMask(layer) {
222
210
  var _layer$getLayerConfig = layer.getLayerConfig(),
223
- mask = _layer$getLayerConfig.mask,
224
- maskfence = _layer$getLayerConfig.maskfence,
225
- _layer$getLayerConfig2 = _layer$getLayerConfig.maskColor,
226
- maskColor = _layer$getLayerConfig2 === void 0 ? '#000' : _layer$getLayerConfig2,
227
- _layer$getLayerConfig3 = _layer$getLayerConfig.maskOpacity,
228
- maskOpacity = _layer$getLayerConfig3 === void 0 ? 0 : _layer$getLayerConfig3;
229
-
211
+ mask = _layer$getLayerConfig.mask,
212
+ maskfence = _layer$getLayerConfig.maskfence,
213
+ _layer$getLayerConfig2 = _layer$getLayerConfig.maskColor,
214
+ maskColor = _layer$getLayerConfig2 === void 0 ? '#000' : _layer$getLayerConfig2,
215
+ _layer$getLayerConfig3 = _layer$getLayerConfig.maskOpacity,
216
+ maskOpacity = _layer$getLayerConfig3 === void 0 ? 0 : _layer$getLayerConfig3;
230
217
  if (!mask || !maskfence) {
231
218
  return undefined;
232
219
  }
233
-
234
220
  var maskInstance = new MaskLayer().source(maskfence).shape('fill').style({
235
221
  color: maskColor,
236
222
  opacity: maskOpacity
@@ -243,9 +229,7 @@ var Scene = /*#__PURE__*/function () {
243
229
  if (!mask) {
244
230
  return;
245
231
  }
246
-
247
232
  var parent = this.getLayer(layerId);
248
-
249
233
  if (parent) {
250
234
  var layerContainer = createLayerContainer(this.container);
251
235
  mask.setContainer(layerContainer, this.container);
@@ -280,24 +264,19 @@ var Scene = /*#__PURE__*/function () {
280
264
  value: function () {
281
265
  var _removeLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(layer, parentLayer) {
282
266
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
283
- while (1) {
284
- switch (_context3.prev = _context3.next) {
285
- case 0:
286
- _context3.next = 2;
287
- return this.layerService.remove(layer, parentLayer);
288
-
289
- case 2:
290
- case "end":
291
- return _context3.stop();
292
- }
267
+ while (1) switch (_context3.prev = _context3.next) {
268
+ case 0:
269
+ _context3.next = 2;
270
+ return this.layerService.remove(layer, parentLayer);
271
+ case 2:
272
+ case "end":
273
+ return _context3.stop();
293
274
  }
294
275
  }, _callee3, this);
295
276
  }));
296
-
297
277
  function removeLayer(_x3, _x4) {
298
278
  return _removeLayer.apply(this, arguments);
299
279
  }
300
-
301
280
  return removeLayer;
302
281
  }()
303
282
  }, {
@@ -305,24 +284,19 @@ var Scene = /*#__PURE__*/function () {
305
284
  value: function () {
306
285
  var _removeAllLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
307
286
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
308
- while (1) {
309
- switch (_context4.prev = _context4.next) {
310
- case 0:
311
- _context4.next = 2;
312
- return this.layerService.removeAllLayers();
313
-
314
- case 2:
315
- case "end":
316
- return _context4.stop();
317
- }
287
+ while (1) switch (_context4.prev = _context4.next) {
288
+ case 0:
289
+ _context4.next = 2;
290
+ return this.layerService.removeAllLayers();
291
+ case 2:
292
+ case "end":
293
+ return _context4.stop();
318
294
  }
319
295
  }, _callee4, this);
320
296
  }));
321
-
322
297
  function removeAllLayer() {
323
298
  return _removeAllLayer.apply(this, arguments);
324
299
  }
325
-
326
300
  return removeAllLayer;
327
301
  }()
328
302
  }, {
@@ -334,14 +308,14 @@ var Scene = /*#__PURE__*/function () {
334
308
  key: "setEnableRender",
335
309
  value: function setEnableRender(flag) {
336
310
  this.layerService.setEnableRender(flag);
337
- } // asset method
311
+ }
338
312
 
313
+ // asset method
339
314
  /**
340
315
  * 为 layer/point/text 支持 iconfont 模式支持
341
316
  * @param fontUnicode
342
317
  * @param name
343
318
  */
344
-
345
319
  }, {
346
320
  key: "addIconFont",
347
321
  value: function addIconFont(name, fontUnicode) {
@@ -351,12 +325,10 @@ var Scene = /*#__PURE__*/function () {
351
325
  key: "addIconFonts",
352
326
  value: function addIconFonts(options) {
353
327
  var _this3 = this;
354
-
355
328
  options.forEach(function (_ref) {
356
329
  var _ref2 = _slicedToArray(_ref, 2),
357
- name = _ref2[0],
358
- fontUnicode = _ref2[1];
359
-
330
+ name = _ref2[0],
331
+ fontUnicode = _ref2[1];
360
332
  _this3.fontService.addIconFont(name, fontUnicode);
361
333
  });
362
334
  }
@@ -365,12 +337,10 @@ var Scene = /*#__PURE__*/function () {
365
337
  * @param fontFamily
366
338
  * @param fontPath
367
339
  */
368
-
369
340
  }, {
370
341
  key: "addFontFace",
371
342
  value: function addFontFace(fontFamily, fontPath) {
372
343
  var _this4 = this;
373
-
374
344
  this.fontService.once('fontloaded', function (e) {
375
345
  _this4.emit('fontloaded', e);
376
346
  });
@@ -381,36 +351,28 @@ var Scene = /*#__PURE__*/function () {
381
351
  value: function () {
382
352
  var _addImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, img) {
383
353
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
384
- while (1) {
385
- switch (_context5.prev = _context5.next) {
386
- case 0:
387
- if (isMini) {
388
- _context5.next = 5;
389
- break;
390
- }
391
-
392
- _context5.next = 3;
393
- return this.iconService.addImage(id, img);
394
-
395
- case 3:
396
- _context5.next = 6;
354
+ while (1) switch (_context5.prev = _context5.next) {
355
+ case 0:
356
+ if (isMini) {
357
+ _context5.next = 5;
397
358
  break;
398
-
399
- case 5:
400
- this.iconService.addImageMini(id, img, this.sceneService);
401
-
402
- case 6:
403
- case "end":
404
- return _context5.stop();
405
- }
359
+ }
360
+ _context5.next = 3;
361
+ return this.iconService.addImage(id, img);
362
+ case 3:
363
+ _context5.next = 6;
364
+ break;
365
+ case 5:
366
+ this.iconService.addImageMini(id, img, this.sceneService);
367
+ case 6:
368
+ case "end":
369
+ return _context5.stop();
406
370
  }
407
371
  }, _callee5, this);
408
372
  }));
409
-
410
373
  function addImage(_x5, _x6) {
411
374
  return _addImage.apply(this, arguments);
412
375
  }
413
-
414
376
  return addImage;
415
377
  }()
416
378
  }, {
@@ -427,8 +389,9 @@ var Scene = /*#__PURE__*/function () {
427
389
  key: "addIconFontGlyphs",
428
390
  value: function addIconFontGlyphs(fontFamily, glyphs) {
429
391
  this.fontService.addIconGlyphs(glyphs);
430
- } // map control method
392
+ }
431
393
 
394
+ // map control method
432
395
  }, {
433
396
  key: "addControl",
434
397
  value: function addControl(ctr) {
@@ -443,8 +406,9 @@ var Scene = /*#__PURE__*/function () {
443
406
  key: "getControlByName",
444
407
  value: function getControlByName(name) {
445
408
  return this.controlService.getControlByName(name);
446
- } // marker
409
+ }
447
410
 
411
+ // marker
448
412
  }, {
449
413
  key: "addMarker",
450
414
  value: function addMarker(marker) {
@@ -465,6 +429,12 @@ var Scene = /*#__PURE__*/function () {
465
429
  value: function removeAllMarkers() {
466
430
  this.markerService.removeAllMarkers();
467
431
  }
432
+ }, {
433
+ key: "removeAllMakers",
434
+ value: function removeAllMakers() {
435
+ console.warn('removeAllMakers 已废弃,请使用 removeAllMarkers');
436
+ this.markerService.removeAllMarkers();
437
+ }
468
438
  }, {
469
439
  key: "addPopup",
470
440
  value: function addPopup(popup) {
@@ -480,7 +450,6 @@ var Scene = /*#__PURE__*/function () {
480
450
  value: function on(type, handle) {
481
451
  if (BoxSelectEventList.includes(type)) {
482
452
  var _this$boxSelect;
483
-
484
453
  (_this$boxSelect = this.boxSelect) === null || _this$boxSelect === void 0 ? void 0 : _this$boxSelect.on(type, handle);
485
454
  } else if (SceneEventList.includes(type)) {
486
455
  this.sceneService.on(type, handle);
@@ -493,7 +462,6 @@ var Scene = /*#__PURE__*/function () {
493
462
  value: function once(type, handle) {
494
463
  if (BoxSelectEventList.includes(type)) {
495
464
  var _this$boxSelect2;
496
-
497
465
  (_this$boxSelect2 = this.boxSelect) === null || _this$boxSelect2 === void 0 ? void 0 : _this$boxSelect2.once(type, handle);
498
466
  } else if (SceneEventList.includes(type)) {
499
467
  this.sceneService.once(type, handle);
@@ -511,15 +479,15 @@ var Scene = /*#__PURE__*/function () {
511
479
  value: function off(type, handle) {
512
480
  if (BoxSelectEventList.includes(type)) {
513
481
  var _this$boxSelect3;
514
-
515
482
  (_this$boxSelect3 = this.boxSelect) === null || _this$boxSelect3 === void 0 ? void 0 : _this$boxSelect3.off(type, handle);
516
483
  } else if (SceneEventList.includes(type)) {
517
484
  this.sceneService.off(type, handle);
518
485
  } else {
519
486
  this.mapService.off(type, handle);
520
487
  }
521
- } // implements IMapController
488
+ }
522
489
 
490
+ // implements IMapController
523
491
  }, {
524
492
  key: "getZoom",
525
493
  value: function getZoom() {
@@ -594,10 +562,10 @@ var Scene = /*#__PURE__*/function () {
594
562
  key: "fitBounds",
595
563
  value: function fitBounds(bound, options) {
596
564
  var _this$sceneService$ge = this.sceneService.getSceneConfig(),
597
- fitBoundsOptions = _this$sceneService$ge.fitBoundsOptions,
598
- animate = _this$sceneService$ge.animate;
599
-
600
- this.mapService.fitBounds(bound, // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
565
+ fitBoundsOptions = _this$sceneService$ge.fitBoundsOptions,
566
+ animate = _this$sceneService$ge.animate;
567
+ this.mapService.fitBounds(bound,
568
+ // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
601
569
  options || _objectSpread(_objectSpread({}, fitBoundsOptions), {}, {
602
570
  animate: animate
603
571
  }));
@@ -616,8 +584,9 @@ var Scene = /*#__PURE__*/function () {
616
584
  key: "setMapStatus",
617
585
  value: function setMapStatus(options) {
618
586
  this.mapService.setMapStatus(options);
619
- } // conversion Method
587
+ }
620
588
 
589
+ // conversion Method
621
590
  }, {
622
591
  key: "pixelToLngLat",
623
592
  value: function pixelToLngLat(pixel) {
@@ -641,14 +610,16 @@ var Scene = /*#__PURE__*/function () {
641
610
  }, {
642
611
  key: "destroy",
643
612
  value: function destroy() {
644
- this.sceneService.destroy(); // TODO: 清理其他 Service 例如 IconService
613
+ this.sceneService.destroy();
614
+ // TODO: 清理其他 Service 例如 IconService
645
615
  }
646
616
  }, {
647
617
  key: "registerPostProcessingPass",
648
618
  value: function registerPostProcessingPass(constructor, name) {
649
619
  this.container.bind(TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
650
- } // 控制 shader pick 计算
620
+ }
651
621
 
622
+ // 控制 shader pick 计算
652
623
  }, {
653
624
  key: "enableShaderPick",
654
625
  value: function enableShaderPick() {
@@ -663,10 +634,8 @@ var Scene = /*#__PURE__*/function () {
663
634
  key: "enableBoxSelect",
664
635
  value: function enableBoxSelect() {
665
636
  var _this5 = this;
666
-
667
637
  var once = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
668
638
  this.boxSelect.enable();
669
-
670
639
  if (once) {
671
640
  this.boxSelect.once('selectend', function () {
672
641
  _this5.disableBoxSelect();
@@ -677,8 +646,9 @@ var Scene = /*#__PURE__*/function () {
677
646
  key: "disableBoxSelect",
678
647
  value: function disableBoxSelect() {
679
648
  this.boxSelect.disable();
680
- } // get current point size info
649
+ }
681
650
 
651
+ // get current point size info
682
652
  }, {
683
653
  key: "getPointSizeRange",
684
654
  value: function getPointSizeRange() {
@@ -697,9 +667,8 @@ var Scene = /*#__PURE__*/function () {
697
667
  key: "initControl",
698
668
  value: function initControl() {
699
669
  var _this$sceneService$ge2 = this.sceneService.getSceneConfig(),
700
- logoVisible = _this$sceneService$ge2.logoVisible,
701
- logoPosition = _this$sceneService$ge2.logoPosition;
702
-
670
+ logoVisible = _this$sceneService$ge2.logoVisible,
671
+ logoPosition = _this$sceneService$ge2.logoPosition;
703
672
  if (logoVisible) {
704
673
  this.addControl(new Logo({
705
674
  position: logoPosition
@@ -707,8 +676,6 @@ var Scene = /*#__PURE__*/function () {
707
676
  }
708
677
  }
709
678
  }]);
710
-
711
679
  return Scene;
712
680
  }();
713
-
714
681
  export { Scene };
package/lib/index.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -100,6 +104,10 @@ var Scene = class {
100
104
  getMapService() {
101
105
  return this.mapService;
102
106
  }
107
+ /**
108
+ * 对外暴露 debugService
109
+ * @returns
110
+ */
103
111
  getDebugService() {
104
112
  return this.debugService;
105
113
  }
@@ -123,6 +131,7 @@ var Scene = class {
123
131
  setBgColor(color) {
124
132
  this.mapService.setBgColor(color);
125
133
  }
134
+ // layer 管理
126
135
  addLayer(layer) {
127
136
  const layerContainer = (0, import_l7_core.createLayerContainer)(this.container);
128
137
  layer.setContainer(layerContainer, this.container);
@@ -191,6 +200,12 @@ var Scene = class {
191
200
  setEnableRender(flag) {
192
201
  this.layerService.setEnableRender(flag);
193
202
  }
203
+ // asset method
204
+ /**
205
+ * 为 layer/point/text 支持 iconfont 模式支持
206
+ * @param fontUnicode
207
+ * @param name
208
+ */
194
209
  addIconFont(name, fontUnicode) {
195
210
  this.fontService.addIconFont(name, fontUnicode);
196
211
  }
@@ -199,6 +214,11 @@ var Scene = class {
199
214
  this.fontService.addIconFont(name, fontUnicode);
200
215
  });
201
216
  }
217
+ /**
218
+ * 用户自定义添加第三方字体
219
+ * @param fontFamily
220
+ * @param fontPath
221
+ */
202
222
  addFontFace(fontFamily, fontPath) {
203
223
  this.fontService.once("fontloaded", (e) => {
204
224
  this.emit("fontloaded", e);
@@ -221,6 +241,7 @@ var Scene = class {
221
241
  addIconFontGlyphs(fontFamily, glyphs) {
222
242
  this.fontService.addIconGlyphs(glyphs);
223
243
  }
244
+ // map control method
224
245
  addControl(ctr) {
225
246
  this.controlService.addControl(ctr, this.container);
226
247
  }
@@ -230,6 +251,7 @@ var Scene = class {
230
251
  getControlByName(name) {
231
252
  return this.controlService.getControlByName(name);
232
253
  }
254
+ // marker
233
255
  addMarker(marker) {
234
256
  this.markerService.addMarker(marker);
235
257
  }
@@ -242,6 +264,10 @@ var Scene = class {
242
264
  removeAllMarkers() {
243
265
  this.markerService.removeAllMarkers();
244
266
  }
267
+ removeAllMakers() {
268
+ console.warn("removeAllMakers 已废弃,请使用 removeAllMarkers");
269
+ this.markerService.removeAllMarkers();
270
+ }
245
271
  addPopup(popup) {
246
272
  this.popupService.addPopup(popup);
247
273
  }
@@ -281,6 +307,7 @@ var Scene = class {
281
307
  this.mapService.off(type, handle);
282
308
  }
283
309
  }
310
+ // implements IMapController
284
311
  getZoom() {
285
312
  return this.mapService.getZoom();
286
313
  }
@@ -327,6 +354,7 @@ var Scene = class {
327
354
  const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig();
328
355
  this.mapService.fitBounds(
329
356
  bound,
357
+ // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
330
358
  options || {
331
359
  ...fitBoundsOptions,
332
360
  animate
@@ -342,6 +370,7 @@ var Scene = class {
342
370
  setMapStatus(options) {
343
371
  this.mapService.setMapStatus(options);
344
372
  }
373
+ // conversion Method
345
374
  pixelToLngLat(pixel) {
346
375
  return this.mapService.pixelToLngLat(pixel);
347
376
  }
@@ -360,6 +389,7 @@ var Scene = class {
360
389
  registerPostProcessingPass(constructor, name) {
361
390
  this.container.bind(import_l7_core.TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
362
391
  }
392
+ // 控制 shader pick 计算
363
393
  enableShaderPick() {
364
394
  this.layerService.enableShaderPick();
365
395
  }
@@ -377,6 +407,7 @@ var Scene = class {
377
407
  disableBoxSelect() {
378
408
  this.boxSelect.disable();
379
409
  }
410
+ // get current point size info
380
411
  getPointSizeRange() {
381
412
  return this.sceneService.getPointSizeRange();
382
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-scene",
3
- "version": "2.16.1",
3
+ "version": "2.16.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -23,12 +23,12 @@
23
23
  "author": "xiaoiver",
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
- "@antv/l7-component": "2.16.1",
27
- "@antv/l7-core": "2.16.1",
28
- "@antv/l7-layers": "2.16.1",
29
- "@antv/l7-maps": "2.16.1",
30
- "@antv/l7-renderer": "2.16.1",
31
- "@antv/l7-utils": "2.16.1",
26
+ "@antv/l7-component": "2.16.2",
27
+ "@antv/l7-core": "2.16.2",
28
+ "@antv/l7-layers": "2.16.2",
29
+ "@antv/l7-maps": "2.16.2",
30
+ "@antv/l7-renderer": "2.16.2",
31
+ "@antv/l7-utils": "2.16.2",
32
32
  "@babel/runtime": "^7.7.7",
33
33
  "eventemitter3": "^4.0.7",
34
34
  "inversify": "^5.0.1",
@@ -36,9 +36,9 @@
36
36
  "reflect-metadata": "^0.1.13"
37
37
  },
38
38
  "devDependencies": {
39
- "@antv/l7-test-utils": "2.16.1"
39
+ "@antv/l7-test-utils": "2.16.2"
40
40
  },
41
- "gitHead": "0976422540e1c3e23563239847110b40c6cb852a",
41
+ "gitHead": "93b6d071e7d9c07c8bafcf1e6ce37b5f21185905",
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  }