fix(ButtonPanel): add hasAnimation check to enableAnimation property#629
Merged
Conversation
18202781743
reviewed
Jun 1, 2026
1. Remove CicleSpreadAnimation and its hover state handler from ButtonPanel 2. Remove Rectangle overlay and trigger function tied to button.hoveredChanged 3. Update copyright year to 2022-2026 Log: Remove CicleSpreadAnimation hover effect from ButtonPanel refactor(ButtonPanel): 移除 CicleSpreadAnimation 悬停动画效果 1. 从 ButtonPanel 中移除 CicleSpreadAnimation 及其悬停状态处理器 2. 移除与 button.hoveredChanged 绑定的 Rectangle 覆盖层和 trigger 函数 3. 更新版权年份至 2022-2026 Log: 从 ButtonPanel 移除 CicleSpreadAnimation 悬停动画效果
Contributor
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的 Git Diff 输入。本次代码变更主要涉及两部分:一是更新了版权声明年份,二是删除了 以下是我对本次代码变更的详细审查意见: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
💡 附加建议(针对原代码的复盘)虽然原代码已被删除,但为了帮助你在未来编写更优质的 QML 代码,我对原代码的写法做一个复盘: 点击查看原代码改进方案(如果保留的话)如果这段动画逻辑需要保留或在未来重写,建议进行如下优化: CicleSpreadAnimation {
id: hoverAnimation
anchors.fill: parent
visible: enableAnimation
Rectangle {
anchors.fill: parent
radius: control.radius
color: control.D.ColorSelector.color1
}
// 1. 修正拼写错误 triggle -> trigger
function trigger() {
if (button.hovered) {
// 2. 建议增加边界检查,防止 cursorPosition 返回无效值
var pos = D.DTK.cursorPosition()
if (pos) {
hoverAnimation.centerPoint = hoverAnimation.mapFromGlobal(pos.x, pos.y)
hoverAnimation.start()
}
} else {
hoverAnimation.stop()
}
}
// 3. 使用声明式绑定替代命令式 connect,更符合 QML 范式,且自动管理生命周期
Connections {
target: button
function onHoveredChanged() {
hoverAnimation.trigger()
}
}
}总结:本次 Diff 整体变更清晰,删除了冗余和带有轻微代码异味(拼写错误、命令式 connect)的代码,且没有引入新的语法或安全问题。唯一需要确认的是:删除悬停动画是否符合产品需求,以及是否需要同步清理 |
18202781743
approved these changes
Jun 1, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
Contributor
Author
|
跟设计师沟通过,直接删除Hover下的扩散动画 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Add hasAnimation check to ButtonPanel enableAnimation to respect system animation settings
fix(ButtonPanel): 为 enableAnimation 属性添加 hasAnimation 检查
Log: 为 ButtonPanel 的 enableAnimation 添加 hasAnimation 检查,以遵循系统动画设置