diff --git a/src/Layer.js b/src/Layer.js index 2571a95c..9e07dfde 100644 --- a/src/Layer.js +++ b/src/Layer.js @@ -166,6 +166,7 @@ } Kinetic.Container.prototype.drawHit.call(this, canvas, top); + this.imageData = null; // Clear imageData cache return this; }, /** diff --git a/src/Stage.js b/src/Stage.js index 87b9595d..f218f505 100644 --- a/src/Stage.js +++ b/src/Stage.js @@ -19,6 +19,9 @@ TAP = 'tap', DBL_TAP = 'dbltap', TOUCHMOVE = 'touchmove', + DOMMOUSESCROLL = 'DOMMouseScroll', + MOUSEWHEEL = 'mousewheel', + WHEEL = 'wheel', CONTENT_MOUSEOUT = 'contentMouseout', CONTENT_MOUSEOVER = 'contentMouseover', @@ -40,7 +43,7 @@ UNDERSCORE = '_', CONTAINER = 'container', EMPTY_STRING = '', - EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND, MOUSEOVER], + EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND, MOUSEOVER, DOMMOUSESCROLL, MOUSEWHEEL, WHEEL], // cached variables eventsLength = EVENTS.length; @@ -609,6 +612,20 @@ } } }, + _DOMMouseScroll: function(evt) { + this._mousewheel(evt); + }, + _mousewheel: function(evt) { + this._setPointerPosition(evt); + var shape = this.getIntersection(this.getPointerPosition()); + + if (shape && shape.isListening()) { + shape._fireAndBubble(MOUSEWHEEL, {evt: evt}); + } + }, + _wheel: function(evt) { + this._mousewheel(evt); + }, _setPointerPosition: function(evt) { var contentPosition = this._getContentPosition(), offsetX = evt.offsetX,