Commit 27c93278 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(InvertedMouseArea): supports `wheel` events

parent a034d3ff
...@@ -54,16 +54,12 @@ Item { ...@@ -54,16 +54,12 @@ Item {
MouseArea { MouseArea {
property var _timeout property var _timeout
anchors.fill: parent function _checkPosition (positionEvent) {
propagateComposedEvents: true
z: Constants.zMax
onPressed: {
// Propagate event. // Propagate event.
mouse.accepted = false positionEvent.accepted = false
// Click is outside or not. // Click is outside or not.
if (!Utils.pointIsInItem(this, item, mouse)) { if (!Utils.pointIsInItem(this, item, positionEvent)) {
if (_timeout != null) { if (_timeout != null) {
// Remove existing timeout to avoid the creation of // Remove existing timeout to avoid the creation of
// many children. // many children.
...@@ -74,7 +70,7 @@ Item { ...@@ -74,7 +70,7 @@ Item {
// after the propagated event. // after the propagated event.
// //
// It's useful to ensure the window's context is not // It's useful to ensure the window's context is not
// modified with the mouse event before the `onPressed` // modified with the positionEvent before the `onPressed`
// call. // call.
// //
// The timeout is destroyed with the `MouseArea` component. // The timeout is destroyed with the `MouseArea` component.
...@@ -82,10 +78,17 @@ Item { ...@@ -82,10 +78,17 @@ Item {
this, this,
(function (point, item) { (function (point, item) {
return Utils.pointIsInItem(this, item, point) return Utils.pointIsInItem(this, item, point)
}).bind(this, { x: mouse.x, y: mouse.y }) }).bind(this, { x: positionEvent.x, y: positionEvent.y })
)) ))
} }
} }
anchors.fill: parent
propagateComposedEvents: true
z: Constants.zMax
onPressed: _checkPosition.call(this, mouse)
onWheel: _checkPosition.call(this, wheel)
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment