mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
issue #606 moved evt.layerX/Y check at the end of the double pipe chain
This commit is contained in:
19
src/Stage.js
19
src/Stage.js
@@ -576,9 +576,15 @@
|
||||
}
|
||||
},
|
||||
_setMousePosition: function(evt) {
|
||||
|
||||
var mouseX = evt.offsetX !== undefined ? evt.offsetX : evt.layerX || (evt.clientX - this._getContentPosition().left),
|
||||
mouseY = evt.offsetY !== undefined ? evt.offsetY : evt.layerY || (evt.clientY - this._getContentPosition().top);
|
||||
var contentPosition = this._getContentPosition(),
|
||||
mouseX = evt.offsetX
|
||||
|| ((evt.clientX || 0) - contentPosition.left)
|
||||
|| evt.layerX
|
||||
|| 0,
|
||||
mouseY = evt.offsetY
|
||||
|| ((evt.clientY || 0) - contentPosition.top)
|
||||
|| evt.layerY
|
||||
|| 0;
|
||||
|
||||
this.mousePos = {
|
||||
x: mouseX,
|
||||
@@ -586,15 +592,16 @@
|
||||
};
|
||||
},
|
||||
_setTouchPosition: function(evt) {
|
||||
var touch, touchX, touchY;
|
||||
var contentPosition = this._getContentPosition(),
|
||||
touch, touchX, touchY;
|
||||
|
||||
if(evt.touches !== undefined && evt.touches.length === 1) {
|
||||
// one finger
|
||||
touch = evt.touches[0];
|
||||
|
||||
// get the information for finger #1
|
||||
touchX = touch.clientX - this._getContentPosition().left;
|
||||
touchY = touch.clientY - this._getContentPosition().top;
|
||||
touchX = touch.clientX - contentPosition.left;
|
||||
touchY = touch.clientY - contentPosition.top;
|
||||
|
||||
this.touchPos = {
|
||||
x: touchX,
|
||||
|
||||
Reference in New Issue
Block a user