mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 19:07:59 +08:00
added mouseenter and mouseleave events. mouseover and mouseout were actually functioning like mouseenter and mouseleave. mouseover and mouseout now work similar to traditional DOM mouseover and mouseout. This change enables event delegation to work correctly
This commit is contained in:
@@ -460,6 +460,7 @@ Kinetic.Stage.prototype = {
|
||||
var targetShape = this.targetShape;
|
||||
if(targetShape && !go.drag.moving) {
|
||||
targetShape._handleEvent('mouseout', evt);
|
||||
argetShape._handleEvent('mouseleave', evt);
|
||||
this.targetShape = null;
|
||||
}
|
||||
this.mousePos = undefined;
|
||||
@@ -478,8 +479,10 @@ Kinetic.Stage.prototype = {
|
||||
if(!go.drag.moving && obj.pixel[3] === 255 && (!this.targetShape || this.targetShape._id !== shape._id)) {
|
||||
if(this.targetShape) {
|
||||
this.targetShape._handleEvent('mouseout', evt, shape);
|
||||
this.targetShape._handleEvent('mouseleave', evt, shape);
|
||||
}
|
||||
shape._handleEvent('mouseover', evt, this.targetShape);
|
||||
shape._handleEvent('mouseenter', evt, this.targetShape);
|
||||
this.targetShape = shape;
|
||||
}
|
||||
else {
|
||||
@@ -493,6 +496,7 @@ Kinetic.Stage.prototype = {
|
||||
*/
|
||||
else if(this.targetShape && !go.drag.moving) {
|
||||
this.targetShape._handleEvent('mouseout', evt);
|
||||
this.targetShape._handleEvent('mouseleave', evt);
|
||||
this.targetShape = null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user