summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Hein <hein@kde.org>2017-02-20 14:02:39 (GMT)
committerEike Hein <hein@kde.org>2017-02-20 14:13:23 (GMT)
commitc9a7741f2b8082f025b5eb2e53c3c489a95e1da8 (patch)
treef072cd932f9c218c19eec95dea45df7db14ff762
parentdf0f9687b9f7978bf8a691067c2b3c49c0b0dbf2 (diff)
Use icon center for vertical hitscan on drop.
Summary: Previously the delegate center was used, which can cause drops to land in lower grid cells than expected based on the key visual, which is the icon. Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4683
-rw-r--r--containments/desktop/package/contents/ui/FolderView.qml4
1 files changed, 3 insertions, 1 deletions
diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml
index f7a7953..5617e0b 100644
--- a/containments/desktop/package/contents/ui/FolderView.qml
+++ b/containments/desktop/package/contents/ui/FolderView.qml
@@ -321,6 +321,7 @@ Item {
pressedItem.toolTip.hideToolTip();
dragX = mouse.x;
dragY = mouse.y;
+ gridView.verticalDropHitscanOffset = pressedItem.iconArea.y + (pressedItem.iconArea.height / 2)
dir.dragSelected(mouse.x, mouse.y);
dragX = -1;
dragY = -1;
@@ -396,6 +397,7 @@ Item {
property bool isRootView: false
property int iconSize: makeIconSize()
+ property int verticalDropHitscanOffset: 0
property Item hoveredItem: null
@@ -902,7 +904,7 @@ Item {
}
itemX = dropPos.x + offset.x + (listener.dragX % cellWidth) + (cellWidth / 2);
- itemY = dropPos.y + offset.y + (listener.dragY % cellHeight) + (cellHeight / 2);
+ itemY = dropPos.y + offset.y + (listener.dragY % cellHeight) + gridView.verticalDropHitscanOffset;
if (gridView.effectiveLayoutDirection == Qt.RightToLeft) {
itemX -= (rows ? gridView.contentX : gridView.originX);