@antv/l7-component 2.5.37-mini3 → 2.5.40

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/CHANGELOG.md ADDED
@@ -0,0 +1,325 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [2.1.12](https://github.com/antvis/L7/compare/v2.1.11...v2.1.12) (2020-04-10)
7
+
8
+ **Note:** Version bump only for package @antv/l7-component
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.1.11](https://github.com/antvis/L7/compare/v2.1.10...v2.1.11) (2020-04-07)
15
+
16
+ **Note:** Version bump only for package @antv/l7-component
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.1.8](https://github.com/antvis/L7/compare/v2.1.7...v2.1.8) (2020-03-26)
23
+
24
+ **Note:** Version bump only for package @antv/l7-component
25
+
26
+
27
+
28
+
29
+
30
+ ## [2.1.7](https://github.com/antvis/L7/compare/v2.1.6...v2.1.7) (2020-03-26)
31
+
32
+ **Note:** Version bump only for package @antv/l7-component
33
+
34
+
35
+
36
+
37
+
38
+ ## [2.1.5](https://github.com/antvis/L7/compare/v2.1.4...v2.1.5) (2020-03-20)
39
+
40
+ **Note:** Version bump only for package @antv/l7-component
41
+
42
+
43
+
44
+
45
+
46
+ ## [2.1.3](https://github.com/antvis/L7/compare/v2.0.36...v2.1.3) (2020-03-17)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * mapbox 光照问题 ([20d2a6d](https://github.com/antvis/L7/commit/20d2a6d8b803ca3ad87cc1ef69a59d1e3d348cef))
52
+
53
+
54
+
55
+
56
+
57
+ ## [2.1.2](https://github.com/antvis/L7/compare/v2.0.36...v2.1.2) (2020-03-15)
58
+
59
+
60
+ ### Bug Fixes
61
+
62
+ * mapbox 光照问题 ([20d2a6d](https://github.com/antvis/L7/commit/20d2a6d8b803ca3ad87cc1ef69a59d1e3d348cef))
63
+
64
+
65
+
66
+
67
+
68
+ ## [2.1.1](https://github.com/antvis/L7/compare/v2.0.36...v2.1.1) (2020-03-15)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * mapbox 光照问题 ([20d2a6d](https://github.com/antvis/L7/commit/20d2a6d8b803ca3ad87cc1ef69a59d1e3d348cef))
74
+
75
+
76
+
77
+
78
+
79
+ ## [2.0.34](https://github.com/antvis/L7/compare/v2.0.32...v2.0.34) (2020-03-02)
80
+
81
+ **Note:** Version bump only for package @antv/l7-component
82
+
83
+
84
+
85
+
86
+
87
+ # [2.0.0-beta.28](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.28) (2020-01-02)
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
93
+
94
+
95
+ ### Features
96
+
97
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
98
+
99
+
100
+
101
+
102
+
103
+ # [2.0.0-beta.27](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.27) (2020-01-01)
104
+
105
+
106
+ ### Bug Fixes
107
+
108
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
109
+
110
+
111
+ ### Features
112
+
113
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
114
+
115
+
116
+
117
+
118
+
119
+ # [2.0.0-alpha.28](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-alpha.28) (2020-01-01)
120
+
121
+
122
+ ### Bug Fixes
123
+
124
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
125
+
126
+
127
+ ### Features
128
+
129
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
130
+
131
+
132
+
133
+
134
+
135
+ # [2.0.0-alpha.27](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-alpha.27) (2019-12-31)
136
+
137
+
138
+ ### Bug Fixes
139
+
140
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
141
+
142
+
143
+ ### Features
144
+
145
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
146
+
147
+
148
+
149
+
150
+
151
+ # [2.0.0-beta.26](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.26) (2019-12-30)
152
+
153
+
154
+ ### Bug Fixes
155
+
156
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
157
+
158
+
159
+ ### Features
160
+
161
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
162
+
163
+
164
+
165
+
166
+
167
+ # [2.0.0-beta.25](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.25) (2019-12-27)
168
+
169
+
170
+ ### Bug Fixes
171
+
172
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
173
+
174
+
175
+ ### Features
176
+
177
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
178
+
179
+
180
+
181
+
182
+
183
+ # [2.0.0-beta.24](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.24) (2019-12-23)
184
+
185
+
186
+ ### Bug Fixes
187
+
188
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
189
+
190
+
191
+ ### Features
192
+
193
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
194
+
195
+
196
+
197
+
198
+
199
+ # [2.0.0-beta.23](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.23) (2019-12-23)
200
+
201
+
202
+ ### Bug Fixes
203
+
204
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
205
+
206
+
207
+ ### Features
208
+
209
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
210
+
211
+
212
+
213
+
214
+
215
+ # [2.0.0-beta.21](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.21) (2019-12-18)
216
+
217
+
218
+ ### Bug Fixes
219
+
220
+ * merge master fix conflict ([652e5d1](https://github.com/antvis/L7/commit/652e5d1cafc350fe98d569f32bf6c592c6a79b89))
221
+
222
+
223
+ ### Features
224
+
225
+ * **layer:** add setSelect setActive 方法 & refactor color util ([5c27d66](https://github.com/antvis/L7/commit/5c27d66a6401192f5e0406a2f4c3e0983dc2867c))
226
+
227
+
228
+
229
+
230
+
231
+ # [2.0.0-beta.20](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.20) (2019-12-12)
232
+
233
+ **Note:** Version bump only for package @antv/l7-component
234
+
235
+
236
+
237
+
238
+
239
+ # [2.0.0-beta.19](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.19) (2019-12-08)
240
+
241
+ **Note:** Version bump only for package @antv/l7-component
242
+
243
+
244
+
245
+
246
+
247
+ # [2.0.0-beta.18](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.18) (2019-12-08)
248
+
249
+ **Note:** Version bump only for package @antv/l7-component
250
+
251
+
252
+
253
+
254
+
255
+ # [2.0.0-beta.17](https://github.com/antvis/L7/compare/v2.0.0-beta.16...v2.0.0-beta.17) (2019-12-08)
256
+
257
+ **Note:** Version bump only for package @antv/l7-component
258
+
259
+
260
+
261
+
262
+
263
+ # [2.0.0-beta.16](https://github.com/antvis/L7/compare/v2.0.0-beta.15...v2.0.0-beta.16) (2019-11-29)
264
+
265
+ **Note:** Version bump only for package @antv/l7-component
266
+
267
+
268
+
269
+
270
+
271
+ # [2.0.0-beta.15](https://github.com/antvis/L7/compare/v2.0.0-beta.14...v2.0.0-beta.15) (2019-11-29)
272
+
273
+
274
+ ### Bug Fixes
275
+
276
+ * **control:** lint error ([c863d7c](https://github.com/antvis/L7/commit/c863d7c8d15e560e3dfaf39d0ea3fac3242d776a))
277
+ * **map:** temporarily closed amap offset coordinate ([9a20f64](https://github.com/antvis/L7/commit/9a20f6480321c9297ff27fe4cfe6af9032fcb969))
278
+
279
+
280
+
281
+
282
+
283
+ # [2.0.0-beta.13](https://github.com/antvis/L7/compare/v2.0.0-beta.12...v2.0.0-beta.13) (2019-11-28)
284
+
285
+ **Note:** Version bump only for package @antv/l7-component
286
+
287
+
288
+
289
+
290
+
291
+ # [2.0.0-beta.12](https://github.com/antvis/L7/compare/v2.0.0-beta.11...v2.0.0-beta.12) (2019-11-28)
292
+
293
+
294
+ ### Bug Fixes
295
+
296
+ * **component:** fix marker ([14d4818](https://github.com/antvis/L7/commit/14d48184a1579241b077110ed51a8358de25e010))
297
+
298
+
299
+
300
+
301
+
302
+ # 2.0.0-beta.11 (2019-11-28)
303
+
304
+
305
+ ### Bug Fixes
306
+
307
+ * **doc:** file name lowercase ([3cbdc9c](https://github.com/antvis/L7/commit/3cbdc9c7f1d9be34e9c917f05531323946993eb4))
308
+ * **fix confilict:** conflict ([8a09ae2](https://github.com/antvis/L7/commit/8a09ae24bef7ba845e5b16759b3ecac210e472c5))
309
+ * **fix css:** fix css png ([f7e5376](https://github.com/antvis/L7/commit/f7e5376b7d6c64b2b078dca8f2a230f4fce14c68))
310
+ * **fix css:** fix css png ([da604e2](https://github.com/antvis/L7/commit/da604e266f36b70fcc7faa23fa7fe3359d3a1318))
311
+ * **layerservice:** fix init bugs in layer service ([8cbbf7b](https://github.com/antvis/L7/commit/8cbbf7b28d63f4df16f061a4ae21726f243e7108))
312
+ * **layerservice:** fix init bugs in layer service ([8844243](https://github.com/antvis/L7/commit/8844243050f619b28043c4e9ed1942fe172f561e))
313
+ * **merge:** fix conflict ([07e8505](https://github.com/antvis/L7/commit/07e85059ebd40506623253feb624ee3083f393ae))
314
+ * **merge branch:** fix confilt ([e7a46a6](https://github.com/antvis/L7/commit/e7a46a691d9e67a03d733fd565c6b152ee8715b6))
315
+ * **rm cache:** rm cache ([51ea07e](https://github.com/antvis/L7/commit/51ea07ea664229f775b7c191cfde68299cc8c2d5))
316
+ * **site:** megre conflict ([1b5619b](https://github.com/antvis/L7/commit/1b5619b3945e97919e0c616a48ba2265a2a95c22))
317
+
318
+
319
+ ### Features
320
+
321
+ * **chart:** add chart demo ([2a19b07](https://github.com/antvis/L7/commit/2a19b07c1bca7dfbf191618f15ab06a18c262148))
322
+ * **component:** add layer control ([7f4646e](https://github.com/antvis/L7/commit/7f4646efd3b0004fde4e9f6860e618c7668af1a7))
323
+ * **component:** add scale ,zoom, popup, marker map method ([a6baef4](https://github.com/antvis/L7/commit/a6baef4954c11d9c6582c27de2ba667f18538460))
324
+ * **demo:** add point chart demo ([8c2e4a8](https://github.com/antvis/L7/commit/8c2e4a82bf7a49b29004d5e261d8e9c46cd0bd9d))
325
+ * **map:** adjust Scene API, use @antv/l7-maps instead ([77b8f21](https://github.com/antvis/L7/commit/77b8f21b0bcf8b06e88d8e0bef213935bf32b957)), closes [#86](https://github.com/antvis/L7/issues/86)
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Alipay.inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ import { IControlOption, IControlService, ILayerService, IMapService, IRendererService, PositionType } from '@antv/l7-core';
2
+ import { EventEmitter } from 'eventemitter3';
3
+ import { Container } from 'inversify';
4
+ export { PositionType } from '@antv/l7-core';
5
+ export default class Control extends EventEmitter {
6
+ controlOption: IControlOption;
7
+ protected container: HTMLElement;
8
+ protected sceneContainer: Container;
9
+ protected mapsService: IMapService;
10
+ protected renderService: IRendererService;
11
+ protected layerService: ILayerService;
12
+ protected controlService: IControlService;
13
+ private isShow;
14
+ constructor(cfg?: Partial<IControlOption>);
15
+ getDefault(): {
16
+ position: PositionType;
17
+ name: string;
18
+ };
19
+ setPosition(position?: PositionType): this;
20
+ addTo(sceneContainer: Container): this;
21
+ onAdd(): HTMLElement;
22
+ onRemove(): void;
23
+ hide(): void;
24
+ show(): void;
25
+ remove(): this | undefined;
26
+ _refocusOnMap(e: MouseEvent): void;
27
+ }
@@ -0,0 +1,155 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12
+
13
+ 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); }; }
14
+
15
+ 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; } }
16
+
17
+ import { PositionType, TYPES } from '@antv/l7-core';
18
+ import { DOM } from '@antv/l7-utils';
19
+ import { EventEmitter } from 'eventemitter3';
20
+ export { PositionType } from '@antv/l7-core';
21
+ var controlId = 0;
22
+
23
+ var Control = function (_EventEmitter) {
24
+ _inherits(Control, _EventEmitter);
25
+
26
+ var _super = _createSuper(Control);
27
+
28
+ function Control(cfg) {
29
+ var _this;
30
+
31
+ _classCallCheck(this, Control);
32
+
33
+ _this = _super.call(this);
34
+
35
+ _defineProperty(_assertThisInitialized(_this), "controlOption", void 0);
36
+
37
+ _defineProperty(_assertThisInitialized(_this), "container", void 0);
38
+
39
+ _defineProperty(_assertThisInitialized(_this), "sceneContainer", void 0);
40
+
41
+ _defineProperty(_assertThisInitialized(_this), "mapsService", void 0);
42
+
43
+ _defineProperty(_assertThisInitialized(_this), "renderService", void 0);
44
+
45
+ _defineProperty(_assertThisInitialized(_this), "layerService", void 0);
46
+
47
+ _defineProperty(_assertThisInitialized(_this), "controlService", void 0);
48
+
49
+ _defineProperty(_assertThisInitialized(_this), "isShow", void 0);
50
+
51
+ _this.controlOption = _objectSpread(_objectSpread({}, _this.getDefault()), cfg || {});
52
+ return _this;
53
+ }
54
+
55
+ _createClass(Control, [{
56
+ key: "getDefault",
57
+ value: function getDefault() {
58
+ return {
59
+ position: PositionType.TOPRIGHT,
60
+ name: "".concat(controlId++)
61
+ };
62
+ }
63
+ }, {
64
+ key: "setPosition",
65
+ value: function setPosition() {
66
+ var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PositionType.BOTTOMRIGHT;
67
+ var controlService = this.controlService;
68
+
69
+ if (controlService) {
70
+ controlService.removeControl(this);
71
+ }
72
+
73
+ this.controlOption.position = position;
74
+
75
+ if (controlService) {
76
+ controlService.addControl(this, this.sceneContainer);
77
+ }
78
+
79
+ return this;
80
+ }
81
+ }, {
82
+ key: "addTo",
83
+ value: function addTo(sceneContainer) {
84
+ this.mapsService = sceneContainer.get(TYPES.IMapService);
85
+ this.renderService = sceneContainer.get(TYPES.IRendererService);
86
+ this.layerService = sceneContainer.get(TYPES.ILayerService);
87
+ this.controlService = sceneContainer.get(TYPES.IControlService);
88
+ this.sceneContainer = sceneContainer;
89
+ this.isShow = true;
90
+ this.container = this.onAdd();
91
+ var container = this.container;
92
+ var pos = this.controlOption.position;
93
+ var corner = this.controlService.controlCorners[pos];
94
+ DOM.addClass(container, 'l7-control');
95
+
96
+ if (pos.indexOf('bottom') !== -1) {
97
+ corner.insertBefore(container, corner.firstChild);
98
+ } else {
99
+ corner.appendChild(container);
100
+ }
101
+
102
+ return this;
103
+ }
104
+ }, {
105
+ key: "onAdd",
106
+ value: function onAdd() {
107
+ throw new Error('Method not implemented.');
108
+ }
109
+ }, {
110
+ key: "onRemove",
111
+ value: function onRemove() {
112
+ throw new Error('Method not implemented.');
113
+ }
114
+ }, {
115
+ key: "hide",
116
+ value: function hide() {
117
+ var container = this.container;
118
+ DOM.addClass(container, 'l7-control-hide');
119
+ this.isShow = false;
120
+ }
121
+ }, {
122
+ key: "show",
123
+ value: function show() {
124
+ var container = this.container;
125
+ DOM.removeClass(container, 'l7-control-hide');
126
+ this.isShow = true;
127
+ }
128
+ }, {
129
+ key: "remove",
130
+ value: function remove() {
131
+ if (!this.mapsService) {
132
+ return this;
133
+ }
134
+
135
+ DOM.remove(this.container);
136
+ this.onRemove();
137
+ }
138
+ }, {
139
+ key: "_refocusOnMap",
140
+ value: function _refocusOnMap(e) {
141
+ if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
142
+ var container = this.mapsService.getContainer();
143
+
144
+ if (container !== null) {
145
+ container.focus();
146
+ }
147
+ }
148
+ }
149
+ }]);
150
+
151
+ return Control;
152
+ }(EventEmitter);
153
+
154
+ export { Control as default };
155
+ //# sourceMappingURL=BaseControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/control/BaseControl.ts"],"names":["PositionType","TYPES","DOM","EventEmitter","controlId","Control","cfg","controlOption","getDefault","position","TOPRIGHT","name","BOTTOMRIGHT","controlService","removeControl","addControl","sceneContainer","mapsService","get","IMapService","renderService","IRendererService","layerService","ILayerService","IControlService","isShow","container","onAdd","pos","corner","controlCorners","addClass","indexOf","insertBefore","firstChild","appendChild","Error","removeClass","remove","onRemove","e","screenX","screenY","getContainer","focus"],"mappings":"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","sourcesContent":["import {\n IControlOption,\n IControlService,\n ILayerService,\n IMapService,\n IRendererService,\n PositionType,\n TYPES,\n} from '@antv/l7-core';\nimport { DOM } from '@antv/l7-utils';\nimport { EventEmitter } from 'eventemitter3';\nimport { Container } from 'inversify';\n\nexport { PositionType } from '@antv/l7-core';\n\nlet controlId = 0;\nexport default class Control extends EventEmitter {\n public controlOption: IControlOption;\n protected container: HTMLElement;\n protected sceneContainer: Container;\n protected mapsService: IMapService;\n protected renderService: IRendererService;\n protected layerService: ILayerService;\n protected controlService: IControlService;\n\n private isShow: boolean;\n\n constructor(cfg?: Partial<IControlOption>) {\n super();\n this.controlOption = {\n ...this.getDefault(),\n ...(cfg || {}),\n };\n }\n\n public getDefault() {\n return {\n position: PositionType.TOPRIGHT,\n name: `${controlId++}`,\n };\n }\n\n public setPosition(position: PositionType = PositionType.BOTTOMRIGHT) {\n // 考虑组件的自动布局,需要销毁重建\n const controlService = this.controlService;\n if (controlService) {\n controlService.removeControl(this);\n }\n this.controlOption.position = position;\n if (controlService) {\n controlService.addControl(this, this.sceneContainer);\n }\n return this;\n }\n public addTo(sceneContainer: Container) {\n this.mapsService = sceneContainer.get<IMapService>(TYPES.IMapService);\n this.renderService = sceneContainer.get<IRendererService>(\n TYPES.IRendererService,\n );\n this.layerService = sceneContainer.get<ILayerService>(TYPES.ILayerService);\n this.controlService = sceneContainer.get<IControlService>(\n TYPES.IControlService,\n );\n this.sceneContainer = sceneContainer;\n this.isShow = true;\n this.container = this.onAdd();\n const container = this.container;\n const pos = this.controlOption.position;\n const corner = this.controlService.controlCorners[pos];\n DOM.addClass(container, 'l7-control');\n\n if (pos.indexOf('bottom') !== -1) {\n corner.insertBefore(container, corner.firstChild);\n } else {\n corner.appendChild(container);\n }\n return this;\n }\n public onAdd(): HTMLElement {\n throw new Error('Method not implemented.');\n }\n\n public onRemove(): void {\n throw new Error('Method not implemented.');\n }\n public hide() {\n const container = this.container;\n DOM.addClass(container, 'l7-control-hide');\n this.isShow = false;\n }\n public show() {\n const container = this.container;\n DOM.removeClass(container, 'l7-control-hide');\n this.isShow = true;\n }\n public remove() {\n if (!this.mapsService) {\n return this;\n }\n DOM.remove(this.container);\n this.onRemove();\n }\n public _refocusOnMap(e: MouseEvent) {\n // if map exists and event is not a keyboard event\n if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {\n const container = this.mapsService.getContainer();\n if (container !== null) {\n container.focus();\n }\n }\n }\n}\n"],"file":"BaseControl.js"}
@@ -0,0 +1,44 @@
1
+ import { IControlOption, PositionType } from '@antv/l7-core';
2
+ import Control from './BaseControl';
3
+ export interface ILayerControlOption extends IControlOption {
4
+ collapsed: boolean;
5
+ autoZIndex: boolean;
6
+ hideSingleBase: boolean;
7
+ sortLayers: boolean;
8
+ sortFunction: (...args: any[]) => any;
9
+ }
10
+ export default class Layers extends Control {
11
+ private layerControlInputs;
12
+ private layers;
13
+ private lastZIndex;
14
+ private handlingClick;
15
+ private layersLink;
16
+ private baseLayersList;
17
+ private separator;
18
+ private overlaysList;
19
+ private form;
20
+ constructor(cfg: Partial<ILayerControlOption>);
21
+ getDefault(): {
22
+ collapsed: boolean;
23
+ position: PositionType;
24
+ autoZIndex: boolean;
25
+ hideSingleBase: boolean;
26
+ sortLayers: boolean;
27
+ name: string;
28
+ };
29
+ onAdd(): HTMLElement;
30
+ addVisualLayer(layer: any, name: string | number): this;
31
+ expand(): this;
32
+ collapse(): this;
33
+ onRemove(): void;
34
+ private initLayout;
35
+ private initLayers;
36
+ private update;
37
+ private checkDisabledLayers;
38
+ private addLayer;
39
+ private expandIfNotCollapsed;
40
+ private onLayerChange;
41
+ private createRadioElement;
42
+ private addItem;
43
+ private onInputClick;
44
+ }