contentWheel event for Stage. close #129

This commit is contained in:
Anton Lavrenov 2016-02-29 08:03:03 +08:00
parent c0a3057adb
commit 9ba6ff21fe
5 changed files with 23 additions and 15 deletions

View File

@ -9,6 +9,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fix wrong `Path` `getClientRect()` calculation - fix wrong `Path` `getClientRect()` calculation
- better HDPI support - better HDPI support
### Changed
- more universal stage container selector
- `mousewheel` event changed to `wheel`
## [0.11.1][2016-01-16] ## [0.11.1][2016-01-16]
### Fixed ### Fixed

View File

@ -3,7 +3,7 @@
* Konva JavaScript Framework v0.11.1 * Konva JavaScript Framework v0.11.1
* http://konvajs.github.io/ * http://konvajs.github.io/
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Sun Feb 28 2016 * Date: Mon Feb 29 2016
* *
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva) * Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva)
@ -2597,9 +2597,9 @@
}, },
/** /**
* bind events to the node. KonvaJS supports mouseover, mousemove, * bind events to the node. KonvaJS supports mouseover, mousemove,
* mouseout, mouseenter, mouseleave, mousedown, mouseup, mousewheel, click, dblclick, touchstart, touchmove, * mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, click, dblclick, touchstart, touchmove,
* touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports * touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports
* contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, * contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, contentWheel
* contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap, * contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap,
* and contentDblTap. Pass in a string of events delimmited by a space to bind multiple events at once * and contentDblTap. Pass in a string of events delimmited by a space to bind multiple events at once
* such as 'mousedown mouseup mousemove'. Include a namespace to bind an * such as 'mousedown mouseup mousemove'. Include a namespace to bind an
@ -8575,6 +8575,7 @@
CONTENT_DBL_TAP = 'contentDbltap', CONTENT_DBL_TAP = 'contentDbltap',
CONTENT_TAP = 'contentTap', CONTENT_TAP = 'contentTap',
CONTENT_TOUCHMOVE = 'contentTouchmove', CONTENT_TOUCHMOVE = 'contentTouchmove',
CONTENT_WHEEL = 'contentWheel',
DIV = 'div', DIV = 'div',
RELATIVE = 'relative', RELATIVE = 'relative',
@ -8600,7 +8601,7 @@
* @memberof Konva * @memberof Konva
* @augments Konva.Container * @augments Konva.Container
* @param {Object} config * @param {Object} config
* @param {String|Element} config.container Container id or DOM element * @param {String|Element} config.container Container selector or DOM element
* @param {Number} [config.x] * @param {Number} [config.x]
* @param {Number} [config.y] * @param {Number} [config.y]
* @param {Number} [config.width] * @param {Number} [config.width]
@ -8625,7 +8626,7 @@
* var stage = new Konva.Stage({ * var stage = new Konva.Stage({
* width: 500, * width: 500,
* height: 800, * height: 800,
* container: 'containerId' * container: 'containerId' // or "#containerId" or ".containerClass"
* }); * });
*/ */
Konva.Stage = function(config) { Konva.Stage = function(config) {
@ -9202,8 +9203,9 @@
var shape = this.getIntersection(this.getPointerPosition()); var shape = this.getIntersection(this.getPointerPosition());
if (shape && shape.isListening()) { if (shape && shape.isListening()) {
shape._fireAndBubble(MOUSEWHEEL, {evt: evt}); shape._fireAndBubble(WHEEL, {evt: evt});
} }
this._fire(CONTENT_WHEEL, {evt: evt});
}, },
_wheel: function(evt) { _wheel: function(evt) {
this._mousewheel(evt); this._mousewheel(evt);

8
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -364,9 +364,9 @@
}, },
/** /**
* bind events to the node. KonvaJS supports mouseover, mousemove, * bind events to the node. KonvaJS supports mouseover, mousemove,
* mouseout, mouseenter, mouseleave, mousedown, mouseup, mousewheel, click, dblclick, touchstart, touchmove, * mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, click, dblclick, touchstart, touchmove,
* touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports * touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports
* contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, * contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, contentWheel
* contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap, * contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap,
* and contentDblTap. Pass in a string of events delimmited by a space to bind multiple events at once * and contentDblTap. Pass in a string of events delimmited by a space to bind multiple events at once
* such as 'mousedown mouseup mousemove'. Include a namespace to bind an * such as 'mousedown mouseup mousemove'. Include a namespace to bind an

View File

@ -35,6 +35,7 @@
CONTENT_DBL_TAP = 'contentDbltap', CONTENT_DBL_TAP = 'contentDbltap',
CONTENT_TAP = 'contentTap', CONTENT_TAP = 'contentTap',
CONTENT_TOUCHMOVE = 'contentTouchmove', CONTENT_TOUCHMOVE = 'contentTouchmove',
CONTENT_WHEEL = 'contentWheel',
DIV = 'div', DIV = 'div',
RELATIVE = 'relative', RELATIVE = 'relative',
@ -60,13 +61,13 @@
* @memberof Konva * @memberof Konva
* @augments Konva.Container * @augments Konva.Container
* @param {Object} config * @param {Object} config
* @param {String|Element} config.container Container id or DOM element * @param {String|Element} config.container Container selector or DOM element
* @@nodeParams * @@nodeParams
* @example * @example
* var stage = new Konva.Stage({ * var stage = new Konva.Stage({
* width: 500, * width: 500,
* height: 800, * height: 800,
* container: 'containerId' * container: 'containerId' // or "#containerId" or ".containerClass"
* }); * });
*/ */
Konva.Stage = function(config) { Konva.Stage = function(config) {
@ -643,8 +644,9 @@
var shape = this.getIntersection(this.getPointerPosition()); var shape = this.getIntersection(this.getPointerPosition());
if (shape && shape.isListening()) { if (shape && shape.isListening()) {
shape._fireAndBubble(MOUSEWHEEL, {evt: evt}); shape._fireAndBubble(WHEEL, {evt: evt});
} }
this._fire(CONTENT_WHEEL, {evt: evt});
}, },
_wheel: function(evt) { _wheel: function(evt) {
this._mousewheel(evt); this._mousewheel(evt);