@antv/l7-scene 2.13.5 → 2.13.7
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/index.d.ts +7 -1
- package/es/index.js +24 -14
- package/lib/boxSelect.js +11 -2
- package/lib/index.js +40 -16
- package/package.json +9 -9
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bounds, ICameraOptions, IControl, IIconFontGlyph, IImage, ILayer, ILngLat, IMapService, IMarker, IMarkerLayer, IPoint, IPopup, IPostProcessingPass, ISceneConfig, IStatusOptions, Point } from '@antv/l7-core';
|
|
1
|
+
import { Bounds, ICameraOptions, IControl, IDebugService, IIconFontGlyph, IImage, ILayer, ILngLat, IMapService, IMarker, IMarkerLayer, IPoint, IPopup, IPostProcessingPass, ISceneConfig, IStatusOptions, Point } from '@antv/l7-core';
|
|
2
2
|
import { Container } from 'inversify';
|
|
3
3
|
import ILayerManager from './ILayerManager';
|
|
4
4
|
import IMapController from './IMapController';
|
|
@@ -20,6 +20,7 @@ declare class Scene implements IPostProcessingPassPluggable, IMapController, ILa
|
|
|
20
20
|
private mapService;
|
|
21
21
|
private controlService;
|
|
22
22
|
private layerService;
|
|
23
|
+
private debugService;
|
|
23
24
|
private iconService;
|
|
24
25
|
private markerService;
|
|
25
26
|
private popupService;
|
|
@@ -38,6 +39,11 @@ declare class Scene implements IPostProcessingPassPluggable, IMapController, ILa
|
|
|
38
39
|
getMapContainer(): HTMLElement | null;
|
|
39
40
|
getMapCanvasContainer(): HTMLElement;
|
|
40
41
|
getMapService(): IMapService<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* 对外暴露 debugService
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
getDebugService(): IDebugService;
|
|
41
47
|
exportPng(type?: 'png' | 'jpg'): Promise<string>;
|
|
42
48
|
exportMap(type?: 'png' | 'jpg'): Promise<string>;
|
|
43
49
|
registerRenderService(render: any): void;
|
package/es/index.js
CHANGED
|
@@ -45,6 +45,8 @@ var Scene = /*#__PURE__*/function () {
|
|
|
45
45
|
this.fontService = sceneContainer.get(TYPES.IFontService);
|
|
46
46
|
this.controlService = sceneContainer.get(TYPES.IControlService);
|
|
47
47
|
this.layerService = sceneContainer.get(TYPES.ILayerService);
|
|
48
|
+
this.debugService = sceneContainer.get(TYPES.IDebugService);
|
|
49
|
+
this.debugService.setEnable(config.debug);
|
|
48
50
|
this.markerService = sceneContainer.get(TYPES.IMarkerService);
|
|
49
51
|
this.interactionService = sceneContainer.get(TYPES.IInteractionService);
|
|
50
52
|
this.popupService = sceneContainer.get(TYPES.IPopupService);
|
|
@@ -112,6 +114,16 @@ var Scene = /*#__PURE__*/function () {
|
|
|
112
114
|
value: function getMapService() {
|
|
113
115
|
return this.mapService;
|
|
114
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 对外暴露 debugService
|
|
119
|
+
* @returns
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
}, {
|
|
123
|
+
key: "getDebugService",
|
|
124
|
+
value: function getDebugService() {
|
|
125
|
+
return this.debugService;
|
|
126
|
+
}
|
|
115
127
|
}, {
|
|
116
128
|
key: "exportPng",
|
|
117
129
|
value: function () {
|
|
@@ -120,13 +132,9 @@ var Scene = /*#__PURE__*/function () {
|
|
|
120
132
|
while (1) {
|
|
121
133
|
switch (_context.prev = _context.next) {
|
|
122
134
|
case 0:
|
|
123
|
-
_context.
|
|
124
|
-
return this.sceneService.exportPng(type);
|
|
125
|
-
|
|
126
|
-
case 2:
|
|
127
|
-
return _context.abrupt("return", _context.sent);
|
|
135
|
+
return _context.abrupt("return", this.sceneService.exportPng(type));
|
|
128
136
|
|
|
129
|
-
case
|
|
137
|
+
case 1:
|
|
130
138
|
case "end":
|
|
131
139
|
return _context.stop();
|
|
132
140
|
}
|
|
@@ -148,13 +156,9 @@ var Scene = /*#__PURE__*/function () {
|
|
|
148
156
|
while (1) {
|
|
149
157
|
switch (_context2.prev = _context2.next) {
|
|
150
158
|
case 0:
|
|
151
|
-
_context2.
|
|
152
|
-
return this.sceneService.exportPng(type);
|
|
159
|
+
return _context2.abrupt("return", this.sceneService.exportPng(type));
|
|
153
160
|
|
|
154
|
-
case
|
|
155
|
-
return _context2.abrupt("return", _context2.sent);
|
|
156
|
-
|
|
157
|
-
case 3:
|
|
161
|
+
case 1:
|
|
158
162
|
case "end":
|
|
159
163
|
return _context2.stop();
|
|
160
164
|
}
|
|
@@ -222,7 +226,10 @@ var Scene = /*#__PURE__*/function () {
|
|
|
222
226
|
_layer$getLayerConfig3 = _layer$getLayerConfig.maskOpacity,
|
|
223
227
|
maskOpacity = _layer$getLayerConfig3 === void 0 ? 0 : _layer$getLayerConfig3;
|
|
224
228
|
|
|
225
|
-
if (!mask || !maskfence)
|
|
229
|
+
if (!mask || !maskfence) {
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
var maskInstance = new MaskLayer().source(maskfence).shape('fill').style({
|
|
227
234
|
color: maskColor,
|
|
228
235
|
opacity: maskOpacity
|
|
@@ -232,7 +239,10 @@ var Scene = /*#__PURE__*/function () {
|
|
|
232
239
|
}, {
|
|
233
240
|
key: "addMask",
|
|
234
241
|
value: function addMask(mask, layerId) {
|
|
235
|
-
if (!mask)
|
|
242
|
+
if (!mask) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
236
246
|
var parent = this.getLayer(layerId);
|
|
237
247
|
|
|
238
248
|
if (parent) {
|
package/lib/boxSelect.js
CHANGED
|
@@ -34,7 +34,12 @@ var BoxSelect = class extends import_eventemitter3.EventEmitter {
|
|
|
34
34
|
this.box.style.display = "block";
|
|
35
35
|
this.startEvent = this.endEvent = e;
|
|
36
36
|
this.syncBoxBound();
|
|
37
|
-
this.emit(
|
|
37
|
+
this.emit(
|
|
38
|
+
"selectstart",
|
|
39
|
+
this.getLngLatBox(),
|
|
40
|
+
this.startEvent,
|
|
41
|
+
this.endEvent
|
|
42
|
+
);
|
|
38
43
|
};
|
|
39
44
|
this.onDragging = (e) => {
|
|
40
45
|
this.endEvent = e;
|
|
@@ -62,7 +67,11 @@ var BoxSelect = class extends import_eventemitter3.EventEmitter {
|
|
|
62
67
|
});
|
|
63
68
|
this.container.style.cursor = "crosshair";
|
|
64
69
|
if (!this.box) {
|
|
65
|
-
const box = import_l7_utils.DOM.create(
|
|
70
|
+
const box = import_l7_utils.DOM.create(
|
|
71
|
+
"div",
|
|
72
|
+
void 0,
|
|
73
|
+
this.container
|
|
74
|
+
);
|
|
66
75
|
box.classList.add("l7-select-box");
|
|
67
76
|
if (className) {
|
|
68
77
|
box.classList.add(className);
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/index.ts
|
|
@@ -39,13 +42,23 @@ var Scene = class {
|
|
|
39
42
|
map.setContainer(sceneContainer, id, canvas, hasBaseMap);
|
|
40
43
|
sceneContainer.bind(import_l7_core.TYPES.IRendererService).to(import_l7_renderer.ReglRendererService).inSingletonScope();
|
|
41
44
|
this.sceneService = sceneContainer.get(import_l7_core.TYPES.ISceneService);
|
|
42
|
-
this.mapService = sceneContainer.get(
|
|
45
|
+
this.mapService = sceneContainer.get(
|
|
46
|
+
import_l7_core.TYPES.IMapService
|
|
47
|
+
);
|
|
43
48
|
this.iconService = sceneContainer.get(import_l7_core.TYPES.IIconService);
|
|
44
49
|
this.fontService = sceneContainer.get(import_l7_core.TYPES.IFontService);
|
|
45
|
-
this.controlService = sceneContainer.get(
|
|
50
|
+
this.controlService = sceneContainer.get(
|
|
51
|
+
import_l7_core.TYPES.IControlService
|
|
52
|
+
);
|
|
46
53
|
this.layerService = sceneContainer.get(import_l7_core.TYPES.ILayerService);
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
54
|
+
this.debugService = sceneContainer.get(import_l7_core.TYPES.IDebugService);
|
|
55
|
+
this.debugService.setEnable(config.debug);
|
|
56
|
+
this.markerService = sceneContainer.get(
|
|
57
|
+
import_l7_core.TYPES.IMarkerService
|
|
58
|
+
);
|
|
59
|
+
this.interactionService = sceneContainer.get(
|
|
60
|
+
import_l7_core.TYPES.IInteractionService
|
|
61
|
+
);
|
|
49
62
|
this.popupService = sceneContainer.get(import_l7_core.TYPES.IPopupService);
|
|
50
63
|
this.boxSelect = new import_boxSelect.default(this, {});
|
|
51
64
|
(0, import_l7_utils.setMiniScene)((config == null ? void 0 : config.isMini) || false);
|
|
@@ -87,11 +100,14 @@ var Scene = class {
|
|
|
87
100
|
getMapService() {
|
|
88
101
|
return this.mapService;
|
|
89
102
|
}
|
|
103
|
+
getDebugService() {
|
|
104
|
+
return this.debugService;
|
|
105
|
+
}
|
|
90
106
|
async exportPng(type) {
|
|
91
|
-
return
|
|
107
|
+
return this.sceneService.exportPng(type);
|
|
92
108
|
}
|
|
93
109
|
async exportMap(type) {
|
|
94
|
-
return
|
|
110
|
+
return this.sceneService.exportPng(type);
|
|
95
111
|
}
|
|
96
112
|
registerRenderService(render) {
|
|
97
113
|
if (this.sceneService.loaded) {
|
|
@@ -128,8 +144,9 @@ var Scene = class {
|
|
|
128
144
|
maskColor = "#000",
|
|
129
145
|
maskOpacity = 0
|
|
130
146
|
} = layer.getLayerConfig();
|
|
131
|
-
if (!mask || !maskfence)
|
|
147
|
+
if (!mask || !maskfence) {
|
|
132
148
|
return void 0;
|
|
149
|
+
}
|
|
133
150
|
const maskInstance = new import_l7_layers.MaskLayer().source(maskfence).shape("fill").style({
|
|
134
151
|
color: maskColor,
|
|
135
152
|
opacity: maskOpacity
|
|
@@ -137,8 +154,9 @@ var Scene = class {
|
|
|
137
154
|
return maskInstance;
|
|
138
155
|
}
|
|
139
156
|
addMask(mask, layerId) {
|
|
140
|
-
if (!mask)
|
|
157
|
+
if (!mask) {
|
|
141
158
|
return;
|
|
159
|
+
}
|
|
142
160
|
const parent = this.getLayer(layerId);
|
|
143
161
|
if (parent) {
|
|
144
162
|
const layerContainer = (0, import_l7_core.createLayerContainer)(this.container);
|
|
@@ -307,10 +325,13 @@ var Scene = class {
|
|
|
307
325
|
}
|
|
308
326
|
fitBounds(bound, options) {
|
|
309
327
|
const { fitBoundsOptions, animate } = this.sceneService.getSceneConfig();
|
|
310
|
-
this.mapService.fitBounds(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
328
|
+
this.mapService.fitBounds(
|
|
329
|
+
bound,
|
|
330
|
+
options || {
|
|
331
|
+
...fitBoundsOptions,
|
|
332
|
+
animate
|
|
333
|
+
}
|
|
334
|
+
);
|
|
314
335
|
}
|
|
315
336
|
setZoomAndCenter(zoom, center) {
|
|
316
337
|
this.mapService.setZoomAndCenter(zoom, center);
|
|
@@ -360,9 +381,12 @@ var Scene = class {
|
|
|
360
381
|
return this.sceneService.getPointSizeRange();
|
|
361
382
|
}
|
|
362
383
|
initComponent(id) {
|
|
363
|
-
this.controlService.init(
|
|
364
|
-
|
|
365
|
-
|
|
384
|
+
this.controlService.init(
|
|
385
|
+
{
|
|
386
|
+
container: import_l7_utils.DOM.getContainer(id)
|
|
387
|
+
},
|
|
388
|
+
this.container
|
|
389
|
+
);
|
|
366
390
|
this.markerService.init(this.container);
|
|
367
391
|
this.popupService.init(this.container);
|
|
368
392
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-scene",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.7",
|
|
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.13.
|
|
27
|
-
"@antv/l7-core": "2.13.
|
|
28
|
-
"@antv/l7-layers": "2.13.
|
|
29
|
-
"@antv/l7-maps": "2.13.
|
|
30
|
-
"@antv/l7-renderer": "2.13.
|
|
31
|
-
"@antv/l7-utils": "2.13.
|
|
26
|
+
"@antv/l7-component": "2.13.7",
|
|
27
|
+
"@antv/l7-core": "2.13.7",
|
|
28
|
+
"@antv/l7-layers": "2.13.7",
|
|
29
|
+
"@antv/l7-maps": "2.13.7",
|
|
30
|
+
"@antv/l7-renderer": "2.13.7",
|
|
31
|
+
"@antv/l7-utils": "2.13.7",
|
|
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.13.
|
|
39
|
+
"@antv/l7-test-utils": "2.13.7"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "322cff4a31491437a1409ec3f7d3a313ba8a3a2c",
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
}
|