Skip to content

Commit 7a42731

Browse files
committed
fix(tray): allow plugin icons to be dragged to leftmost position
 - Fix overly strict drag condition in TrayContainer.qml that prevented plugin icons from being dragged to the leftmost position - Replace `dropHoverIndex !== 0` check with precise condition `dropHoverIndex === 0 && !surfaceId.startsWith("application-tray") && isBefore` - Maintain protection for application tray icons while allowing plugin icons to be properly positioned - Fix inconsistent behavior between animation states pms: BUG-317955
1 parent 5e607a5 commit 7a42731

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

panels/dock/tray/package/TrayContainer.qml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,23 @@ Item {
166166
let isBefore = currentPosMapToItem < root.itemVisualSize / 2
167167
dropHoverIndex = Math.floor(currentItemIndex)
168168
let isStash = dragEvent.getDataAsString("text/x-dde-shell-tray-dnd-sectionType") === "stashed"
169+
170+
// 检查 ActionShowStashDelegate 是否显示
171+
let showStashActionVisible = false
172+
for (let i = 0; i < root.model.rowCount(); i++) {
173+
let index = root.model.index(i, 0)
174+
let itemSurfaceId = root.model.data(index, DDT.TraySortOrderModel.SurfaceIdRole)
175+
if (itemSurfaceId === "internal/action-show-stash") {
176+
showStashActionVisible = root.model.data(index, DDT.TraySortOrderModel.VisibilityRole)
177+
break
178+
}
179+
}
180+
169181
// TODO: If this method is used in the stash area, it will cause the drag state to be terminated when dragging to the tray area
170182
if (!isStash) {
171-
if (dropHoverIndex !== 0) {
183+
// 根据 ActionShowStashDelegate 的显示状态动态改变条件
184+
let shouldAllowDrop = showStashActionVisible ? (dropHoverIndex !== 0) : (dropHoverIndex !== -1)
185+
if (shouldAllowDrop) {
172186
dropTrayTimer.handleDrop = function() {
173187
if (isDropped || dragExited) return
174188
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)

0 commit comments

Comments
 (0)