Commit ffedd50e authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Common/InvertedMouseArea): remove the limit instances of `InvertedMouseArea`

parent 6460fc83
...@@ -21,16 +21,6 @@ Item { ...@@ -21,16 +21,6 @@ Item {
function _createMouseArea () { function _createMouseArea () {
var parent = Utils.getTopParent(item, true) var parent = Utils.getTopParent(item, true)
var mouseArea = Utils.find(parent.children, function (element) {
return Utils.qmlTypeof(element, 'QQuickMouseArea')
})
Utils.assert(
_mouseArea === mouseArea,
'It already exists a different `MouseArea` at window root. (' +
'`local mouse area`=' + _mouseArea + ', `root mouse area`=' +
mouseArea + ')'
)
if (_mouseArea == null) { if (_mouseArea == null) {
_mouseArea = builder.createObject() _mouseArea = builder.createObject()
......
...@@ -18,13 +18,14 @@ Item { ...@@ -18,13 +18,14 @@ Item {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
function _handleHoveredLink (hoveredLink) { function _handleHoveredLink (hoveredLink) {
var root = Utils.getTopParent(container)
var children = root.children
// Can be the `invertedMouseArea` of other message. // Can be the `invertedMouseArea` of other message.
var mouseArea = Utils.find(children, function (element) { // Or another mouse area. Dangerous?
return Utils.qmlTypeof(element, 'QQuickMouseArea') var mouseArea = Utils.find(
}) Utils.getTopParent(container).children,
function (element) {
return Utils.qmlTypeof(element, 'QQuickMouseArea')
}
)
if (mouseArea != null) { if (mouseArea != null) {
mouseArea.cursorShape = hoveredLink mouseArea.cursorShape = hoveredLink
......
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