@antv/l7-core
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -11,2 +11,5 @@ import EventEmitter from 'eventemitter3'; | ||
private hammertime; | ||
private lastClickTime; | ||
private lastClickXY; | ||
private clickTimer; | ||
init(): void; | ||
@@ -13,0 +16,0 @@ destroy(): void; |
@@ -39,2 +39,5 @@ import _initializerDefineProperty from "@babel/runtime/helpers/initializerDefineProperty"; | ||
_this.hammertime = void 0; | ||
_this.lastClickTime = 0; | ||
_this.lastClickXY = [-1, -1]; | ||
_this.clickTimer = void 0; | ||
@@ -59,2 +62,39 @@ _this.onHover = function (_ref) { | ||
if (type === 'click') { | ||
var nowTime = new Date().getTime(); | ||
if (nowTime - _this.lastClickTime < 500 && Math.abs(_this.lastClickXY[0] - x) < 10 && Math.abs(_this.lastClickXY[1] - y) < 10) { | ||
_this.lastClickTime = 0; | ||
_this.lastClickXY = [-1, -1]; | ||
if (_this.clickTimer) { | ||
clearTimeout(_this.clickTimer); | ||
} | ||
type = 'dblclick'; | ||
_this.emit(InteractionEvent.Hover, { | ||
x: x, | ||
y: y, | ||
lngLat: lngLat, | ||
type: type | ||
}); | ||
} else { | ||
_this.lastClickTime = nowTime; | ||
_this.lastClickXY = [x, y]; | ||
_this.clickTimer = setTimeout(function () { | ||
type = 'click'; | ||
_this.emit(InteractionEvent.Hover, { | ||
x: x, | ||
y: y, | ||
lngLat: lngLat, | ||
type: type | ||
}); | ||
}, 500); | ||
} | ||
return; | ||
} | ||
_this.emit(InteractionEvent.Hover, { | ||
@@ -127,3 +167,2 @@ x: x, | ||
$containter.addEventListener('mouseup', this.onHover); | ||
$containter.addEventListener('dblclick', this.onHover); | ||
$containter.addEventListener('contextmenu', this.onHover); | ||
@@ -144,3 +183,2 @@ this.hammertime = hammertime; | ||
$containter.removeEventListener('mouseup', this.onHover); | ||
$containter.removeEventListener('dblclick', this.onHover); | ||
$containter.removeEventListener('contextmenu', this.onHover); | ||
@@ -147,0 +185,0 @@ } |
@@ -58,2 +58,5 @@ "use strict"; | ||
_this.hammertime = void 0; | ||
_this.lastClickTime = 0; | ||
_this.lastClickXY = [-1, -1]; | ||
_this.clickTimer = void 0; | ||
@@ -78,2 +81,39 @@ _this.onHover = function (_ref) { | ||
if (type === 'click') { | ||
var nowTime = new Date().getTime(); | ||
if (nowTime - _this.lastClickTime < 500 && Math.abs(_this.lastClickXY[0] - x) < 10 && Math.abs(_this.lastClickXY[1] - y) < 10) { | ||
_this.lastClickTime = 0; | ||
_this.lastClickXY = [-1, -1]; | ||
if (_this.clickTimer) { | ||
clearTimeout(_this.clickTimer); | ||
} | ||
type = 'dblclick'; | ||
_this.emit(_IInteractionService.InteractionEvent.Hover, { | ||
x: x, | ||
y: y, | ||
lngLat: lngLat, | ||
type: type | ||
}); | ||
} else { | ||
_this.lastClickTime = nowTime; | ||
_this.lastClickXY = [x, y]; | ||
_this.clickTimer = setTimeout(function () { | ||
type = 'click'; | ||
_this.emit(_IInteractionService.InteractionEvent.Hover, { | ||
x: x, | ||
y: y, | ||
lngLat: lngLat, | ||
type: type | ||
}); | ||
}, 500); | ||
} | ||
return; | ||
} | ||
_this.emit(_IInteractionService.InteractionEvent.Hover, { | ||
@@ -146,3 +186,2 @@ x: x, | ||
$containter.addEventListener('mouseup', this.onHover); | ||
$containter.addEventListener('dblclick', this.onHover); | ||
$containter.addEventListener('contextmenu', this.onHover); | ||
@@ -163,3 +202,2 @@ this.hammertime = hammertime; | ||
$containter.removeEventListener('mouseup', this.onHover); | ||
$containter.removeEventListener('dblclick', this.onHover); | ||
$containter.removeEventListener('contextmenu', this.onHover); | ||
@@ -166,0 +204,0 @@ } |
{ | ||
"name": "@antv/l7-core", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@antv/l7-utils": "^2.0.11", | ||
"@antv/l7-utils": "^2.0.12", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -50,3 +50,3 @@ "@mapbox/tiny-sdf": "^1.1.1", | ||
}, | ||
"gitHead": "6579611559625a33bf991dc13f42d79fdc9aba76", | ||
"gitHead": "7073793d181e464ef2ea65c361c025e2448f1cd9", | ||
"publishConfig": { | ||
@@ -53,0 +53,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1283054
14012
Updated@antv/l7-utils@^2.0.12