@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/marker.js CHANGED
@@ -1,307 +1,449 @@
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/marker.ts
20
- var marker_exports = {};
21
- __export(marker_exports, {
22
- default: () => Marker
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
23
7
  });
24
- module.exports = __toCommonJS(marker_exports);
25
- var import_l7_core = require("@antv/l7-core");
26
- var import_l7_utils = require("@antv/l7-utils");
27
- var import_eventemitter3 = require("eventemitter3");
28
- var Marker = class extends import_eventemitter3.EventEmitter {
29
- constructor(option) {
30
- super();
31
- this.added = false;
32
- this.eventHandle = (e) => {
33
- this.emit(e.type, {
8
+ exports.default = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _l7Core = require("@antv/l7-core");
27
+
28
+ var _l7Utils = require("@antv/l7-utils");
29
+
30
+ var _eventemitter = require("eventemitter3");
31
+
32
+ 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); }; }
33
+
34
+ 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; } }
35
+
36
+ // marker 支持 dragger 未完成
37
+ var Marker = /*#__PURE__*/function (_EventEmitter) {
38
+ (0, _inherits2.default)(Marker, _EventEmitter);
39
+
40
+ var _super = _createSuper(Marker);
41
+
42
+ function Marker(option) {
43
+ var _this;
44
+
45
+ (0, _classCallCheck2.default)(this, Marker);
46
+ _this = _super.call(this);
47
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "added", false);
48
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventHandle", function (e) {
49
+ _this.emit(e.type, {
34
50
  target: e,
35
- data: this.markerOption.extData,
36
- lngLat: this.lngLat
51
+ data: _this.markerOption.extData,
52
+ lngLat: _this.lngLat
37
53
  });
38
- };
39
- this.markerOption = {
40
- ...this.getDefault(),
41
- ...option
42
- };
43
- (0, import_l7_utils.bindAll)(["update", "onMove", "onUp", "addDragHandler", "onMapClick"], this);
44
- this.init();
45
- }
46
- getMarkerLayerContainerSize() {
47
- }
48
- getDefault() {
49
- return {
50
- element: void 0,
51
- anchor: import_l7_utils.anchorType.BOTTOM,
52
- offsets: [0, 0],
53
- color: "#5B8FF9",
54
- draggable: false
55
- };
56
- }
57
- addTo(scene) {
58
- this.scene = scene;
59
- this.mapsService = scene.get(import_l7_core.TYPES.IMapService);
60
- this.sceneSerive = scene.get(import_l7_core.TYPES.ISceneService);
61
- const { element } = this.markerOption;
62
- this.mapsService.getMarkerContainer().appendChild(element);
63
- this.registerMarkerEvent(element);
64
- this.mapsService.on("camerachange", this.update);
65
- this.mapsService.on("viewchange", this.update);
66
- this.update();
67
- this.added = true;
68
- this.emit("added");
69
- return this;
54
+ });
55
+ _this.markerOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault()), option);
56
+ (0, _l7Utils.bindAll)(['update', 'onMove', 'onUp', 'addDragHandler', 'onMapClick'], (0, _assertThisInitialized2.default)(_this));
57
+
58
+ _this.init();
59
+
60
+ return _this;
70
61
  }
71
- remove() {
72
- if (this.mapsService) {
73
- this.mapsService.off("click", this.onMapClick);
74
- this.mapsService.off("move", this.update);
75
- this.mapsService.off("moveend", this.update);
76
- this.mapsService.off("mousedown", this.addDragHandler);
77
- this.mapsService.off("touchstart", this.addDragHandler);
78
- this.mapsService.off("mouseup", this.onUp);
79
- this.mapsService.off("touchend", this.onUp);
62
+
63
+ (0, _createClass2.default)(Marker, [{
64
+ key: "getMarkerLayerContainerSize",
65
+ value: function getMarkerLayerContainerSize() {}
66
+ }, {
67
+ key: "getDefault",
68
+ value: function getDefault() {
69
+ return {
70
+ element: undefined,
71
+ // DOM element
72
+ anchor: _l7Utils.anchorType.BOTTOM,
73
+ offsets: [0, 0],
74
+ color: '#5B8FF9',
75
+ draggable: false
76
+ };
80
77
  }
81
- this.unRegisterMarkerEvent();
82
- this.removeAllListeners();
83
- const { element } = this.markerOption;
84
- if (element) {
85
- import_l7_utils.DOM.remove(element);
78
+ }, {
79
+ key: "addTo",
80
+ value: function addTo(scene) {
81
+ // this.remove();
82
+ this.scene = scene;
83
+ this.mapsService = scene.get(_l7Core.TYPES.IMapService);
84
+ this.sceneSerive = scene.get(_l7Core.TYPES.ISceneService);
85
+ var element = this.markerOption.element; // this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
86
+
87
+ this.mapsService.getMarkerContainer().appendChild(element);
88
+ this.registerMarkerEvent(element);
89
+ this.mapsService.on('camerachange', this.update); // 注册高德1.x 的地图事件监听
90
+
91
+ this.mapsService.on('viewchange', this.update); // 注册高德2.0 的地图事件监听
92
+
93
+ this.update();
94
+ this.added = true;
95
+ this.emit('added');
96
+ return this;
86
97
  }
87
- if (this.popup) {
88
- this.popup.remove();
98
+ }, {
99
+ key: "remove",
100
+ value: function remove() {
101
+ if (this.mapsService) {
102
+ this.mapsService.off('click', this.onMapClick);
103
+ this.mapsService.off('move', this.update);
104
+ this.mapsService.off('moveend', this.update);
105
+ this.mapsService.off('mousedown', this.addDragHandler);
106
+ this.mapsService.off('touchstart', this.addDragHandler);
107
+ this.mapsService.off('mouseup', this.onUp);
108
+ this.mapsService.off('touchend', this.onUp);
109
+ }
110
+
111
+ this.unRegisterMarkerEvent();
112
+ this.removeAllListeners();
113
+ var element = this.markerOption.element;
114
+
115
+ if (element) {
116
+ _l7Utils.DOM.remove(element);
117
+ }
118
+
119
+ if (this.popup) {
120
+ this.popup.remove();
121
+ }
122
+
123
+ return this;
89
124
  }
90
- return this;
91
- }
92
- setLnglat(lngLat) {
93
- this.lngLat = lngLat;
94
- if (Array.isArray(lngLat)) {
95
- this.lngLat = {
96
- lng: lngLat[0],
97
- lat: lngLat[1]
98
- };
125
+ }, {
126
+ key: "setLnglat",
127
+ value: function setLnglat(lngLat) {
128
+ this.lngLat = lngLat;
129
+
130
+ if (Array.isArray(lngLat)) {
131
+ this.lngLat = {
132
+ lng: lngLat[0],
133
+ lat: lngLat[1]
134
+ };
135
+ }
136
+
137
+ if (this.popup) {
138
+ this.popup.setLnglat(this.lngLat);
139
+ }
140
+
141
+ this.update();
142
+ return this;
99
143
  }
100
- if (this.popup) {
101
- this.popup.setLnglat(this.lngLat);
144
+ }, {
145
+ key: "getLnglat",
146
+ value: function getLnglat() {
147
+ return this.lngLat;
102
148
  }
103
- this.update();
104
- return this;
105
- }
106
- getLnglat() {
107
- return this.lngLat;
108
- }
109
- getElement() {
110
- return this.markerOption.element;
111
- }
112
- setElement(el) {
113
- if (!this.added) {
114
- this.once("added", () => {
115
- this.setElement(el);
116
- });
149
+ }, {
150
+ key: "getElement",
151
+ value: function getElement() {
152
+ return this.markerOption.element;
153
+ }
154
+ }, {
155
+ key: "setElement",
156
+ value: function setElement(el) {
157
+ var _this2 = this;
158
+
159
+ if (!this.added) {
160
+ this.once('added', function () {
161
+ _this2.setElement(el);
162
+ });
163
+ return this;
164
+ }
165
+
166
+ var element = this.markerOption.element;
167
+
168
+ if (element) {
169
+ _l7Utils.DOM.remove(element);
170
+ }
171
+
172
+ this.markerOption.element = el;
173
+ this.init();
174
+ this.mapsService.getMarkerContainer().appendChild(el);
175
+ this.registerMarkerEvent(el);
176
+ this.update();
117
177
  return this;
118
178
  }
119
- const { element } = this.markerOption;
120
- if (element) {
121
- import_l7_utils.DOM.remove(element);
179
+ }, {
180
+ key: "openPopup",
181
+ value: function openPopup() {
182
+ var _this3 = this;
183
+
184
+ if (!this.added) {
185
+ this.once('added', function () {
186
+ _this3.openPopup();
187
+ });
188
+ return this;
189
+ }
190
+
191
+ var popup = this.popup;
192
+
193
+ if (!popup) {
194
+ return this;
195
+ }
196
+
197
+ if (!popup.isOpen()) {
198
+ popup.addTo(this.scene);
199
+ }
200
+
201
+ return this;
122
202
  }
123
- this.markerOption.element = el;
124
- this.init();
125
- this.mapsService.getMarkerContainer().appendChild(el);
126
- this.registerMarkerEvent(el);
127
- this.update();
128
- return this;
129
- }
130
- openPopup() {
131
- if (!this.added) {
132
- this.once("added", () => {
133
- this.openPopup();
134
- });
203
+ }, {
204
+ key: "closePopup",
205
+ value: function closePopup() {
206
+ var _this4 = this;
207
+
208
+ if (!this.added) {
209
+ this.once('added', function () {
210
+ _this4.closePopup();
211
+ });
212
+ }
213
+
214
+ var popup = this.popup;
215
+
216
+ if (popup) {
217
+ popup.remove();
218
+ }
219
+
135
220
  return this;
136
221
  }
137
- const popup = this.popup;
138
- if (!popup) {
222
+ }, {
223
+ key: "setPopup",
224
+ value: function setPopup(popup) {
225
+ this.popup = popup;
226
+
227
+ if (this.lngLat) {
228
+ this.popup.setLnglat(this.lngLat);
229
+ }
230
+
139
231
  return this;
140
232
  }
141
- if (!popup.isOpen()) {
142
- popup.addTo(this.scene);
233
+ }, {
234
+ key: "togglePopup",
235
+ value: function togglePopup() {
236
+ var popup = this.popup;
237
+
238
+ if (!popup) {
239
+ return this;
240
+ } else if (popup.isOpen()) {
241
+ popup.remove();
242
+ } else {
243
+ popup.addTo(this.scene);
244
+ }
245
+
246
+ return this;
143
247
  }
144
- return this;
145
- }
146
- closePopup() {
147
- if (!this.added) {
148
- this.once("added", () => {
149
- this.closePopup();
150
- });
248
+ }, {
249
+ key: "getPopup",
250
+ value: function getPopup() {
251
+ return this.popup;
151
252
  }
152
- const popup = this.popup;
153
- if (popup) {
154
- popup.remove();
253
+ }, {
254
+ key: "getOffset",
255
+ value: function getOffset() {
256
+ return this.markerOption.offsets;
257
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
258
+
259
+ }, {
260
+ key: "setDraggable",
261
+ value: function setDraggable(draggable) {
262
+ throw new Error('Method not implemented.');
155
263
  }
156
- return this;
157
- }
158
- setPopup(popup) {
159
- this.popup = popup;
160
- if (this.lngLat) {
161
- this.popup.setLnglat(this.lngLat);
264
+ }, {
265
+ key: "isDraggable",
266
+ value: function isDraggable() {
267
+ return this.markerOption.draggable;
162
268
  }
163
- return this;
164
- }
165
- togglePopup() {
166
- const popup = this.popup;
167
- if (!popup) {
168
- return this;
169
- } else if (popup.isOpen()) {
170
- popup.remove();
171
- } else {
172
- popup.addTo(this.scene);
269
+ }, {
270
+ key: "getExtData",
271
+ value: function getExtData() {
272
+ return this.markerOption.extData;
173
273
  }
174
- return this;
175
- }
176
- getPopup() {
177
- return this.popup;
178
- }
179
- getOffset() {
180
- return this.markerOption.offsets;
181
- }
182
- setDraggable(draggable) {
183
- throw new Error("Method not implemented.");
184
- }
185
- isDraggable() {
186
- return this.markerOption.draggable;
187
- }
188
- getExtData() {
189
- return this.markerOption.extData;
190
- }
191
- setExtData(data) {
192
- this.markerOption.extData = data;
193
- }
194
- update() {
195
- if (!this.mapsService) {
196
- return;
274
+ }, {
275
+ key: "setExtData",
276
+ value: function setExtData(data) {
277
+ this.markerOption.extData = data;
197
278
  }
198
- const { element, anchor } = this.markerOption;
199
- this.updatePosition();
200
- import_l7_utils.DOM.setTransform(element, `${import_l7_utils.anchorTranslate[anchor]}`);
201
- }
202
- onMapClick(e) {
203
- const { element } = this.markerOption;
204
- if (this.popup && element) {
205
- this.togglePopup();
279
+ }, {
280
+ key: "update",
281
+ value: function update() {
282
+ if (!this.mapsService) {
283
+ return;
284
+ }
285
+
286
+ var _this$markerOption = this.markerOption,
287
+ element = _this$markerOption.element,
288
+ anchor = _this$markerOption.anchor;
289
+ this.updatePosition();
290
+
291
+ _l7Utils.DOM.setTransform(element, "".concat(_l7Utils.anchorTranslate[anchor]));
292
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
293
+
294
+ }, {
295
+ key: "onMapClick",
296
+ value: function onMapClick(e) {
297
+ var element = this.markerOption.element;
298
+
299
+ if (this.popup && element) {
300
+ this.togglePopup();
301
+ }
206
302
  }
207
- }
208
- getCurrentContainerSize() {
209
- const container = this.mapsService.getContainer();
210
- return {
211
- containerHeight: (container == null ? void 0 : container.scrollHeight) || 0,
212
- containerWidth: (container == null ? void 0 : container.scrollWidth) || 0,
213
- bounds: this.mapsService.getBounds()
214
- };
215
- }
216
- updatePosition() {
217
- if (!this.mapsService) {
218
- return;
303
+ }, {
304
+ key: "getCurrentContainerSize",
305
+ value: function getCurrentContainerSize() {
306
+ var container = this.mapsService.getContainer();
307
+ return {
308
+ containerHeight: (container === null || container === void 0 ? void 0 : container.scrollHeight) || 0,
309
+ containerWidth: (container === null || container === void 0 ? void 0 : container.scrollWidth) || 0,
310
+ bounds: this.mapsService.getBounds()
311
+ };
219
312
  }
220
- const { element, offsets } = this.markerOption;
221
- const { lng, lat } = this.lngLat;
222
- const pos = this.mapsService.lngLatToContainer([lng, lat]);
223
- if (element) {
224
- element.style.display = "block";
225
- element.style.whiteSpace = "nowrap";
226
- const { containerHeight, containerWidth, bounds } = this.getMarkerLayerContainerSize() || this.getCurrentContainerSize();
227
- if (!bounds)
313
+ }, {
314
+ key: "updatePosition",
315
+ value: function updatePosition() {
316
+ if (!this.mapsService) {
228
317
  return;
229
- if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
230
- if (pos.x > containerWidth) {
231
- const newPos = this.mapsService.lngLatToContainer([lng - 360, lat]);
232
- pos.x = newPos.x;
233
- }
234
- if (pos.x < 0) {
235
- const newPos = this.mapsService.lngLatToContainer([lng + 360, lat]);
236
- pos.x = newPos.x;
318
+ }
319
+
320
+ var _this$markerOption2 = this.markerOption,
321
+ element = _this$markerOption2.element,
322
+ offsets = _this$markerOption2.offsets;
323
+ var _this$lngLat = this.lngLat,
324
+ lng = _this$lngLat.lng,
325
+ lat = _this$lngLat.lat;
326
+ var pos = this.mapsService.lngLatToContainer([lng, lat]);
327
+
328
+ if (element) {
329
+ element.style.display = 'block';
330
+ element.style.whiteSpace = 'nowrap';
331
+
332
+ var _ref = this.getMarkerLayerContainerSize() || this.getCurrentContainerSize(),
333
+ containerHeight = _ref.containerHeight,
334
+ containerWidth = _ref.containerWidth,
335
+ bounds = _ref.bounds;
336
+
337
+ if (!bounds) return; // 当前可视区域包含跨日界线
338
+
339
+ if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
340
+ if (pos.x > containerWidth) {
341
+ // 日界线右侧点左移
342
+ var newPos = this.mapsService.lngLatToContainer([lng - 360, lat]);
343
+ pos.x = newPos.x;
344
+ }
345
+
346
+ if (pos.x < 0) {
347
+ // 日界线左侧点右移
348
+ var _newPos = this.mapsService.lngLatToContainer([lng + 360, lat]);
349
+
350
+ pos.x = _newPos.x;
351
+ }
352
+ } // 不在当前可视区域内隐藏点
353
+
354
+
355
+ if (pos.x > containerWidth || pos.x < 0 || pos.y > containerHeight || pos.y < 0) {
356
+ element.style.display = 'none';
237
357
  }
358
+
359
+ element.style.left = pos.x + offsets[0] + 'px';
360
+ element.style.top = pos.y - offsets[1] + 'px';
238
361
  }
239
- if (pos.x > containerWidth || pos.x < 0 || pos.y > containerHeight || pos.y < 0) {
240
- element.style.display = "none";
362
+ }
363
+ }, {
364
+ key: "init",
365
+ value: function init() {
366
+ var _this5 = this;
367
+
368
+ var element = this.markerOption.element;
369
+ var _this$markerOption3 = this.markerOption,
370
+ color = _this$markerOption3.color,
371
+ anchor = _this$markerOption3.anchor;
372
+
373
+ if (!element) {
374
+ this.defaultMarker = true;
375
+ element = _l7Utils.DOM.create('div');
376
+ this.markerOption.element = element;
377
+ var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
378
+ svg.setAttributeNS(null, 'display', 'block');
379
+ svg.setAttributeNS(null, 'height', '48px');
380
+ svg.setAttributeNS(null, 'width', '48px');
381
+ svg.setAttributeNS(null, 'viewBox', '0 0 1024 1024');
382
+ var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
383
+ path.setAttributeNS(null, 'd', 'M512 490.666667C453.12 490.666667 405.333333 442.88 405.333333 384 405.333333 325.12 453.12 277.333333 512 277.333333 570.88 277.333333 618.666667 325.12 618.666667 384 618.666667 442.88 570.88 490.666667 512 490.666667M512 85.333333C346.88 85.333333 213.333333 218.88 213.333333 384 213.333333 608 512 938.666667 512 938.666667 512 938.666667 810.666667 608 810.666667 384 810.666667 218.88 677.12 85.333333 512 85.333333Z');
384
+ path.setAttributeNS(null, 'fill', color);
385
+ svg.appendChild(path);
386
+ element.appendChild(svg);
241
387
  }
242
- element.style.left = pos.x + offsets[0] + "px";
243
- element.style.top = pos.y - offsets[1] + "px";
388
+
389
+ _l7Utils.DOM.addClass(element, 'l7-marker');
390
+
391
+ Object.keys(this.markerOption.style || {}).forEach( // @ts-ignore
392
+ function (key) {
393
+ var _this5$markerOption, _this5$markerOption2;
394
+
395
+ var value = ((_this5$markerOption = _this5.markerOption) === null || _this5$markerOption === void 0 ? void 0 : _this5$markerOption.style) && ((_this5$markerOption2 = _this5.markerOption) === null || _this5$markerOption2 === void 0 ? void 0 : _this5$markerOption2.style[key]);
396
+
397
+ if (element) {
398
+ // @ts-ignore
399
+ element.style[key] = value;
400
+ }
401
+ });
402
+ element.addEventListener('click', function (e) {
403
+ _this5.onMapClick(e);
404
+ });
405
+ element.addEventListener('click', this.eventHandle);
406
+ (0, _l7Utils.applyAnchorClass)(element, anchor, 'marker');
244
407
  }
245
- }
246
- init() {
247
- let { element } = this.markerOption;
248
- const { color, anchor } = this.markerOption;
249
- if (!element) {
250
- this.defaultMarker = true;
251
- element = import_l7_utils.DOM.create("div");
252
- this.markerOption.element = element;
253
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
254
- svg.setAttributeNS(null, "display", "block");
255
- svg.setAttributeNS(null, "height", "48px");
256
- svg.setAttributeNS(null, "width", "48px");
257
- svg.setAttributeNS(null, "viewBox", "0 0 1024 1024");
258
- const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
259
- path.setAttributeNS(null, "d", "M512 490.666667C453.12 490.666667 405.333333 442.88 405.333333 384 405.333333 325.12 453.12 277.333333 512 277.333333 570.88 277.333333 618.666667 325.12 618.666667 384 618.666667 442.88 570.88 490.666667 512 490.666667M512 85.333333C346.88 85.333333 213.333333 218.88 213.333333 384 213.333333 608 512 938.666667 512 938.666667 512 938.666667 810.666667 608 810.666667 384 810.666667 218.88 677.12 85.333333 512 85.333333Z");
260
- path.setAttributeNS(null, "fill", color);
261
- svg.appendChild(path);
262
- element.appendChild(svg);
408
+ }, {
409
+ key: "registerMarkerEvent",
410
+ value: function registerMarkerEvent(element) {
411
+ element.addEventListener('mousemove', this.eventHandle);
412
+ element.addEventListener('click', this.eventHandle);
413
+ element.addEventListener('mousedown', this.eventHandle);
414
+ element.addEventListener('mouseup', this.eventHandle);
415
+ element.addEventListener('dblclick', this.eventHandle);
416
+ element.addEventListener('contextmenu', this.eventHandle);
417
+ element.addEventListener('mouseover', this.eventHandle);
418
+ element.addEventListener('mouseout', this.eventHandle);
263
419
  }
264
- import_l7_utils.DOM.addClass(element, "l7-marker");
265
- Object.keys(this.markerOption.style || {}).forEach((key) => {
266
- var _a, _b;
267
- const value = ((_a = this.markerOption) == null ? void 0 : _a.style) && ((_b = this.markerOption) == null ? void 0 : _b.style[key]);
268
- if (element) {
269
- element.style[key] = value;
270
- }
271
- });
272
- element.addEventListener("click", (e) => {
273
- this.onMapClick(e);
274
- });
275
- element.addEventListener("click", this.eventHandle);
276
- (0, import_l7_utils.applyAnchorClass)(element, anchor, "marker");
277
- }
278
- registerMarkerEvent(element) {
279
- element.addEventListener("mousemove", this.eventHandle);
280
- element.addEventListener("click", this.eventHandle);
281
- element.addEventListener("mousedown", this.eventHandle);
282
- element.addEventListener("mouseup", this.eventHandle);
283
- element.addEventListener("dblclick", this.eventHandle);
284
- element.addEventListener("contextmenu", this.eventHandle);
285
- element.addEventListener("mouseover", this.eventHandle);
286
- element.addEventListener("mouseout", this.eventHandle);
287
- }
288
- unRegisterMarkerEvent() {
289
- const element = this.getElement();
290
- element.removeEventListener("mousemove", this.eventHandle);
291
- element.removeEventListener("click", this.eventHandle);
292
- element.removeEventListener("mousedown", this.eventHandle);
293
- element.removeEventListener("mouseup", this.eventHandle);
294
- element.removeEventListener("dblclick", this.eventHandle);
295
- element.removeEventListener("contextmenu", this.eventHandle);
296
- element.removeEventListener("mouseover", this.eventHandle);
297
- element.removeEventListener("mouseout", this.eventHandle);
298
- }
299
- addDragHandler(e) {
300
- throw new Error("Method not implemented.");
301
- }
302
- onUp(e) {
303
- throw new Error("Method not implemented.");
304
- }
305
- };
306
- // Annotate the CommonJS export names for ESM import in node:
307
- 0 && (module.exports = {});
420
+ }, {
421
+ key: "unRegisterMarkerEvent",
422
+ value: function unRegisterMarkerEvent() {
423
+ var element = this.getElement();
424
+ element.removeEventListener('mousemove', this.eventHandle);
425
+ element.removeEventListener('click', this.eventHandle);
426
+ element.removeEventListener('mousedown', this.eventHandle);
427
+ element.removeEventListener('mouseup', this.eventHandle);
428
+ element.removeEventListener('dblclick', this.eventHandle);
429
+ element.removeEventListener('contextmenu', this.eventHandle);
430
+ element.removeEventListener('mouseover', this.eventHandle);
431
+ element.removeEventListener('mouseout', this.eventHandle);
432
+ }
433
+ }, {
434
+ key: "addDragHandler",
435
+ value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
436
+ function addDragHandler(e) {
437
+ throw new Error('Method not implemented.');
438
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
439
+
440
+ }, {
441
+ key: "onUp",
442
+ value: function onUp(e) {
443
+ throw new Error('Method not implemented.');
444
+ }
445
+ }]);
446
+ return Marker;
447
+ }(_eventemitter.EventEmitter);
448
+
449
+ exports.default = Marker;