better fix for pointer position. close #229.

This commit is contained in:
Anton Lavrenov 2017-04-25 13:00:35 -05:00
parent 5e3c9f3d5d
commit 1eb5a0341a
4 changed files with 34 additions and 18 deletions

View File

@ -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

File diff suppressed because one or more lines are too long

View File

@ -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",

View File

@ -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 = {