@antv/l7-component 2.9.32-alpha.4 → 2.9.32-alpha.5
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/control/baseControl/buttonControl.d.ts +1 -1
- package/es/control/baseControl/control.d.ts +4 -5
- package/es/control/baseControl/control.js +18 -5
- package/es/control/baseControl/popperControl.d.ts +1 -1
- package/es/control/baseControl/selectControl.d.ts +2 -2
- package/es/control/baseControl/selectControl.js +5 -0
- package/es/control/zoom.d.ts +3 -2
- package/lib/assets/iconfont/iconfont.js +46 -30
- package/lib/constants/index.js +34 -56
- package/lib/control/baseControl/buttonControl.js +194 -105
- package/lib/control/baseControl/control.js +317 -156
- package/lib/control/baseControl/index.js +57 -22
- package/lib/control/baseControl/popperControl.js +136 -102
- package/lib/control/baseControl/selectControl.js +230 -130
- package/lib/control/exportImage.js +175 -81
- package/lib/control/fullscreen.js +157 -102
- package/lib/control/geoLocate.js +143 -67
- package/lib/control/layerControl.js +162 -116
- package/lib/control/logo.js +101 -70
- package/lib/control/mapTheme.js +144 -85
- package/lib/control/mouseLocation.js +112 -71
- package/lib/control/scale.js +180 -127
- package/lib/control/zoom.js +154 -111
- package/lib/index.js +251 -48
- package/lib/interface.js +4 -16
- package/lib/marker-layer.js +367 -249
- package/lib/marker.js +419 -277
- package/lib/popup/layerPopup.js +305 -188
- package/lib/popup/popup.js +602 -339
- package/lib/utils/anchor.js +37 -55
- package/lib/utils/icon.js +13 -32
- package/lib/utils/popper.js +268 -180
- package/lib/utils/screenfull.js +110 -103
- package/package.json +5 -5
package/lib/control/logo.js
CHANGED
|
@@ -1,74 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/control/logo.ts
|
|
20
|
-
var logo_exports = {};
|
|
21
|
-
__export(logo_exports, {
|
|
22
|
-
Logo: () => Logo,
|
|
23
|
-
default: () => Logo
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
24
7
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
8
|
+
exports.default = exports.Logo = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
23
|
+
|
|
24
|
+
var _baseControl = require("./baseControl");
|
|
25
|
+
|
|
26
|
+
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); }; }
|
|
27
|
+
|
|
28
|
+
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; } }
|
|
29
|
+
|
|
30
|
+
var Logo = /*#__PURE__*/function (_Control) {
|
|
31
|
+
(0, _inherits2.default)(Logo, _Control);
|
|
32
|
+
|
|
33
|
+
var _super = _createSuper(Logo);
|
|
34
|
+
|
|
35
|
+
function Logo() {
|
|
36
|
+
(0, _classCallCheck2.default)(this, Logo);
|
|
37
|
+
return _super.apply(this, arguments);
|
|
44
38
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
|
|
40
|
+
(0, _createClass2.default)(Logo, [{
|
|
41
|
+
key: "getDefault",
|
|
42
|
+
value: function getDefault() {
|
|
43
|
+
return {
|
|
44
|
+
position: _baseControl.PositionType.BOTTOMLEFT,
|
|
45
|
+
name: 'logo',
|
|
46
|
+
href: 'https://l7.antv.vision/',
|
|
47
|
+
img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ'
|
|
48
|
+
};
|
|
50
49
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (href) {
|
|
59
|
-
const anchorDOM = import_l7_utils.DOM.create("a", "l7-control-logo-link");
|
|
60
|
-
anchorDOM.target = "_blank";
|
|
61
|
-
anchorDOM.href = href;
|
|
62
|
-
anchorDOM.rel = "noopener nofollow";
|
|
63
|
-
anchorDOM.setAttribute("rel", "noopener nofollow");
|
|
64
|
-
anchorDOM.appendChild(imgDOM);
|
|
65
|
-
container.appendChild(anchorDOM);
|
|
66
|
-
} else {
|
|
67
|
-
container.appendChild(imgDOM);
|
|
50
|
+
}, {
|
|
51
|
+
key: "onAdd",
|
|
52
|
+
value: function onAdd() {
|
|
53
|
+
var container = _l7Utils.DOM.create('div', 'l7-control-logo');
|
|
54
|
+
|
|
55
|
+
this.setLogoContent(container);
|
|
56
|
+
return container;
|
|
68
57
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "onRemove",
|
|
60
|
+
value: function onRemove() {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "setOptions",
|
|
65
|
+
value: function setOptions(option) {
|
|
66
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(Logo.prototype), "setOptions", this).call(this, option);
|
|
67
|
+
|
|
68
|
+
if (this.checkUpdateOption(option, ['img', 'href'])) {
|
|
69
|
+
_l7Utils.DOM.clearChildren(this.container);
|
|
70
|
+
|
|
71
|
+
this.setLogoContent(this.container);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "setLogoContent",
|
|
76
|
+
value: function setLogoContent(container) {
|
|
77
|
+
var _this$controlOption = this.controlOption,
|
|
78
|
+
href = _this$controlOption.href,
|
|
79
|
+
img = _this$controlOption.img;
|
|
80
|
+
|
|
81
|
+
var imgDOM = _l7Utils.DOM.create('img');
|
|
82
|
+
|
|
83
|
+
imgDOM.setAttribute('src', img);
|
|
84
|
+
imgDOM.setAttribute('aria-label', 'AntV logo');
|
|
85
|
+
|
|
86
|
+
_l7Utils.DOM.setUnDraggable(imgDOM);
|
|
87
|
+
|
|
88
|
+
if (href) {
|
|
89
|
+
var anchorDOM = _l7Utils.DOM.create('a', 'l7-control-logo-link');
|
|
90
|
+
|
|
91
|
+
anchorDOM.target = '_blank';
|
|
92
|
+
anchorDOM.href = href;
|
|
93
|
+
anchorDOM.rel = 'noopener nofollow';
|
|
94
|
+
anchorDOM.setAttribute('rel', 'noopener nofollow');
|
|
95
|
+
anchorDOM.appendChild(imgDOM);
|
|
96
|
+
container.appendChild(anchorDOM);
|
|
97
|
+
} else {
|
|
98
|
+
container.appendChild(imgDOM);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
return Logo;
|
|
103
|
+
}(_baseControl.Control);
|
|
104
|
+
|
|
105
|
+
exports.default = exports.Logo = Logo;
|
package/lib/control/mapTheme.js
CHANGED
|
@@ -1,92 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/control/mapTheme.ts
|
|
23
|
-
var mapTheme_exports = {};
|
|
24
|
-
__export(mapTheme_exports, {
|
|
25
|
-
MapTheme: () => MapTheme,
|
|
26
|
-
default: () => MapTheme
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
8
|
+
exports.default = exports.MapTheme = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _constants = require("../constants");
|
|
31
|
+
|
|
32
|
+
var _icon = require("../utils/icon");
|
|
33
|
+
|
|
34
|
+
var _selectControl = _interopRequireDefault(require("./baseControl/selectControl"));
|
|
35
|
+
|
|
36
|
+
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); }; }
|
|
37
|
+
|
|
38
|
+
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; } }
|
|
39
|
+
|
|
40
|
+
var MapTheme = /*#__PURE__*/function (_SelectControl) {
|
|
41
|
+
(0, _inherits2.default)(MapTheme, _SelectControl);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(MapTheme);
|
|
44
|
+
|
|
45
|
+
function MapTheme() {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2.default)(this, MapTheme);
|
|
49
|
+
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMapThemeChange", function () {
|
|
56
|
+
_this.mapsService.setMapStyle(_this.selectValue[0]);
|
|
57
57
|
});
|
|
58
|
+
return _this;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
|
|
61
|
+
(0, _createClass2.default)(MapTheme, [{
|
|
62
|
+
key: "getDefault",
|
|
63
|
+
value: function getDefault(option) {
|
|
64
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(MapTheme.prototype), "getDefault", this).call(this, option)), {}, {
|
|
65
|
+
title: '地图样式',
|
|
66
|
+
btnIcon: (0, _icon.createL7Icon)('l7-icon-color'),
|
|
67
|
+
options: []
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "getStyleOptions",
|
|
72
|
+
value: function getStyleOptions() {
|
|
73
|
+
var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? _constants.MapboxMapStyleConfig : _constants.GaodeMapStyleConfig;
|
|
74
|
+
return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
|
|
75
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
76
|
+
key = _ref2[0],
|
|
77
|
+
value = _ref2[1];
|
|
78
|
+
|
|
79
|
+
return typeof value === 'string' && key !== 'blank';
|
|
80
|
+
}).map(function (_ref3) {
|
|
81
|
+
var _mapStyleConfig$key;
|
|
82
|
+
|
|
83
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
84
|
+
key = _ref4[0],
|
|
85
|
+
value = _ref4[1];
|
|
86
|
+
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
|
|
89
|
+
text = _ref5.text,
|
|
90
|
+
img = _ref5.img;
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
text: text !== null && text !== void 0 ? text : key,
|
|
94
|
+
value: value,
|
|
95
|
+
img: img,
|
|
96
|
+
key: key
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "getMapStyle",
|
|
102
|
+
value: function getMapStyle() {
|
|
103
|
+
return this.mapsService.getMapStyle();
|
|
66
104
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
105
|
+
}, {
|
|
106
|
+
key: "onAdd",
|
|
107
|
+
value: function onAdd() {
|
|
108
|
+
var _this$controlOption$o,
|
|
109
|
+
_this2 = this;
|
|
110
|
+
|
|
111
|
+
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
112
|
+
this.controlOption.options = this.getStyleOptions();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.controlOption.defaultValue) {
|
|
116
|
+
var _this$controlOption$o2, _this$controlOption$o3;
|
|
117
|
+
|
|
118
|
+
var defaultValue = this.controlOption.defaultValue;
|
|
119
|
+
this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
|
|
120
|
+
return item.key === defaultValue;
|
|
121
|
+
})) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
|
|
74
122
|
} else {
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.
|
|
79
|
-
}
|
|
123
|
+
var defaultStyle = this.getMapStyle();
|
|
124
|
+
|
|
125
|
+
if (defaultStyle) {
|
|
126
|
+
this.controlOption.defaultValue = defaultStyle;
|
|
127
|
+
} else {
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
this.mapsService.map.once('styledata', function () {
|
|
130
|
+
var mapboxStyle = _this2.mapsService.getMapStyle();
|
|
131
|
+
|
|
132
|
+
_this2.controlOption.defaultValue = mapboxStyle;
|
|
133
|
+
|
|
134
|
+
_this2.setSelectValue(mapboxStyle, false);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
80
137
|
}
|
|
138
|
+
|
|
139
|
+
this.on('selectChange', this.onMapThemeChange);
|
|
140
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(MapTheme.prototype), "onAdd", this).call(this);
|
|
81
141
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
142
|
+
}, {
|
|
143
|
+
key: "getIsMultiple",
|
|
144
|
+
value: function getIsMultiple() {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}]);
|
|
148
|
+
return MapTheme;
|
|
149
|
+
}(_selectControl.default);
|
|
150
|
+
|
|
151
|
+
exports.default = exports.MapTheme = MapTheme;
|
|
@@ -1,79 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/control/mouseLocation.ts
|
|
23
|
-
var mouseLocation_exports = {};
|
|
24
|
-
__export(mouseLocation_exports, {
|
|
25
|
-
MouseLocation: () => MouseLocation,
|
|
26
|
-
default: () => MouseLocation
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
8
|
+
exports.default = exports.MouseLocation = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _l7Core = require("@antv/l7-core");
|
|
31
|
+
|
|
32
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
33
|
+
|
|
34
|
+
var _control = _interopRequireDefault(require("./baseControl/control"));
|
|
35
|
+
|
|
36
|
+
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); }; }
|
|
37
|
+
|
|
38
|
+
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; } }
|
|
39
|
+
|
|
40
|
+
var MouseLocation = /*#__PURE__*/function (_Control) {
|
|
41
|
+
(0, _inherits2.default)(MouseLocation, _Control);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(MouseLocation);
|
|
44
|
+
|
|
45
|
+
function MouseLocation() {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2.default)(this, MouseLocation);
|
|
49
|
+
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "location", [0, 0]);
|
|
56
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseMove", function (e) {
|
|
57
|
+
var position = _this.location;
|
|
58
|
+
var lngLat = e.lngLat || e.lnglat;
|
|
59
|
+
var transform = _this.controlOption.transform;
|
|
60
|
+
|
|
40
61
|
if (lngLat) {
|
|
41
62
|
position = [lngLat.lng, lngLat.lat];
|
|
42
63
|
}
|
|
43
|
-
|
|
64
|
+
|
|
65
|
+
_this.location = position;
|
|
66
|
+
|
|
44
67
|
if (transform) {
|
|
45
68
|
position = transform(position);
|
|
46
69
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
getDefault(option) {
|
|
55
|
-
return {
|
|
56
|
-
...super.getDefault(option),
|
|
57
|
-
position: import_l7_core.PositionType.BOTTOMLEFT,
|
|
58
|
-
transform: ([lng, lat]) => {
|
|
59
|
-
return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
onAdd() {
|
|
64
|
-
const container = import_l7_utils.DOM.create("div", "l7-control-mouse-location");
|
|
65
|
-
container.innerHTML = " ";
|
|
66
|
-
this.mapsService.on("mousemove", this.onMouseMove);
|
|
67
|
-
return container;
|
|
68
|
-
}
|
|
69
|
-
onRemove() {
|
|
70
|
-
this.mapsService.off("mousemove", this.onMouseMove);
|
|
71
|
-
}
|
|
72
|
-
insertLocation2HTML(position) {
|
|
73
|
-
this.container.innerText = position.join(", ");
|
|
70
|
+
|
|
71
|
+
_this.insertLocation2HTML(position);
|
|
72
|
+
|
|
73
|
+
_this.emit('locationChange', position);
|
|
74
|
+
});
|
|
75
|
+
return _this;
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
|
|
78
|
+
(0, _createClass2.default)(MouseLocation, [{
|
|
79
|
+
key: "getLocation",
|
|
80
|
+
value: function getLocation() {
|
|
81
|
+
return this.location;
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "getDefault",
|
|
85
|
+
value: function getDefault(option) {
|
|
86
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(MouseLocation.prototype), "getDefault", this).call(this, option)), {}, {
|
|
87
|
+
position: _l7Core.PositionType.BOTTOMLEFT,
|
|
88
|
+
transform: function transform(_ref) {
|
|
89
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
90
|
+
lng = _ref2[0],
|
|
91
|
+
lat = _ref2[1];
|
|
92
|
+
|
|
93
|
+
return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "onAdd",
|
|
99
|
+
value: function onAdd() {
|
|
100
|
+
var container = _l7Utils.DOM.create('div', 'l7-control-mouse-location');
|
|
101
|
+
|
|
102
|
+
container.innerHTML = ' ';
|
|
103
|
+
this.mapsService.on('mousemove', this.onMouseMove);
|
|
104
|
+
return container;
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "onRemove",
|
|
108
|
+
value: function onRemove() {
|
|
109
|
+
this.mapsService.off('mousemove', this.onMouseMove);
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "insertLocation2HTML",
|
|
113
|
+
value: function insertLocation2HTML(position) {
|
|
114
|
+
this.container.innerText = position.join(', ');
|
|
115
|
+
}
|
|
116
|
+
}]);
|
|
117
|
+
return MouseLocation;
|
|
118
|
+
}(_control.default);
|
|
119
|
+
|
|
120
|
+
exports.default = exports.MouseLocation = MouseLocation;
|