@antv/l7-scene 2.16.0 → 2.16.1
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 +0 -27
- 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) {
|
|
@@ -444,6 +480,7 @@ var Scene = /*#__PURE__*/function () {
|
|
|
444
480
|
value: function on(type, handle) {
|
|
445
481
|
if (BoxSelectEventList.includes(type)) {
|
|
446
482
|
var _this$boxSelect;
|
|
483
|
+
|
|
447
484
|
(_this$boxSelect = this.boxSelect) === null || _this$boxSelect === void 0 ? void 0 : _this$boxSelect.on(type, handle);
|
|
448
485
|
} else if (SceneEventList.includes(type)) {
|
|
449
486
|
this.sceneService.on(type, handle);
|
|
@@ -456,6 +493,7 @@ var Scene = /*#__PURE__*/function () {
|
|
|
456
493
|
value: function once(type, handle) {
|
|
457
494
|
if (BoxSelectEventList.includes(type)) {
|
|
458
495
|
var _this$boxSelect2;
|
|
496
|
+
|
|
459
497
|
(_this$boxSelect2 = this.boxSelect) === null || _this$boxSelect2 === void 0 ? void 0 : _this$boxSelect2.once(type, handle);
|
|
460
498
|
} else if (SceneEventList.includes(type)) {
|
|
461
499
|
this.sceneService.once(type, handle);
|
|
@@ -473,15 +511,15 @@ var Scene = /*#__PURE__*/function () {
|
|
|
473
511
|
value: function off(type, handle) {
|
|
474
512
|
if (BoxSelectEventList.includes(type)) {
|
|
475
513
|
var _this$boxSelect3;
|
|
514
|
+
|
|
476
515
|
(_this$boxSelect3 = this.boxSelect) === null || _this$boxSelect3 === void 0 ? void 0 : _this$boxSelect3.off(type, handle);
|
|
477
516
|
} else if (SceneEventList.includes(type)) {
|
|
478
517
|
this.sceneService.off(type, handle);
|
|
479
518
|
} else {
|
|
480
519
|
this.mapService.off(type, handle);
|
|
481
520
|
}
|
|
482
|
-
}
|
|
521
|
+
} // implements IMapController
|
|
483
522
|
|
|
484
|
-
// implements IMapController
|
|
485
523
|
}, {
|
|
486
524
|
key: "getZoom",
|
|
487
525
|
value: function getZoom() {
|
|
@@ -556,10 +594,10 @@ var Scene = /*#__PURE__*/function () {
|
|
|
556
594
|
key: "fitBounds",
|
|
557
595
|
value: function fitBounds(bound, options) {
|
|
558
596
|
var _this$sceneService$ge = this.sceneService.getSceneConfig(),
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
// 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
|
|
597
|
+
fitBoundsOptions = _this$sceneService$ge.fitBoundsOptions,
|
|
598
|
+
animate = _this$sceneService$ge.animate;
|
|
599
|
+
|
|
600
|
+
this.mapService.fitBounds(bound, // 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
|
|
563
601
|
options || _objectSpread(_objectSpread({}, fitBoundsOptions), {}, {
|
|
564
602
|
animate: animate
|
|
565
603
|
}));
|
|
@@ -578,9 +616,8 @@ var Scene = /*#__PURE__*/function () {
|
|
|
578
616
|
key: "setMapStatus",
|
|
579
617
|
value: function setMapStatus(options) {
|
|
580
618
|
this.mapService.setMapStatus(options);
|
|
581
|
-
}
|
|
619
|
+
} // conversion Method
|
|
582
620
|
|
|
583
|
-
// conversion Method
|
|
584
621
|
}, {
|
|
585
622
|
key: "pixelToLngLat",
|
|
586
623
|
value: function pixelToLngLat(pixel) {
|
|
@@ -604,16 +641,14 @@ var Scene = /*#__PURE__*/function () {
|
|
|
604
641
|
}, {
|
|
605
642
|
key: "destroy",
|
|
606
643
|
value: function destroy() {
|
|
607
|
-
this.sceneService.destroy();
|
|
608
|
-
// TODO: 清理其他 Service 例如 IconService
|
|
644
|
+
this.sceneService.destroy(); // TODO: 清理其他 Service 例如 IconService
|
|
609
645
|
}
|
|
610
646
|
}, {
|
|
611
647
|
key: "registerPostProcessingPass",
|
|
612
648
|
value: function registerPostProcessingPass(constructor, name) {
|
|
613
649
|
this.container.bind(TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
|
|
614
|
-
}
|
|
650
|
+
} // 控制 shader pick 计算
|
|
615
651
|
|
|
616
|
-
// 控制 shader pick 计算
|
|
617
652
|
}, {
|
|
618
653
|
key: "enableShaderPick",
|
|
619
654
|
value: function enableShaderPick() {
|
|
@@ -628,8 +663,10 @@ var Scene = /*#__PURE__*/function () {
|
|
|
628
663
|
key: "enableBoxSelect",
|
|
629
664
|
value: function enableBoxSelect() {
|
|
630
665
|
var _this5 = this;
|
|
666
|
+
|
|
631
667
|
var once = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
632
668
|
this.boxSelect.enable();
|
|
669
|
+
|
|
633
670
|
if (once) {
|
|
634
671
|
this.boxSelect.once('selectend', function () {
|
|
635
672
|
_this5.disableBoxSelect();
|
|
@@ -640,9 +677,8 @@ var Scene = /*#__PURE__*/function () {
|
|
|
640
677
|
key: "disableBoxSelect",
|
|
641
678
|
value: function disableBoxSelect() {
|
|
642
679
|
this.boxSelect.disable();
|
|
643
|
-
}
|
|
680
|
+
} // get current point size info
|
|
644
681
|
|
|
645
|
-
// get current point size info
|
|
646
682
|
}, {
|
|
647
683
|
key: "getPointSizeRange",
|
|
648
684
|
value: function getPointSizeRange() {
|
|
@@ -661,8 +697,9 @@ var Scene = /*#__PURE__*/function () {
|
|
|
661
697
|
key: "initControl",
|
|
662
698
|
value: function initControl() {
|
|
663
699
|
var _this$sceneService$ge2 = this.sceneService.getSceneConfig(),
|
|
664
|
-
|
|
665
|
-
|
|
700
|
+
logoVisible = _this$sceneService$ge2.logoVisible,
|
|
701
|
+
logoPosition = _this$sceneService$ge2.logoPosition;
|
|
702
|
+
|
|
666
703
|
if (logoVisible) {
|
|
667
704
|
this.addControl(new Logo({
|
|
668
705
|
position: logoPosition
|
|
@@ -670,6 +707,8 @@ var Scene = /*#__PURE__*/function () {
|
|
|
670
707
|
}
|
|
671
708
|
}
|
|
672
709
|
}]);
|
|
710
|
+
|
|
673
711
|
return Scene;
|
|
674
712
|
}();
|
|
713
|
+
|
|
675
714
|
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
|
}
|
|
@@ -303,7 +281,6 @@ var Scene = class {
|
|
|
303
281
|
this.mapService.off(type, handle);
|
|
304
282
|
}
|
|
305
283
|
}
|
|
306
|
-
// implements IMapController
|
|
307
284
|
getZoom() {
|
|
308
285
|
return this.mapService.getZoom();
|
|
309
286
|
}
|
|
@@ -350,7 +327,6 @@ var Scene = class {
|
|
|
350
327
|
const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig();
|
|
351
328
|
this.mapService.fitBounds(
|
|
352
329
|
bound,
|
|
353
|
-
// 选项优先级:用户传入,覆盖animate直接配置,覆盖Scene配置项传入
|
|
354
330
|
options || {
|
|
355
331
|
...fitBoundsOptions,
|
|
356
332
|
animate
|
|
@@ -366,7 +342,6 @@ var Scene = class {
|
|
|
366
342
|
setMapStatus(options) {
|
|
367
343
|
this.mapService.setMapStatus(options);
|
|
368
344
|
}
|
|
369
|
-
// conversion Method
|
|
370
345
|
pixelToLngLat(pixel) {
|
|
371
346
|
return this.mapService.pixelToLngLat(pixel);
|
|
372
347
|
}
|
|
@@ -385,7 +360,6 @@ var Scene = class {
|
|
|
385
360
|
registerPostProcessingPass(constructor, name) {
|
|
386
361
|
this.container.bind(import_l7_core.TYPES.IPostProcessingPass).to(constructor).whenTargetNamed(name);
|
|
387
362
|
}
|
|
388
|
-
// 控制 shader pick 计算
|
|
389
363
|
enableShaderPick() {
|
|
390
364
|
this.layerService.enableShaderPick();
|
|
391
365
|
}
|
|
@@ -403,7 +377,6 @@ var Scene = class {
|
|
|
403
377
|
disableBoxSelect() {
|
|
404
378
|
this.boxSelect.disable();
|
|
405
379
|
}
|
|
406
|
-
// get current point size info
|
|
407
380
|
getPointSizeRange() {
|
|
408
381
|
return this.sceneService.getPointSizeRange();
|
|
409
382
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-scene",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.1",
|
|
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.
|
|
27
|
-
"@antv/l7-core": "2.16.
|
|
28
|
-
"@antv/l7-layers": "2.16.
|
|
29
|
-
"@antv/l7-maps": "2.16.
|
|
30
|
-
"@antv/l7-renderer": "2.16.
|
|
31
|
-
"@antv/l7-utils": "2.16.
|
|
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",
|
|
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.
|
|
39
|
+
"@antv/l7-test-utils": "2.16.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0976422540e1c3e23563239847110b40c6cb852a",
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
}
|