@antv/l7-component 2.13.8 → 2.13.9
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/marker.d.ts +6 -0
- package/es/marker.js +30 -3
- package/lib/marker.js +29 -2
- package/package.json +6 -6
package/es/marker.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ export default class Marker extends EventEmitter {
|
|
|
44
44
|
private registerMarkerEvent;
|
|
45
45
|
private unRegisterMarkerEvent;
|
|
46
46
|
private eventHandle;
|
|
47
|
+
/**
|
|
48
|
+
* 高德 2.x 使用了 fastClick.js 避免延迟,导致 IOS 移动端的 click 事件不会正常触发,需要手动触发
|
|
49
|
+
* @param e
|
|
50
|
+
*/
|
|
51
|
+
private touchStartTime;
|
|
52
|
+
private polyfillEvent;
|
|
47
53
|
private addDragHandler;
|
|
48
54
|
private onUp;
|
|
49
55
|
}
|
package/es/marker.js
CHANGED
|
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
14
|
import { TYPES } from '@antv/l7-core';
|
|
15
|
-
import { anchorTranslate, anchorType, applyAnchorClass, bindAll, DOM } from '@antv/l7-utils';
|
|
15
|
+
import { anchorTranslate, anchorType, applyAnchorClass, bindAll, DOM, isiOS, isPC } from '@antv/l7-utils';
|
|
16
16
|
import { EventEmitter } from 'eventemitter3';
|
|
17
17
|
|
|
18
18
|
// marker 支持 dragger 未完成
|
|
@@ -31,6 +31,8 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
31
31
|
_defineProperty(_assertThisInitialized(_this), "added", false);
|
|
32
32
|
|
|
33
33
|
_defineProperty(_assertThisInitialized(_this), "eventHandle", function (e) {
|
|
34
|
+
_this.polyfillEvent(e);
|
|
35
|
+
|
|
34
36
|
_this.emit(e.type, {
|
|
35
37
|
target: e,
|
|
36
38
|
data: _this.markerOption.extData,
|
|
@@ -403,6 +405,8 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
403
405
|
element.addEventListener('contextmenu', this.eventHandle);
|
|
404
406
|
element.addEventListener('mouseover', this.eventHandle);
|
|
405
407
|
element.addEventListener('mouseout', this.eventHandle);
|
|
408
|
+
element.addEventListener('touchstart', this.eventHandle);
|
|
409
|
+
element.addEventListener('touchend', this.eventHandle);
|
|
406
410
|
}
|
|
407
411
|
}, {
|
|
408
412
|
key: "unRegisterMarkerEvent",
|
|
@@ -416,11 +420,34 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
416
420
|
element.removeEventListener('contextmenu', this.eventHandle);
|
|
417
421
|
element.removeEventListener('mouseover', this.eventHandle);
|
|
418
422
|
element.removeEventListener('mouseout', this.eventHandle);
|
|
423
|
+
element.removeEventListener('touchstart', this.eventHandle);
|
|
424
|
+
element.removeEventListener('touchend', this.eventHandle);
|
|
419
425
|
}
|
|
426
|
+
}, {
|
|
427
|
+
key: "polyfillEvent",
|
|
428
|
+
value: function polyfillEvent(e) {
|
|
429
|
+
if (!this.mapsService || this.mapsService.version !== 'GAODE2.x') {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (!isPC() && isiOS) {
|
|
434
|
+
if (e.type === 'touchstart') {
|
|
435
|
+
this.touchStartTime = Date.now();
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (e.type === 'touchend' && Date.now() - this.touchStartTime < 300) {
|
|
439
|
+
this.emit('click', {
|
|
440
|
+
target: e,
|
|
441
|
+
data: this.markerOption.extData,
|
|
442
|
+
lngLat: this.lngLat
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
447
|
+
|
|
420
448
|
}, {
|
|
421
449
|
key: "addDragHandler",
|
|
422
|
-
value:
|
|
423
|
-
function addDragHandler(e) {
|
|
450
|
+
value: function addDragHandler(e) {
|
|
424
451
|
return null;
|
|
425
452
|
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
426
453
|
|
package/lib/marker.js
CHANGED
|
@@ -46,6 +46,8 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
46
46
|
_this = _super.call(this);
|
|
47
47
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "added", false);
|
|
48
48
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventHandle", function (e) {
|
|
49
|
+
_this.polyfillEvent(e);
|
|
50
|
+
|
|
49
51
|
_this.emit(e.type, {
|
|
50
52
|
target: e,
|
|
51
53
|
data: _this.markerOption.extData,
|
|
@@ -419,6 +421,8 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
419
421
|
element.addEventListener('contextmenu', this.eventHandle);
|
|
420
422
|
element.addEventListener('mouseover', this.eventHandle);
|
|
421
423
|
element.addEventListener('mouseout', this.eventHandle);
|
|
424
|
+
element.addEventListener('touchstart', this.eventHandle);
|
|
425
|
+
element.addEventListener('touchend', this.eventHandle);
|
|
422
426
|
}
|
|
423
427
|
}, {
|
|
424
428
|
key: "unRegisterMarkerEvent",
|
|
@@ -432,11 +436,34 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
432
436
|
element.removeEventListener('contextmenu', this.eventHandle);
|
|
433
437
|
element.removeEventListener('mouseover', this.eventHandle);
|
|
434
438
|
element.removeEventListener('mouseout', this.eventHandle);
|
|
439
|
+
element.removeEventListener('touchstart', this.eventHandle);
|
|
440
|
+
element.removeEventListener('touchend', this.eventHandle);
|
|
435
441
|
}
|
|
442
|
+
}, {
|
|
443
|
+
key: "polyfillEvent",
|
|
444
|
+
value: function polyfillEvent(e) {
|
|
445
|
+
if (!this.mapsService || this.mapsService.version !== 'GAODE2.x') {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (!(0, _l7Utils.isPC)() && _l7Utils.isiOS) {
|
|
450
|
+
if (e.type === 'touchstart') {
|
|
451
|
+
this.touchStartTime = Date.now();
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (e.type === 'touchend' && Date.now() - this.touchStartTime < 300) {
|
|
455
|
+
this.emit('click', {
|
|
456
|
+
target: e,
|
|
457
|
+
data: this.markerOption.extData,
|
|
458
|
+
lngLat: this.lngLat
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
463
|
+
|
|
436
464
|
}, {
|
|
437
465
|
key: "addDragHandler",
|
|
438
|
-
value:
|
|
439
|
-
function addDragHandler(e) {
|
|
466
|
+
value: function addDragHandler(e) {
|
|
440
467
|
return null;
|
|
441
468
|
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
442
469
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"author": "lzxue",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@antv/l7-core": "2.13.
|
|
30
|
-
"@antv/l7-utils": "2.13.
|
|
29
|
+
"@antv/l7-core": "2.13.9",
|
|
30
|
+
"@antv/l7-utils": "2.13.9",
|
|
31
31
|
"@babel/runtime": "^7.7.7",
|
|
32
32
|
"eventemitter3": "^4.0.0",
|
|
33
33
|
"inversify": "^5.0.1",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"supercluster": "^7.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@antv/l7-layers": "2.13.
|
|
40
|
-
"@antv/l7-test-utils": "2.13.
|
|
39
|
+
"@antv/l7-layers": "2.13.9",
|
|
40
|
+
"@antv/l7-test-utils": "2.13.9",
|
|
41
41
|
"gcoord": "^0.3.2",
|
|
42
42
|
"less": "^4.1.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "be693790ae71475ad104c301aaa119ab0a059bd5",
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
}
|