@antv/l7-scene 2.17.4 → 2.17.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/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.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) {
@@ -486,7 +450,6 @@ var Scene = /*#__PURE__*/function () {
486
450
  value: function on(type, handle) {
487
451
  if (BoxSelectEventList.includes(type)) {
488
452
  var _this$boxSelect;
489
-
490
453
  (_this$boxSelect = this.boxSelect) === null || _this$boxSelect === void 0 ? void 0 : _this$boxSelect.on(type, handle);
491
454
  } else if (SceneEventList.includes(type)) {
492
455
  this.sceneService.on(type, handle);
@@ -499,7 +462,6 @@ var Scene = /*#__PURE__*/function () {
499
462
  value: function once(type, handle) {
500
463
  if (BoxSelectEventList.includes(type)) {
501
464
  var _this$boxSelect2;
502
-
503
465
  (_this$boxSelect2 = this.boxSelect) === null || _this$boxSelect2 === void 0 ? void 0 : _this$boxSelect2.once(type, handle);
504
466
  } else if (SceneEventList.includes(type)) {
505
467
  this.sceneService.once(type, handle);
@@ -517,15 +479,15 @@ var Scene = /*#__PURE__*/function () {
517
479
  value: function off(type, handle) {
518
480
  if (BoxSelectEventList.includes(type)) {
519
481
  var _this$boxSelect3;
520
-
521
482
  (_this$boxSelect3 = this.boxSelect) === null || _this$boxSelect3 === void 0 ? void 0 : _this$boxSelect3.off(type, handle);
522
483
  } else if (SceneEventList.includes(type)) {
523
484
  this.sceneService.off(type, handle);
524
485
  } else {
525
486
  this.mapService.off(type, handle);
526
487
  }
527
- } // implements IMapController
488
+ }
528
489
 
490
+ // implements IMapController
529
491
  }, {
530
492
  key: "getZoom",
531
493
  value: function getZoom() {
@@ -600,10 +562,10 @@ var Scene = /*#__PURE__*/function () {
600
562
  key: "fitBounds",
601
563
  value: function fitBounds(bound, options) {
602
564
  var _this$sceneService$ge = this.sceneService.getSceneConfig(),
603
- fitBoundsOptions = _this$sceneService$ge.fitBoundsOptions,
604
- animate = _this$sceneService$ge.animate;
605
-
606
- 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配置项传入
607
569
  options || _objectSpread(_objectSpread({}, fitBoundsOptions), {}, {
608
570
  animate: animate
609
571
  }));
@@ -622,8 +584,9 @@ var Scene = /*#__PURE__*/function () {
622
584
  key: "setMapStatus",
623
585
  value: function setMapStatus(options) {
624
586
  this.mapService.setMapStatus(options);
625
- } // conversion Method
587
+ }
626
588
 
589
+ // conversion Method
627
590
  }, {
628
591
  key: "pixelToLngLat",
629
592
  value: function pixelToLngLat(pixel) {
@@ -647,14 +610,16 @@ var Scene = /*#__PURE__*/function () {
647
610
  }, {
648
611
  key: "destroy",
649
612
  value: function destroy() {
650
- this.sceneService.destroy(); // TODO: 清理其他 Service 例如 IconService
613
+ this.sceneService.destroy();
614
+ // TODO: 清理其他 Service 例如 IconService
651
615
  }
652
616
  }, {
653
617
  key: "registerPostProcessingPass",
654
618
  value: function registerPostProcessingPass(constructor, name) {
655
619
  this.container.bind(TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
656
- } // 控制 shader pick 计算
620
+ }
657
621
 
622
+ // 控制 shader pick 计算
658
623
  }, {
659
624
  key: "enableShaderPick",
660
625
  value: function enableShaderPick() {
@@ -669,10 +634,8 @@ var Scene = /*#__PURE__*/function () {
669
634
  key: "enableBoxSelect",
670
635
  value: function enableBoxSelect() {
671
636
  var _this5 = this;
672
-
673
637
  var once = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
674
638
  this.boxSelect.enable();
675
-
676
639
  if (once) {
677
640
  this.boxSelect.once('selectend', function () {
678
641
  _this5.disableBoxSelect();
@@ -683,8 +646,9 @@ var Scene = /*#__PURE__*/function () {
683
646
  key: "disableBoxSelect",
684
647
  value: function disableBoxSelect() {
685
648
  this.boxSelect.disable();
686
- } // get current point size info
649
+ }
687
650
 
651
+ // get current point size info
688
652
  }, {
689
653
  key: "getPointSizeRange",
690
654
  value: function getPointSizeRange() {
@@ -703,9 +667,8 @@ var Scene = /*#__PURE__*/function () {
703
667
  key: "initControl",
704
668
  value: function initControl() {
705
669
  var _this$sceneService$ge2 = this.sceneService.getSceneConfig(),
706
- logoVisible = _this$sceneService$ge2.logoVisible,
707
- logoPosition = _this$sceneService$ge2.logoPosition;
708
-
670
+ logoVisible = _this$sceneService$ge2.logoVisible,
671
+ logoPosition = _this$sceneService$ge2.logoPosition;
709
672
  if (logoVisible) {
710
673
  this.addControl(new Logo({
711
674
  position: logoPosition
@@ -713,8 +676,6 @@ var Scene = /*#__PURE__*/function () {
713
676
  }
714
677
  }
715
678
  }]);
716
-
717
679
  return Scene;
718
680
  }();
719
-
720
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
  }
@@ -243,7 +265,7 @@ var Scene = class {
243
265
  this.markerService.removeAllMarkers();
244
266
  }
245
267
  removeAllMakers() {
246
- console.warn("removeAllMakers \u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 removeAllMarkers");
268
+ console.warn("removeAllMakers 已废弃,请使用 removeAllMarkers");
247
269
  this.markerService.removeAllMarkers();
248
270
  }
249
271
  addPopup(popup) {
@@ -285,6 +307,7 @@ var Scene = class {
285
307
  this.mapService.off(type, handle);
286
308
  }
287
309
  }
310
+ // implements IMapController
288
311
  getZoom() {
289
312
  return this.mapService.getZoom();
290
313
  }
@@ -331,6 +354,7 @@ var Scene = class {
331
354
  const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig();
332
355
  this.mapService.fitBounds(
333
356
  bound,
357
+ // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
334
358
  options || {
335
359
  ...fitBoundsOptions,
336
360
  animate
@@ -346,6 +370,7 @@ var Scene = class {
346
370
  setMapStatus(options) {
347
371
  this.mapService.setMapStatus(options);
348
372
  }
373
+ // conversion Method
349
374
  pixelToLngLat(pixel) {
350
375
  return this.mapService.pixelToLngLat(pixel);
351
376
  }
@@ -364,6 +389,7 @@ var Scene = class {
364
389
  registerPostProcessingPass(constructor, name) {
365
390
  this.container.bind(import_l7_core.TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
366
391
  }
392
+ // 控制 shader pick 计算
367
393
  enableShaderPick() {
368
394
  this.layerService.enableShaderPick();
369
395
  }
@@ -381,6 +407,7 @@ var Scene = class {
381
407
  disableBoxSelect() {
382
408
  this.boxSelect.disable();
383
409
  }
410
+ // get current point size info
384
411
  getPointSizeRange() {
385
412
  return this.sceneService.getPointSizeRange();
386
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-scene",
3
- "version": "2.17.4",
3
+ "version": "2.17.6",
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.17.4",
27
- "@antv/l7-core": "^2.17.4",
28
- "@antv/l7-layers": "^2.17.4",
29
- "@antv/l7-maps": "^2.17.4",
30
- "@antv/l7-renderer": "^2.17.4",
31
- "@antv/l7-utils": "^2.17.4",
26
+ "@antv/l7-component": "2.17.6",
27
+ "@antv/l7-core": "2.17.6",
28
+ "@antv/l7-layers": "2.17.6",
29
+ "@antv/l7-maps": "2.17.6",
30
+ "@antv/l7-renderer": "2.17.6",
31
+ "@antv/l7-utils": "2.17.6",
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.17.4"
39
+ "@antv/l7-test-utils": "2.17.6"
40
40
  },
41
- "gitHead": "f6a09dc02ed0fc7a7f5dc44b231105f43b26f67b",
41
+ "gitHead": "feea7d918912895a33493c62d0786598fc73faf6",
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  }