@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.
Files changed (34) hide show
  1. package/es/control/baseControl/buttonControl.d.ts +1 -1
  2. package/es/control/baseControl/control.d.ts +4 -5
  3. package/es/control/baseControl/control.js +18 -5
  4. package/es/control/baseControl/popperControl.d.ts +1 -1
  5. package/es/control/baseControl/selectControl.d.ts +2 -2
  6. package/es/control/baseControl/selectControl.js +5 -0
  7. package/es/control/zoom.d.ts +3 -2
  8. package/lib/assets/iconfont/iconfont.js +46 -30
  9. package/lib/constants/index.js +34 -56
  10. package/lib/control/baseControl/buttonControl.js +194 -105
  11. package/lib/control/baseControl/control.js +317 -156
  12. package/lib/control/baseControl/index.js +57 -22
  13. package/lib/control/baseControl/popperControl.js +136 -102
  14. package/lib/control/baseControl/selectControl.js +230 -130
  15. package/lib/control/exportImage.js +175 -81
  16. package/lib/control/fullscreen.js +157 -102
  17. package/lib/control/geoLocate.js +143 -67
  18. package/lib/control/layerControl.js +162 -116
  19. package/lib/control/logo.js +101 -70
  20. package/lib/control/mapTheme.js +144 -85
  21. package/lib/control/mouseLocation.js +112 -71
  22. package/lib/control/scale.js +180 -127
  23. package/lib/control/zoom.js +154 -111
  24. package/lib/index.js +251 -48
  25. package/lib/interface.js +4 -16
  26. package/lib/marker-layer.js +367 -249
  27. package/lib/marker.js +419 -277
  28. package/lib/popup/layerPopup.js +305 -188
  29. package/lib/popup/popup.js +602 -339
  30. package/lib/utils/anchor.js +37 -55
  31. package/lib/utils/icon.js +13 -32
  32. package/lib/utils/popper.js +268 -180
  33. package/lib/utils/screenfull.js +110 -103
  34. package/package.json +5 -5
@@ -1,74 +1,105 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
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
- module.exports = __toCommonJS(logo_exports);
26
- var import_l7_utils = require("@antv/l7-utils");
27
- var import_baseControl = require("./baseControl");
28
- var Logo = class extends import_baseControl.Control {
29
- getDefault() {
30
- return {
31
- position: import_baseControl.PositionType.BOTTOMLEFT,
32
- name: "logo",
33
- href: "https://l7.antv.vision/",
34
- img: "https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ"
35
- };
36
- }
37
- onAdd() {
38
- const container = import_l7_utils.DOM.create("div", "l7-control-logo");
39
- this.setLogoContent(container);
40
- return container;
41
- }
42
- onRemove() {
43
- return null;
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
- setOptions(option) {
46
- super.setOptions(option);
47
- if (this.checkUpdateOption(option, ["img", "href"])) {
48
- import_l7_utils.DOM.clearChildren(this.container);
49
- this.setLogoContent(this.container);
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
- setLogoContent(container) {
53
- const { href, img } = this.controlOption;
54
- const imgDOM = import_l7_utils.DOM.create("img");
55
- imgDOM.setAttribute("src", img);
56
- imgDOM.setAttribute("aria-label", "AntV logo");
57
- import_l7_utils.DOM.setUnDraggable(imgDOM);
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
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- Logo
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;
@@ -1,92 +1,151 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- module.exports = __toCommonJS(mapTheme_exports);
29
- var import_constants = require("../constants");
30
- var import_icon = require("../utils/icon");
31
- var import_selectControl = __toESM(require("./baseControl/selectControl"));
32
- var MapTheme = class extends import_selectControl.default {
33
- constructor() {
34
- super(...arguments);
35
- this.onMapThemeChange = () => {
36
- this.mapsService.setMapStyle(this.selectValue[0]);
37
- };
38
- }
39
- getDefault(option) {
40
- return {
41
- ...super.getDefault(option),
42
- title: "\u5730\u56FE\u6837\u5F0F",
43
- btnIcon: (0, import_icon.createL7Icon)("l7-icon-color"),
44
- options: []
45
- };
46
- }
47
- getStyleOptions() {
48
- const mapStyleConfig = this.mapsService.getType() === "mapbox" ? import_constants.MapboxMapStyleConfig : import_constants.GaodeMapStyleConfig;
49
- return Object.entries(this.mapsService.getMapStyleConfig()).filter(([key, value]) => typeof value === "string" && key !== "blank").map(([key, value]) => {
50
- const { text, img } = mapStyleConfig[key] ?? {};
51
- return {
52
- text: text ?? key,
53
- value,
54
- img,
55
- key
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
- getMapStyle() {
60
- return this.mapsService.getMapStyle();
61
- }
62
- onAdd() {
63
- var _a, _b;
64
- if (!((_a = this.controlOption.options) == null ? void 0 : _a.length)) {
65
- this.controlOption.options = this.getStyleOptions();
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
- if (this.controlOption.defaultValue) {
68
- const defaultValue = this.controlOption.defaultValue;
69
- this.controlOption.defaultValue = ((_b = this.controlOption.options.find((item) => item.key === defaultValue)) == null ? void 0 : _b.value) ?? defaultValue;
70
- } else {
71
- const defaultStyle = this.getMapStyle();
72
- if (defaultStyle) {
73
- this.controlOption.defaultValue = defaultStyle;
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.mapsService.map.once("styledata", () => {
76
- const mapboxStyle = this.mapsService.getMapStyle();
77
- this.controlOption.defaultValue = mapboxStyle;
78
- this.setSelectValue(mapboxStyle, false);
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
- this.on("selectChange", this.onMapThemeChange);
83
- return super.onAdd();
84
- }
85
- getIsMultiple() {
86
- return false;
87
- }
88
- };
89
- // Annotate the CommonJS export names for ESM import in node:
90
- 0 && (module.exports = {
91
- MapTheme
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
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- module.exports = __toCommonJS(mouseLocation_exports);
29
- var import_l7_core = require("@antv/l7-core");
30
- var import_l7_utils = require("@antv/l7-utils");
31
- var import_control = __toESM(require("./baseControl/control"));
32
- var MouseLocation = class extends import_control.default {
33
- constructor() {
34
- super(...arguments);
35
- this.location = [0, 0];
36
- this.onMouseMove = (e) => {
37
- let position = this.location;
38
- const lngLat = e.lngLat || e.lnglat;
39
- const { transform } = this.controlOption;
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
- this.location = position;
64
+
65
+ _this.location = position;
66
+
44
67
  if (transform) {
45
68
  position = transform(position);
46
69
  }
47
- this.insertLocation2HTML(position);
48
- this.emit("locationChange", position);
49
- };
50
- }
51
- getLocation() {
52
- return this.location;
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 = "&nbsp;";
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
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- MouseLocation
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 = '&nbsp;';
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;