when node is at the edge of the canvas, and you mouse over the node and then off the canvas, the mouseout handlers for the node are executed

This commit is contained in:
Eric Rowell 2012-04-01 11:34:22 -07:00
parent 86a1337017
commit bdafb3eb25
4 changed files with 36 additions and 1 deletions

View File

@ -1535,6 +1535,11 @@ Kinetic.Stage.prototype = {
}, false);
this.container.addEventListener('mouseout', function(evt) {
// if there's a current target shape, run mouseout handlers
var targetShape = that.targetShape;
if(targetShape) {
targetShape._handleEvents('onmouseout', evt);
}
that.mousePos = undefined;
}, false);
// mobile events

File diff suppressed because one or more lines are too long

View File

@ -505,6 +505,11 @@ Kinetic.Stage.prototype = {
}, false);
this.container.addEventListener('mouseout', function(evt) {
// if there's a current target shape, run mouseout handlers
var targetShape = that.targetShape;
if(targetShape) {
targetShape._handleEvents('onmouseout', evt);
}
that.mousePos = undefined;
}, false);
// mobile events

View File

@ -992,6 +992,31 @@ Test.prototype.tests = {
layer.add(group);
stage.add(layer);
},
'EVENTS - shape mouseout handlers when mouse leaves stage': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var redCircle = new Kinetic.Circle({
x: 550,
y: stage.height / 2,
radius: 80,
strokeWidth: 4,
fill: 'red',
stroke: 'black',
name: 'circle'
});
redCircle.on('mouseout', function() {
log('mouseout');
});
layer.add(redCircle);
stage.add(layer);
},
'DRAG AND DROP - isDragging': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,