mirror of
https://github.com/konvajs/konva.git
synced 2025-06-27 16:15:07 +08:00
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:
parent
86a1337017
commit
bdafb3eb25
5
dist/kinetic-core.js
vendored
5
dist/kinetic-core.js
vendored
@ -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
|
||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user