added stage mouseover and mouseout events

This commit is contained in:
Eric Rowell
2013-07-05 10:38:02 -07:00
parent 7c40333fc8
commit c79f286893
2 changed files with 21 additions and 2 deletions

View File

@@ -25,7 +25,7 @@
UNDERSCORE = '_', UNDERSCORE = '_',
CONTAINER = 'container', CONTAINER = 'container',
EMPTY_STRING = '', EMPTY_STRING = '',
EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND], EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND, MOUSEOVER],
// cached variables // cached variables
eventsLength = EVENTS.length; eventsLength = EVENTS.length;
@@ -353,6 +353,9 @@
addEvent(this, EVENTS[n]); addEvent(this, EVENTS[n]);
} }
}, },
_mouseover: function(evt) {
this._fire(MOUSEOVER, evt);
},
_mouseout: function(evt) { _mouseout: function(evt) {
this._setPointerPosition(evt); this._setPointerPosition(evt);
var go = Kinetic.Global, var go = Kinetic.Global,
@@ -364,6 +367,8 @@
this.targetShape = null; this.targetShape = null;
} }
this.mousePos = undefined; this.mousePos = undefined;
this._fire(MOUSEOUT, evt);
}, },
_mousemove: function(evt) { _mousemove: function(evt) {
this._setPointerPosition(evt); this._setPointerPosition(evt);

View File

@@ -59,13 +59,27 @@ Test.Modules.DD = {
}); });
*/
stage.on('dragstart', function(evt) { stage.on('dragstart', function(evt) {
console.log('dragstart'); console.log('dragstart');
console.log(evt.targetNode); console.log(evt.targetNode);
console.log('-------'); console.log('-------');
}); });
*/
stage.on('mouseover', function(evt) {
console.log('mouseover');
console.log(evt.targetNode);
console.log('-------');
});
stage.on('mouseout', function(evt) {
console.log('mouseout');
console.log(evt.targetNode);
console.log('-------');
});