@antv/l7-component 2.9.32 → 2.9.34
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/lib/control/BaseControl.js +150 -100
- package/lib/control/layer.js +341 -248
- package/lib/control/logo.js +76 -52
- package/lib/control/scale.js +162 -112
- package/lib/control/zoom.js +137 -95
- package/lib/index.js +136 -53
- package/lib/interface.js +4 -16
- package/lib/marker-layer.js +367 -249
- package/lib/marker.js +419 -277
- package/lib/popup.js +302 -201
- package/lib/utils/anchor.js +37 -55
- package/package.json +5 -5
|
@@ -1,110 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "PositionType", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _l7Core.PositionType;
|
|
14
12
|
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/control/BaseControl.ts
|
|
20
|
-
var BaseControl_exports = {};
|
|
21
|
-
__export(BaseControl_exports, {
|
|
22
|
-
PositionType: () => import_l7_core2.PositionType,
|
|
23
|
-
default: () => Control
|
|
24
13
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
var
|
|
14
|
+
exports.default = void 0;
|
|
15
|
+
|
|
16
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
|
+
|
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
20
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _l7Core = require("@antv/l7-core");
|
|
29
|
+
|
|
30
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
31
|
+
|
|
32
|
+
var _eventemitter = require("eventemitter3");
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
35
|
+
|
|
36
|
+
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; } }
|
|
37
|
+
|
|
30
38
|
var controlId = 0;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
var Control = /*#__PURE__*/function (_EventEmitter) {
|
|
41
|
+
(0, _inherits2.default)(Control, _EventEmitter);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(Control);
|
|
44
|
+
|
|
45
|
+
function Control(cfg) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2.default)(this, Control);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
_this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault()), cfg || {});
|
|
51
|
+
return _this;
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
|
|
54
|
+
(0, _createClass2.default)(Control, [{
|
|
55
|
+
key: "getDefault",
|
|
56
|
+
value: function getDefault() {
|
|
57
|
+
return {
|
|
58
|
+
position: _l7Core.PositionType.TOPRIGHT,
|
|
59
|
+
name: "".concat(controlId++)
|
|
60
|
+
};
|
|
53
61
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
}, {
|
|
63
|
+
key: "setPosition",
|
|
64
|
+
value: function setPosition() {
|
|
65
|
+
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _l7Core.PositionType.BOTTOMRIGHT;
|
|
66
|
+
// 考虑组件的自动布局,需要销毁重建
|
|
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;
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
}, {
|
|
82
|
+
key: "addTo",
|
|
83
|
+
value: function addTo(sceneContainer) {
|
|
84
|
+
this.mapsService = sceneContainer.get(_l7Core.TYPES.IMapService);
|
|
85
|
+
this.renderService = sceneContainer.get(_l7Core.TYPES.IRendererService);
|
|
86
|
+
this.layerService = sceneContainer.get(_l7Core.TYPES.ILayerService);
|
|
87
|
+
this.controlService = sceneContainer.get(_l7Core.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
|
+
|
|
95
|
+
_l7Utils.DOM.addClass(container, 'l7-control');
|
|
96
|
+
|
|
97
|
+
if (pos.indexOf('bottom') !== -1) {
|
|
98
|
+
corner.insertBefore(container, corner.firstChild);
|
|
99
|
+
} else {
|
|
100
|
+
corner.appendChild(container);
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
return this;
|
|
94
104
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
}, {
|
|
106
|
+
key: "onAdd",
|
|
107
|
+
value: function onAdd() {
|
|
108
|
+
throw new Error('Method not implemented.');
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "onRemove",
|
|
112
|
+
value: function onRemove() {
|
|
113
|
+
throw new Error('Method not implemented.');
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "hide",
|
|
117
|
+
value: function hide() {
|
|
118
|
+
var container = this.container;
|
|
119
|
+
|
|
120
|
+
_l7Utils.DOM.addClass(container, 'l7-control-hide');
|
|
121
|
+
|
|
122
|
+
this.isShow = false;
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "show",
|
|
126
|
+
value: function show() {
|
|
127
|
+
var container = this.container;
|
|
128
|
+
|
|
129
|
+
_l7Utils.DOM.removeClass(container, 'l7-control-hide');
|
|
130
|
+
|
|
131
|
+
this.isShow = true;
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "remove",
|
|
135
|
+
value: function remove() {
|
|
136
|
+
if (!this.mapsService) {
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
_l7Utils.DOM.remove(this.container);
|
|
141
|
+
|
|
142
|
+
this.onRemove();
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "_refocusOnMap",
|
|
146
|
+
value: function _refocusOnMap(e) {
|
|
147
|
+
// if map exists and event is not a keyboard event
|
|
148
|
+
if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
|
|
149
|
+
var container = this.mapsService.getContainer();
|
|
150
|
+
|
|
151
|
+
if (container !== null) {
|
|
152
|
+
container.focus();
|
|
153
|
+
}
|
|
103
154
|
}
|
|
104
155
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
156
|
+
}]);
|
|
157
|
+
return Control;
|
|
158
|
+
}(_eventemitter.EventEmitter);
|
|
159
|
+
|
|
160
|
+
exports.default = Control;
|