Verified Commit 18e174a9 authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[applets/pager] Refactor drag timer management out of DropArea

Having a single point of responsibility would reduce the chance of
running into bugs again, such as the one fixed in a previous commit.
parent 4f190cdf
Pipeline #201974 canceled with stage
in 2 minutes and 20 seconds
......@@ -232,6 +232,11 @@ MouseArea {
}
}
}
onDragSwitchDesktopIndexChanged: if (root.dragSwitchDesktopIndex === -1) {
dragTimer.stop();
} else {
dragTimer.restart();
}
Grid {
id: pagerItemGrid
......@@ -385,19 +390,16 @@ MouseArea {
onDragEnter: {
root.dragSwitchDesktopIndex = index;
dragTimer.start();
}
onDragLeave: {
// new onDragEnter may happen before an old onDragLeave
if (root.dragSwitchDesktopIndex === index) {
root.dragSwitchDesktopIndex = -1;
dragTimer.stop();
}
}
onDrop: {
pagerModel.drop(event.mimeData, event.modifiers, desktop.desktopId);
root.dragSwitchDesktopIndex = -1;
dragTimer.stop();
}
}
......
Supports Markdown
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