@@ -48,6 +48,8 @@ ContainmentItem {
4848 model: DelegateModel {
4949 id: visualModel
5050 model: taskmanager .Applet .dataModel
51+ // 1:4 the distance between app : dock height; get width/height≈0.8
52+ property real cellWidth: Panel .rootObject .dockItemMaxSize * 0.8
5153 delegate: DropArea {
5254 id: delegateRoot
5355 required property bool active
@@ -78,9 +80,8 @@ ContainmentItem {
7880 Behavior on scale { NumberAnimation { duration: 200 } }
7981
8082 // TODO: 临时溢出逻辑,待后面修改
81- // 1:4 the distance between app : dock height; get width/height≈0.8
82- implicitWidth: useColumnLayout ? Panel .rootObject .dockItemMaxSize : Panel .rootObject .dockItemMaxSize * 0.8
83- implicitHeight: useColumnLayout ? Panel .rootObject .dockItemMaxSize * 0.8 : Panel .rootObject .dockItemMaxSize
83+ implicitWidth: useColumnLayout ? Panel .rootObject .dockItemMaxSize : visualModel .cellWidth
84+ implicitHeight: useColumnLayout ? visualModel .cellWidth : Panel .rootObject .dockItemMaxSize
8485
8586 onEntered : function (drag ) {
8687 visualModel .items .move ((drag .source as AppItem).visualIndex , app .visualIndex )
@@ -136,8 +137,7 @@ ContainmentItem {
136137 onPositionChanged : function (drag ) {
137138 if (launcherDndDesktopId === " " ) return
138139 let curX = taskmanager .useColumnLayout ? drag .y : drag .x
139- curX *= Screen .devicePixelRatio
140- let cellWidth = Panel .rootObject .dockItemMaxSize
140+ let cellWidth = visualModel .cellWidth
141141 let curCell = curX / cellWidth
142142 let appId = taskmanager .Applet .desktopIdToAppId (launcherDndDesktopId)
143143 taskmanager .Applet .dataModel .moveTo (appId, curCell)
@@ -146,8 +146,7 @@ ContainmentItem {
146146 onDropped : function (drop ) {
147147 if (launcherDndDesktopId === " " ) return
148148 let curX = taskmanager .useColumnLayout ? drop .y : drop .x
149- curX *= Screen .devicePixelRatio
150- let cellWidth = Panel .rootObject .dockItemMaxSize
149+ let cellWidth = visualModel .cellWidth
151150 let curCell = curX / cellWidth
152151 let appId = taskmanager .Applet .desktopIdToAppId (launcherDndDesktopId)
153152 taskmanager .Applet .dataModel .moveTo (appId, curCell)
0 commit comments