fix: Fix issue with icon drag-and-drop release failure#682
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsures that icon drag-and-drop always processes the drop target page, even when the drag ends over page boundaries, by removing an early-return boundary check and always invoking the page drop handler before resetting pagination state. Sequence diagram for updated icon drag-and-drop drop handlingsequenceDiagram
actor User
participant FolderGridViewPopup
participant DropEvent
participant FolderPagesView
participant FolderController
User->>FolderGridViewPopup: drag icon
User->>FolderGridViewPopup: release icon over page boundary
FolderGridViewPopup->>DropEvent: onDropped(drop)
DropEvent-->>FolderGridViewPopup: getDataAsString(text/x-dde-launcher-dnd-desktopId)
FolderGridViewPopup->>FolderController: dropOnPage(dragId, internal/folders/currentFolderId, currentIndex)
FolderGridViewPopup->>FolderGridViewPopup: pageIntent = 0
FolderGridViewPopup->>FolderGridViewPopup: createdEmptyPage = false
FolderGridViewPopup-->>User: icon positioned on target page
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The previous guard that ignored drops when
pageIntent !== 0has been removed; consider whether this reintroduces unwanted drops when dragging across page boundaries and, if needed, restore a more targeted condition instead of removing it entirely. - The new
let dragIdline introduces trailing whitespace; remove it to keep the QML file clean and consistent with surrounding style.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The previous guard that ignored drops when `pageIntent !== 0` has been removed; consider whether this reintroduces unwanted drops when dragging across page boundaries and, if needed, restore a more targeted condition instead of removing it entirely.
- The new `let dragId` line introduces trailing whitespace; remove it to keep the QML file clean and consistent with surrounding style.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Fix issue with icon drag-and-drop release failure Log: Fix issue with icon drag-and-drop release failure pms: BUG-344221
20fb329 to
c2cfd20
Compare
deepin pr auto review我来帮你审查这段代码变更。这是一个QML文件中的拖放功能修改,主要涉及文件夹网格视图的拖放处理逻辑。
onDropped: (drop) => {
// 保留边界检查,但增加响应性
if (pageIntent !== 0) {
// 添加边界释放的动画效果
boundaryAnimation.start()
pageIntent = 0
return
}
// 验证拖放数据有效性
let dragId = drop.getDataAsString("text/x-dde-launcher-dnd-desktopId")
if (!dragId || dragId.trim() === "") {
console.warn("Invalid drag ID received")
return
}
// 执行拖放操作
dropOnPage(dragId, "internal/folders/" + folderLoader.currentFolderId, folderPagesView.currentIndex)
pageIntent = 0
}
// 添加边界释放动画
PropertyAnimation {
id: boundaryAnimation
target: folderPagesView
property: "contentX"
duration: 200
easing.type: Easing.OutQuad
}
这个修改建议既保持了原有的边界检查功能,又增加了响应性和安全性。建议在实现时根据实际需求调整动画参数和验证逻辑。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Fix issue with icon drag-and-drop release failure
Log: Fix issue with icon drag-and-drop release failure
pms: BUG-344221
Summary by Sourcery
Bug Fixes: