Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions qml/FolderGridViewPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ Popup {
readonly property int horizontalPadding: contentRoot.width * paddingColumns
anchors.fill: parent
property bool createdEmptyPage: false
property real lastDragX: 0

onEntered: root.onDragEnter(this)

Expand All @@ -201,10 +202,14 @@ Popup {
createdEmptyPage = false
}

function checkDragMove() {
if (drag.x < horizontalPadding) {
function checkDragMove(dragX) {
if (dragX === undefined) {
dragX = drag.x
}
lastDragX = dragX
if (dragX < horizontalPadding) {
pageIntent = -1
} else if (drag.x > (width - horizontalPadding)) {
} else if (dragX > (width - horizontalPadding)) {
let isLastPage = folderPagesView.currentIndex === folderPagesView.count - 1
if (isLastPage && folderPageDropArea.createdEmptyPage) {
return
Expand Down Expand Up @@ -254,7 +259,7 @@ Popup {
}
parent.pageIntent = 0
if (folderPagesView.currentIndex !== 0) {
parent.checkDragMove()
parent.checkDragMove(parent.lastDragX)
}
}
}
Expand Down Expand Up @@ -570,6 +575,13 @@ Popup {
if (dragId !== model.desktopId) {
isDragHover = true
}
let mappedX = mapToItem(folderPageDropArea, drag.x, 0).x
if (mappedX < folderPageDropArea.horizontalPadding || mappedX > (folderPageDropArea.width - folderPageDropArea.horizontalPadding)) {
folderDragApplyTimer.stop()
folderPageDropArea.checkDragMove(mappedX)
return
}
folderPageDropArea.pageIntent = 0
folderDragApplyTimer.dragId = dragId
folderDragApplyTimer.restart()
}
Expand All @@ -578,6 +590,13 @@ Popup {
if (dragId === model.desktopId) {
return
}
let mappedX = mapToItem(folderPageDropArea, drag.x, 0).x
if (mappedX < folderPageDropArea.horizontalPadding || mappedX > (folderPageDropArea.width - folderPageDropArea.horizontalPadding)) {
folderDragApplyTimer.stop()
folderPageDropArea.checkDragMove(mappedX)
return
}
folderPageDropArea.pageIntent = 0
folderDragApplyTimer.dragId = dragId
folderDragApplyTimer.currentDropX = drag.x
if (!folderDragApplyTimer.running) {
Expand All @@ -589,6 +608,7 @@ Popup {
root.onDragExit(this)
folderDragApplyTimer.stop()
folderDragApplyTimer.dragId = ""
folderPageDropArea.pageIntent = 0
}
Component.onDestruction: {
root.onDragExit(this)
Expand Down
Loading