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