Comparing version 3.4.0-beta.10 to 3.4.0-beta.11
@@ -9,3 +9,3 @@ var Util = require('../../util/index'); | ||
var preShape = null; | ||
var mousedown = null; | ||
var mousedownShape = null; | ||
var mousedownOffset = {}; | ||
@@ -94,5 +94,8 @@ var dragging = null; | ||
if (!dragging) { | ||
if (mousedown === shape) { | ||
var dx = mousedownOffset.x - e.clientX; | ||
var dy = mousedownOffset.y - e.clientY; | ||
if (mousedownShape === shape && dx * dx + dy * dy >= CLICK_OFFSET) { | ||
dragging = shape; | ||
mousedown = null; | ||
mousedownShape = null; | ||
@@ -126,3 +129,3 @@ this._emitEvent('dragstart', e, point, shape); | ||
if (!dragging && type === 'mousedown' && e.button === LEFT_BTN_CODE) { | ||
mousedown = shape; | ||
mousedownShape = shape; | ||
mousedownOffset = { | ||
@@ -135,6 +138,10 @@ x: e.clientX, | ||
if (type === 'mouseup' && e.button === LEFT_BTN_CODE) { | ||
var dist = (mousedownOffset.x - e.clientX) * (mousedownOffset.x - e.clientX) + (mousedownOffset.y - e.clientY) * (mousedownOffset.y - e.clientY); | ||
var _dx = mousedownOffset.x - e.clientX; | ||
var _dy = mousedownOffset.y - e.clientY; | ||
var dist = _dx * _dx + _dy * _dy; | ||
if (dist < CLICK_OFFSET) { | ||
this._emitEvent('click', e, point, mousedown || this); | ||
this._emitEvent('click', e, point, mousedownShape || this); | ||
} | ||
@@ -152,3 +159,3 @@ | ||
mousedown = null; | ||
mousedownShape = null; | ||
} | ||
@@ -155,0 +162,0 @@ } |
@@ -23,3 +23,3 @@ module.exports = { | ||
// version, etc. | ||
version: '3.4.0-beta.10' | ||
version: '3.4.0-beta.11' | ||
}; |
{ | ||
"name": "@antv/g", | ||
"version": "3.4.0-beta.10", | ||
"version": "3.4.0-beta.11", | ||
"description": "A canvas library which providing 2d draw for G2.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -19,3 +19,3 @@ const Util = require('../../util/index'); | ||
let preShape = null; | ||
let mousedown = null; | ||
let mousedownShape = null; | ||
let mousedownOffset = {}; | ||
@@ -101,5 +101,8 @@ let dragging = null; | ||
if (!dragging) { | ||
if (mousedown === shape) { | ||
const dx = mousedownOffset.x - e.clientX; | ||
const dy = mousedownOffset.y - e.clientY; | ||
if (mousedownShape === shape && | ||
dx * dx + dy * dy >= CLICK_OFFSET) { | ||
dragging = shape; | ||
mousedown = null; | ||
mousedownShape = null; | ||
this._emitEvent('dragstart', e, point, shape); | ||
@@ -126,10 +129,11 @@ } else { | ||
if (!dragging && type === 'mousedown' && e.button === LEFT_BTN_CODE) { | ||
mousedown = shape; | ||
mousedownShape = shape; | ||
mousedownOffset = { x: e.clientX, y: e.clientY }; | ||
} | ||
if (type === 'mouseup' && e.button === LEFT_BTN_CODE) { | ||
const dist = (mousedownOffset.x - e.clientX) * (mousedownOffset.x - e.clientX) + | ||
(mousedownOffset.y - e.clientY) * (mousedownOffset.y - e.clientY); | ||
const dx = mousedownOffset.x - e.clientX; | ||
const dy = mousedownOffset.y - e.clientY; | ||
const dist = dx * dx + dy * dy; | ||
if (dist < CLICK_OFFSET) { | ||
this._emitEvent('click', e, point, mousedown || this); | ||
this._emitEvent('click', e, point, mousedownShape || this); | ||
} | ||
@@ -142,3 +146,3 @@ if (dragging) { | ||
} | ||
mousedown = null; | ||
mousedownShape = null; | ||
} | ||
@@ -145,0 +149,0 @@ } |
@@ -23,3 +23,3 @@ module.exports = { | ||
// version, etc. | ||
version: '3.4.0-beta.10' | ||
version: '3.4.0-beta.11' | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27732
1044811