-
Notifications
You must be signed in to change notification settings - Fork 40
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
Switch animations #408
base: master
Are you sure you want to change the base?
Switch animations #408
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kegechen The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#408
3ddbaa4
to
2e26910
Compare
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#408
2e26910
to
043cc46
Compare
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#408
DTK.hasAnimation and DQMLGlobalObject::hasAnimation()
hasAnimation to turn on/off animations
hasAnimation..
support DTK.hasAnimation
043cc46
to
1c726d0
Compare
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#408
@@ -94,18 +99,32 @@ T.ToolButton { | |||
NumberAnimation { properties: "scale"; easing.type: Easing.InOutQuad } | |||
} | |||
|
|||
onHoveredChanged: { |
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.
background可能被调用者重写,不能在外面用id的方式访问,否则可能访问无效,
buttonPanel.visible = 这种,直接赋值会中断绑定,尽量用属性绑定的方式
visible: control.state === "hovered" | ||
scale : 0.9 | ||
id: buttonPanel | ||
property var customColor: D.Palette { |
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.
直接用属性绑定的方式给color1和color2赋值,
buttonPanel.scale = 0.9 | ||
buttonPanel.color1 = buttonPanel.customColor | ||
buttonPanel.color2 = buttonPanel.customColor |
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.
应该少这种函数式的写法,直接用属性绑定方式,另外,为什么这里,有动画的时候scale需要设置为0.9呀,在上面不是1.0么,这个时机只有在初始化完成的时候做一次么?
property D.Palette textColor: { | ||
if (D.DTK.hasAnimation) | ||
return checked ? DS.Style.highlightedButton.text : (highlighted ? DS.Style.highlightedButton.text : DS.Style.button.text) | ||
|
||
return checked ? DS.Style.checkedButton.text : (highlighted ? DS.Style.highlightedButton.text : DS.Style.button.text) | ||
} |
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.
它们之间的差别是 checked的时候,有动画取highlightedButton.text,没动画取checkedButton.text?
这是设计上的区别么?
} | ||
|
||
indicator: D.DTK.hasAnimation ? dciIcon.createObject(control) : rect.createObject(control) |
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.
应该可以直接用Loader去实现,它可以自己去管理创建的对象,用createObject的话靠的是set indicator方法了,比较隐晦,
handle.play(D.DTK.NormalState) | ||
toggletimer.start(); | ||
Component { | ||
id: dciIcon |
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.
组件名字尽量取有意义的,animationIndicatorCom
add
DTK.hasAnimation
property andDQMLGlobalObject::hasAnimation()