mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
remove all old fixes
This commit is contained in:
parent
993ebd543a
commit
d00a5b4a6d
202
konva.js
202
konva.js
@ -2,7 +2,7 @@
|
|||||||
* Konva JavaScript Framework v2.6.0
|
* Konva JavaScript Framework v2.6.0
|
||||||
* http://konvajs.github.io/
|
* http://konvajs.github.io/
|
||||||
* Licensed under the MIT
|
* Licensed under the MIT
|
||||||
* Date: Fri Dec 14 2018
|
* Date: Tue Dec 18 2018
|
||||||
*
|
*
|
||||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||||
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
||||||
@ -10916,43 +10916,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_mouseover: function(evt) {
|
_mouseover: function(evt) {
|
||||||
if (!Konva.UA.mobile) {
|
this._setPointerPosition(evt);
|
||||||
this._setPointerPosition(evt);
|
this._fire(CONTENT_MOUSEOVER, { evt: evt });
|
||||||
this._fire(CONTENT_MOUSEOVER, { evt: evt });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
_mouseout: function(evt) {
|
_mouseout: function(evt) {
|
||||||
if (!Konva.UA.mobile) {
|
this._setPointerPosition(evt);
|
||||||
this._setPointerPosition(evt);
|
var targetShape = this.targetShape;
|
||||||
var targetShape = this.targetShape;
|
|
||||||
|
|
||||||
if (targetShape && !Konva.isDragging()) {
|
if (targetShape && !Konva.isDragging()) {
|
||||||
targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
||||||
targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
||||||
this.targetShape = null;
|
this.targetShape = null;
|
||||||
}
|
|
||||||
this.pointerPos = undefined;
|
|
||||||
|
|
||||||
this._fire(CONTENT_MOUSEOUT, { evt: evt });
|
|
||||||
}
|
}
|
||||||
|
this.pointerPos = undefined;
|
||||||
|
|
||||||
|
this._fire(CONTENT_MOUSEOUT, { evt: evt });
|
||||||
},
|
},
|
||||||
_mousemove: function(evt) {
|
_mousemove: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
|
||||||
if (Konva.UA.ieMobile) {
|
|
||||||
return this._touchmove(evt);
|
|
||||||
}
|
|
||||||
// workaround fake mousemove event in chrome browser https://code.google.com/p/chromium/issues/detail?id=161464
|
|
||||||
if (
|
|
||||||
(typeof evt.movementX !== 'undefined' ||
|
|
||||||
typeof evt.movementY !== 'undefined') &&
|
|
||||||
evt.movementY === 0 &&
|
|
||||||
evt.movementX === 0
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (Konva.UA.mobile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
this._setPointerPosition(evt);
|
this._setPointerPosition(evt);
|
||||||
var shape;
|
var shape;
|
||||||
|
|
||||||
@ -10975,9 +10955,9 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* if no shape was detected, clear target shape and try
|
* if no shape was detected, clear target shape and try
|
||||||
* to run mouseout from previous target shape
|
* to run mouseout from previous target shape
|
||||||
*/
|
*/
|
||||||
if (this.targetShape && !Konva.isDragging()) {
|
if (this.targetShape && !Konva.isDragging()) {
|
||||||
this.targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
this.targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
||||||
this.targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
this.targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
||||||
@ -11001,30 +10981,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_mousedown: function(evt) {
|
_mousedown: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
this._setPointerPosition(evt);
|
||||||
if (Konva.UA.ieMobile) {
|
var shape = this.getIntersection(this.getPointerPosition());
|
||||||
return this._touchstart(evt);
|
|
||||||
|
Konva.listenClickTap = true;
|
||||||
|
|
||||||
|
if (shape && shape.isListening()) {
|
||||||
|
this.clickStartShape = shape;
|
||||||
|
shape._fireAndBubble(MOUSEDOWN, { evt: evt });
|
||||||
|
} else {
|
||||||
|
this._fire(MOUSEDOWN, {
|
||||||
|
evt: evt,
|
||||||
|
target: this,
|
||||||
|
currentTarget: this
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!Konva.UA.mobile) {
|
|
||||||
this._setPointerPosition(evt);
|
|
||||||
var shape = this.getIntersection(this.getPointerPosition());
|
|
||||||
|
|
||||||
Konva.listenClickTap = true;
|
// content event
|
||||||
|
this._fire(CONTENT_MOUSEDOWN, { evt: evt });
|
||||||
if (shape && shape.isListening()) {
|
|
||||||
this.clickStartShape = shape;
|
|
||||||
shape._fireAndBubble(MOUSEDOWN, { evt: evt });
|
|
||||||
} else {
|
|
||||||
this._fire(MOUSEDOWN, {
|
|
||||||
evt: evt,
|
|
||||||
target: this,
|
|
||||||
currentTarget: this
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// content event
|
|
||||||
this._fire(CONTENT_MOUSEDOWN, { evt: evt });
|
|
||||||
}
|
|
||||||
|
|
||||||
// always call preventDefault for desktop events because some browsers
|
// always call preventDefault for desktop events because some browsers
|
||||||
// try to drag and drop the canvas element
|
// try to drag and drop the canvas element
|
||||||
@ -11036,79 +11010,73 @@
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
_mouseup: function(evt) {
|
_mouseup: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
this._setPointerPosition(evt);
|
||||||
if (Konva.UA.ieMobile) {
|
var shape = this.getIntersection(this.getPointerPosition()),
|
||||||
return this._touchend(evt);
|
clickStartShape = this.clickStartShape,
|
||||||
|
clickEndShape = this.clickEndShape,
|
||||||
|
fireDblClick = false,
|
||||||
|
dd = Konva.DD;
|
||||||
|
|
||||||
|
if (Konva.inDblClickWindow) {
|
||||||
|
fireDblClick = true;
|
||||||
|
clearTimeout(this.dblTimeout);
|
||||||
|
// Konva.inDblClickWindow = false;
|
||||||
|
} else if (!dd || !dd.justDragged) {
|
||||||
|
// don't set inDblClickWindow after dragging
|
||||||
|
Konva.inDblClickWindow = true;
|
||||||
|
clearTimeout(this.dblTimeout);
|
||||||
|
} else if (dd) {
|
||||||
|
dd.justDragged = false;
|
||||||
}
|
}
|
||||||
if (!Konva.UA.mobile) {
|
|
||||||
this._setPointerPosition(evt);
|
|
||||||
var shape = this.getIntersection(this.getPointerPosition()),
|
|
||||||
clickStartShape = this.clickStartShape,
|
|
||||||
clickEndShape = this.clickEndShape,
|
|
||||||
fireDblClick = false,
|
|
||||||
dd = Konva.DD;
|
|
||||||
|
|
||||||
if (Konva.inDblClickWindow) {
|
this.dblTimeout = setTimeout(function() {
|
||||||
fireDblClick = true;
|
Konva.inDblClickWindow = false;
|
||||||
clearTimeout(this.dblTimeout);
|
}, Konva.dblClickWindow);
|
||||||
// Konva.inDblClickWindow = false;
|
|
||||||
} else if (!dd || !dd.justDragged) {
|
|
||||||
// don't set inDblClickWindow after dragging
|
|
||||||
Konva.inDblClickWindow = true;
|
|
||||||
clearTimeout(this.dblTimeout);
|
|
||||||
} else if (dd) {
|
|
||||||
dd.justDragged = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dblTimeout = setTimeout(function() {
|
if (shape && shape.isListening()) {
|
||||||
Konva.inDblClickWindow = false;
|
this.clickEndShape = shape;
|
||||||
}, Konva.dblClickWindow);
|
shape._fireAndBubble(MOUSEUP, { evt: evt });
|
||||||
|
|
||||||
if (shape && shape.isListening()) {
|
// detect if click or double click occurred
|
||||||
this.clickEndShape = shape;
|
if (
|
||||||
shape._fireAndBubble(MOUSEUP, { evt: evt });
|
Konva.listenClickTap &&
|
||||||
|
clickStartShape &&
|
||||||
|
clickStartShape._id === shape._id
|
||||||
|
) {
|
||||||
|
shape._fireAndBubble(CLICK, { evt: evt });
|
||||||
|
|
||||||
// detect if click or double click occurred
|
|
||||||
if (
|
if (
|
||||||
Konva.listenClickTap &&
|
fireDblClick &&
|
||||||
clickStartShape &&
|
clickEndShape &&
|
||||||
clickStartShape._id === shape._id
|
clickEndShape._id === shape._id
|
||||||
) {
|
) {
|
||||||
shape._fireAndBubble(CLICK, { evt: evt });
|
shape._fireAndBubble(DBL_CLICK, { evt: evt });
|
||||||
|
|
||||||
if (
|
|
||||||
fireDblClick &&
|
|
||||||
clickEndShape &&
|
|
||||||
clickEndShape._id === shape._id
|
|
||||||
) {
|
|
||||||
shape._fireAndBubble(DBL_CLICK, { evt: evt });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this._fire(MOUSEUP, { evt: evt, target: this, currentTarget: this });
|
|
||||||
if (Konva.listenClickTap) {
|
|
||||||
this._fire(CLICK, { evt: evt, target: this, currentTarget: this });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fireDblClick) {
|
|
||||||
this._fire(DBL_CLICK, {
|
|
||||||
evt: evt,
|
|
||||||
target: this,
|
|
||||||
currentTarget: this
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// content events
|
} else {
|
||||||
this._fire(CONTENT_MOUSEUP, { evt: evt });
|
this._fire(MOUSEUP, { evt: evt, target: this, currentTarget: this });
|
||||||
if (Konva.listenClickTap) {
|
if (Konva.listenClickTap) {
|
||||||
this._fire(CONTENT_CLICK, { evt: evt });
|
this._fire(CLICK, { evt: evt, target: this, currentTarget: this });
|
||||||
if (fireDblClick) {
|
|
||||||
this._fire(CONTENT_DBL_CLICK, { evt: evt });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Konva.listenClickTap = false;
|
if (fireDblClick) {
|
||||||
|
this._fire(DBL_CLICK, {
|
||||||
|
evt: evt,
|
||||||
|
target: this,
|
||||||
|
currentTarget: this
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// content events
|
||||||
|
this._fire(CONTENT_MOUSEUP, { evt: evt });
|
||||||
|
if (Konva.listenClickTap) {
|
||||||
|
this._fire(CONTENT_CLICK, { evt: evt });
|
||||||
|
if (fireDblClick) {
|
||||||
|
this._fire(CONTENT_DBL_CLICK, { evt: evt });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Konva.listenClickTap = false;
|
||||||
|
|
||||||
// always call preventDefault for desktop events because some browsers
|
// always call preventDefault for desktop events because some browsers
|
||||||
// try to drag and drop the canvas element
|
// try to drag and drop the canvas element
|
||||||
|
6
konva.min.js
vendored
6
konva.min.js
vendored
File diff suppressed because one or more lines are too long
18
src/Stage.js
18
src/Stage.js
@ -413,10 +413,6 @@
|
|||||||
this._fire(CONTENT_MOUSEOUT, { evt: evt });
|
this._fire(CONTENT_MOUSEOUT, { evt: evt });
|
||||||
},
|
},
|
||||||
_mousemove: function(evt) {
|
_mousemove: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
|
||||||
if (Konva.UA.ieMobile) {
|
|
||||||
return this._touchmove(evt);
|
|
||||||
}
|
|
||||||
this._setPointerPosition(evt);
|
this._setPointerPosition(evt);
|
||||||
var shape;
|
var shape;
|
||||||
|
|
||||||
@ -439,9 +435,9 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* if no shape was detected, clear target shape and try
|
* if no shape was detected, clear target shape and try
|
||||||
* to run mouseout from previous target shape
|
* to run mouseout from previous target shape
|
||||||
*/
|
*/
|
||||||
if (this.targetShape && !Konva.isDragging()) {
|
if (this.targetShape && !Konva.isDragging()) {
|
||||||
this.targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
this.targetShape._fireAndBubble(MOUSEOUT, { evt: evt });
|
||||||
this.targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
this.targetShape._fireAndBubble(MOUSELEAVE, { evt: evt });
|
||||||
@ -465,10 +461,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_mousedown: function(evt) {
|
_mousedown: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
|
||||||
if (Konva.UA.ieMobile) {
|
|
||||||
return this._touchstart(evt);
|
|
||||||
}
|
|
||||||
this._setPointerPosition(evt);
|
this._setPointerPosition(evt);
|
||||||
var shape = this.getIntersection(this.getPointerPosition());
|
var shape = this.getIntersection(this.getPointerPosition());
|
||||||
|
|
||||||
@ -498,10 +490,6 @@
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
_mouseup: function(evt) {
|
_mouseup: function(evt) {
|
||||||
// workaround for mobile IE to force touch event when unhandled pointer event elevates into a mouse event
|
|
||||||
if (Konva.UA.ieMobile) {
|
|
||||||
return this._touchend(evt);
|
|
||||||
}
|
|
||||||
this._setPointerPosition(evt);
|
this._setPointerPosition(evt);
|
||||||
var shape = this.getIntersection(this.getPointerPosition()),
|
var shape = this.getIntersection(this.getPointerPosition()),
|
||||||
clickStartShape = this.clickStartShape,
|
clickStartShape = this.clickStartShape,
|
||||||
|
Loading…
Reference in New Issue
Block a user