mirror of
https://github.com/konvajs/konva.git
synced 2025-07-15 08:58:27 +08:00
better fix for pointer position. close #229.
This commit is contained in:
parent
5e3c9f3d5d
commit
1eb5a0341a
16
konva.js
16
konva.js
@ -10445,13 +10445,21 @@
|
|||||||
if (evt.touches.length > 0) {
|
if (evt.touches.length > 0) {
|
||||||
var touch = evt.touches[0];
|
var touch = evt.touches[0];
|
||||||
// get the information for finger #1
|
// get the information for finger #1
|
||||||
x = touch.offsetX || touch.clientX - contentPosition.left;
|
x = touch.offsetX !== undefined
|
||||||
y = touch.offsetY || touch.clientY - contentPosition.top;
|
? touch.offsetX
|
||||||
|
: touch.clientX - contentPosition.left;
|
||||||
|
y = touch.offsetY !== undefined
|
||||||
|
? touch.offsetY
|
||||||
|
: touch.clientY - contentPosition.top;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// mouse events
|
// mouse events
|
||||||
x = evt.offsetX || evt.clientX - contentPosition.left;
|
x = evt.offsetX !== undefined
|
||||||
y = evt.offsetY || evt.clientY - contentPosition.top;
|
? evt.offsetX
|
||||||
|
: evt.clientX - contentPosition.left;
|
||||||
|
y = evt.offsetY !== undefined
|
||||||
|
? evt.offsetY
|
||||||
|
: evt.clientY - contentPosition.top;
|
||||||
}
|
}
|
||||||
if (x !== null && y !== null) {
|
if (x !== null && y !== null) {
|
||||||
this.pointerPos = {
|
this.pointerPos = {
|
||||||
|
10
konva.min.js
vendored
10
konva.min.js
vendored
File diff suppressed because one or more lines are too long
10
package.json
10
package.json
@ -27,13 +27,13 @@
|
|||||||
"gulp-eslint": "^3.0.1",
|
"gulp-eslint": "^3.0.1",
|
||||||
"gulp-jscpd": "0.0.7",
|
"gulp-jscpd": "0.0.7",
|
||||||
"gulp-jsdoc": "^0.1.5",
|
"gulp-jsdoc": "^0.1.5",
|
||||||
"gulp-mocha-phantomjs": "^0.12.0",
|
"gulp-mocha-phantomjs": "^0.12.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
"gulp-uglify": "^2.0.0",
|
"gulp-uglify": "^2.1.2",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.8",
|
||||||
"mocha": "3.2.0",
|
"mocha": "3.3.0",
|
||||||
"prettier": "^0.19.0"
|
"prettier": "^1.2.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"canvas",
|
"canvas",
|
||||||
|
16
src/Stage.js
16
src/Stage.js
@ -705,13 +705,21 @@
|
|||||||
if (evt.touches.length > 0) {
|
if (evt.touches.length > 0) {
|
||||||
var touch = evt.touches[0];
|
var touch = evt.touches[0];
|
||||||
// get the information for finger #1
|
// get the information for finger #1
|
||||||
x = touch.offsetX || touch.clientX - contentPosition.left;
|
x = touch.offsetX !== undefined
|
||||||
y = touch.offsetY || touch.clientY - contentPosition.top;
|
? touch.offsetX
|
||||||
|
: touch.clientX - contentPosition.left;
|
||||||
|
y = touch.offsetY !== undefined
|
||||||
|
? touch.offsetY
|
||||||
|
: touch.clientY - contentPosition.top;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// mouse events
|
// mouse events
|
||||||
x = evt.offsetX || evt.clientX - contentPosition.left;
|
x = evt.offsetX !== undefined
|
||||||
y = evt.offsetY || evt.clientY - contentPosition.top;
|
? evt.offsetX
|
||||||
|
: evt.clientX - contentPosition.left;
|
||||||
|
y = evt.offsetY !== undefined
|
||||||
|
? evt.offsetY
|
||||||
|
: evt.clientY - contentPosition.top;
|
||||||
}
|
}
|
||||||
if (x !== null && y !== null) {
|
if (x !== null && y !== null) {
|
||||||
this.pointerPos = {
|
this.pointerPos = {
|
||||||
|
Loading…
Reference in New Issue
Block a user