-
Notifications
You must be signed in to change notification settings - Fork 55
fix: disable dock panel dragging when locked #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disable dock panel dragging when locked #1320
Conversation
Reviewer's GuideThis PR enables activating applications by clicking on the taskbar when it’s locked by adding a click handler with coordinate mapping across all dock positions and exposing the app container for external access. Sequence diagram for handling drag area click in locked taskbar statesequenceDiagram
participant User as actor User
participant DragArea
participant Panel
participant TaskManager
participant AppContainer
participant DataModel
User->>DragArea: Click (x, y)
DragArea->>Panel: onClicked(mouse)
alt Panel.locked == true
Panel->>Panel: handleDragAreaClick(x, y)
Panel->>TaskManager: Get appContainer, dataModel
Panel->>AppContainer: mapToItem(x, y)
Panel->>AppContainer: indexAt(targetPos.x, targetPos.y)
AppContainer-->>Panel: clickedIndex
Panel->>DataModel: index(clickedIndex, 0)
Panel->>TaskManager: requestActivate(modelIndex)
end
Class diagram for updated TaskManager and appContainer exposureclassDiagram
class TaskManager {
+int dockOrder
+int remainingSpacesForTaskManager
+int forceRelayoutWorkaround
+appContainer
}
class AppContainer {
+implicitWidth
+height
+width
+indexAt(x, y)
}
TaskManager --> AppContainer: appContainer (alias)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- handleDragAreaClick has duplicate logic for Dock.Bottom and Dock.Top—consider merging those branches to reduce duplication.
- After invoking handleDragAreaClick, explicitly accept or stop the click event to prevent unintended propagation since onClicked handlers don’t use the returned boolean.
- The alias property name 'appContainer' shadows the id inside TaskManager.qml—consider renaming the alias to avoid potential collisions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- handleDragAreaClick has duplicate logic for Dock.Bottom and Dock.Top—consider merging those branches to reduce duplication.
- After invoking handleDragAreaClick, explicitly accept or stop the click event to prevent unintended propagation since onClicked handlers don’t use the returned boolean.
- The alias property name 'appContainer' shadows the id inside TaskManager.qml—consider renaming the alias to avoid potential collisions.
## Individual Comments
### Comment 1
<location> `panels/dock/package/main.qml:284-295` </location>
<code_context>
+
+ // 根据dock位置调整坐标映射逻辑
+ let targetPos = Qt.point(0, 0)
+ if (Panel.position === Dock.Bottom) {
+ targetPos.x = dragAreaPos.x
+ targetPos.y = appContainer.height / 2
+ } else if (Panel.position === Dock.Top) {
+ targetPos.x = dragAreaPos.x
+ targetPos.y = appContainer.height / 2
+ } else if (Panel.position === Dock.Left) {
+ targetPos.x = appContainer.width / 2
+ targetPos.y = dragAreaPos.y
+ } else if (Panel.position === Dock.Right) {
+ targetPos.x = appContainer.width / 2
+ targetPos.y = dragAreaPos.y
</code_context>
<issue_to_address>
**suggestion:** Coordinate mapping logic for dock positions is duplicated for Top and Bottom.
Consolidate the Dock.Top and Dock.Bottom cases since they share identical logic, which will simplify the code and make future maintenance easier.
```suggestion
if (Panel.position === Dock.Top || Panel.position === Dock.Bottom) {
targetPos.x = dragAreaPos.x
targetPos.y = appContainer.height / 2
} else if (Panel.position === Dock.Left) {
targetPos.x = appContainer.width / 2
targetPos.y = dragAreaPos.y
} else if (Panel.position === Dock.Right) {
targetPos.x = appContainer.width / 2
targetPos.y = dragAreaPos.y
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
9fc7ca4 to
ff12740
Compare
1. Added enabled property binding to prevent dock panel dragging when Panel.locked is true 2. This ensures the dock panel cannot be accidentally moved when the panel is locked 3. Maintains existing cursor shape behavior that shows locked state 4. Improves user experience by preventing unintended interactions with locked panels fix: 锁定状态下禁用停靠面板拖动 1. 添加 enabled 属性绑定,当 Panel.locked 为 true 时防止停靠面板拖动 2. 确保面板锁定时不会意外移动停靠面板 3. 保持现有的光标形状行为以显示锁定状态 4. 通过防止与锁定面板的意外交互来改善用户体验 PMS: TASK-383127
ff12740 to
8e10276
Compare
deepin pr auto review我来分析这段代码的变更:
改进建议:
// 当面板锁定时禁用鼠标交互
enabled: !Panel.locked
readonly property bool isInteractionEnabled: !Panel.locked
enabled: isInteractionEnabled
总体来说,这是一个很好的改进,提高了代码的安全性和用户体验。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wjyrich 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Panel.locked is true
panel is locked
locked panels
fix: 锁定状态下禁用停靠面板拖动
PMS: TASK-383127