Skip to content

Commit 1518b68

Browse files
committed
fix: The four corners can't be dragged properly in full-screen mode
pms-bug-310813
1 parent 9d14bb6 commit 1518b68

1 file changed

Lines changed: 91 additions & 90 deletions

File tree

qml/FullscreenFrame.qml

Lines changed: 91 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,97 @@ InputEventItem {
8383
ItemArrangementProxyModel.removeEmptyPage()
8484
}
8585

86+
DropArea {
87+
id: dropArea
88+
property int pageIntent: 0
89+
readonly property real paddingColumns: 0.5
90+
readonly property int horizontalPadding: searchResultGridViewContainer.cellWidth * paddingColumns
91+
anchors.fill: parent
92+
z: -1
93+
94+
property bool createdEmptyPage: false
95+
function checkDragMove() {
96+
if (drag.x < horizontalPadding) {
97+
pageIntent = -1
98+
} else if (drag.x > (width - searchResultGridViewContainer.cellWidth)) {
99+
let isLastPage = listviewPage.currentIndex === listviewPage.count - 1
100+
if (isLastPage && dropArea.createdEmptyPage) {
101+
return
102+
}
103+
pageIntent = 1
104+
} else {
105+
pageIntent = 0
106+
}
107+
}
108+
109+
keys: ["text/x-dde-launcher-dnd-desktopId"]
110+
onEntered: {
111+
if (folderGridViewPopup.opened) {
112+
folderGridViewPopup.close()
113+
}
114+
}
115+
onPositionChanged: {
116+
checkDragMove()
117+
}
118+
onDropped: (drop) => {
119+
// drop over the left or right boundary of the page, do nothing
120+
if (pageIntent !== 0) {
121+
pageIntent = 0
122+
return
123+
}
124+
// drop into current page
125+
let dragId = drop.getDataAsString("text/x-dde-launcher-dnd-desktopId")
126+
dropOnPage(dragId, "internal/folders/0", listviewPage.currentIndex)
127+
pageIntent = 0
128+
}
129+
onExited: {
130+
pageIntent = 0
131+
}
132+
onPageIntentChanged: {
133+
if (pageIntent !== 0) {
134+
dndMovePageTimer.restart()
135+
} else {
136+
dndMovePageTimer.stop()
137+
}
138+
}
139+
140+
Timer {
141+
id: dndMovePageTimer
142+
interval: 1000
143+
onTriggered: {
144+
if (parent.pageIntent > 0) {
145+
let isLastPage = listviewPage.currentIndex === listviewPage.count - 1
146+
if (isLastPage && !dropArea.createdEmptyPage) {
147+
let newPageIndex = ItemArrangementProxyModel.creatEmptyPage()
148+
dropArea.createdEmptyPage = true
149+
listviewPage.setCurrentIndex(newPageIndex)
150+
parent.pageIntent = 0
151+
return
152+
} else {
153+
incrementPageIndex(listviewPage)
154+
}
155+
} else if (parent.pageIntent < 0) {
156+
decrementPageIndex(listviewPage)
157+
}
158+
159+
parent.pageIntent = 0
160+
if (listviewPage.currentIndex !== 0) {
161+
parent.checkDragMove()
162+
}
163+
}
164+
}
165+
166+
Connections {
167+
target: dndItem
168+
function onDragEnded() {
169+
if (dropArea.createdEmptyPage) {
170+
baseLayer.tryToRemoveEmptyPage()
171+
dropArea.createdEmptyPage = false
172+
}
173+
}
174+
}
175+
}
176+
86177
Timer {
87178
id: flipPageDelay
88179
interval: 400
@@ -202,96 +293,6 @@ InputEventItem {
202293
Layout.fillHeight: true
203294
clip: true
204295

205-
DropArea {
206-
id: dropArea
207-
property int pageIntent: 0
208-
readonly property real paddingColumns: 0.5
209-
readonly property int horizontalPadding: searchResultGridViewContainer.cellWidth * paddingColumns
210-
anchors.fill: parent
211-
212-
property bool createdEmptyPage: false
213-
function checkDragMove() {
214-
if (drag.x < horizontalPadding) {
215-
pageIntent = -1
216-
} else if (drag.x > (width - searchResultGridViewContainer.cellWidth)) {
217-
let isLastPage = listviewPage.currentIndex === listviewPage.count - 1
218-
if (isLastPage && dropArea.createdEmptyPage) {
219-
return
220-
}
221-
pageIntent = 1
222-
} else {
223-
pageIntent = 0
224-
}
225-
}
226-
227-
keys: ["text/x-dde-launcher-dnd-desktopId"]
228-
onEntered: {
229-
if (folderGridViewPopup.opened) {
230-
folderGridViewPopup.close()
231-
}
232-
}
233-
onPositionChanged: {
234-
checkDragMove()
235-
}
236-
onDropped: (drop) => {
237-
// drop over the left or right boundary of the page, do nothing
238-
if (pageIntent !== 0) {
239-
pageIntent = 0
240-
return
241-
}
242-
// drop into current page
243-
let dragId = drop.getDataAsString("text/x-dde-launcher-dnd-desktopId")
244-
dropOnPage(dragId, "internal/folders/0", listviewPage.currentIndex)
245-
pageIntent = 0
246-
}
247-
onExited: {
248-
pageIntent = 0
249-
}
250-
onPageIntentChanged: {
251-
if (pageIntent !== 0) {
252-
dndMovePageTimer.restart()
253-
} else {
254-
dndMovePageTimer.stop()
255-
}
256-
}
257-
258-
Timer {
259-
id: dndMovePageTimer
260-
interval: 1000
261-
onTriggered: {
262-
if (parent.pageIntent > 0) {
263-
let isLastPage = listviewPage.currentIndex === listviewPage.count - 1
264-
if (isLastPage && !dropArea.createdEmptyPage) {
265-
let newPageIndex = ItemArrangementProxyModel.creatEmptyPage()
266-
dropArea.createdEmptyPage = true
267-
listviewPage.setCurrentIndex(newPageIndex)
268-
parent.pageIntent = 0
269-
return
270-
} else {
271-
incrementPageIndex(listviewPage)
272-
}
273-
} else if (parent.pageIntent < 0) {
274-
decrementPageIndex(listviewPage)
275-
}
276-
277-
parent.pageIntent = 0
278-
if (listviewPage.currentIndex !== 0) {
279-
parent.checkDragMove()
280-
}
281-
}
282-
}
283-
284-
Connections {
285-
target: dndItem
286-
function onDragEnded() {
287-
if (dropArea.createdEmptyPage) {
288-
baseLayer.tryToRemoveEmptyPage()
289-
dropArea.createdEmptyPage = false
290-
}
291-
}
292-
}
293-
}
294-
295296
ItemsPageModel {
296297
id: itemPageModel
297298
sourceModel: ItemArrangementProxyModel

0 commit comments

Comments
 (0)