mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
sidebar: quick toggles: smoother size change
This commit is contained in:
@@ -22,6 +22,8 @@ Button {
|
||||
property bool bounce: true
|
||||
property real baseWidth: contentItem.implicitWidth + horizontalPadding * 2
|
||||
property real baseHeight: contentItem.implicitHeight + verticalPadding * 2
|
||||
property bool enableImplicitWidthAnimation: true
|
||||
property bool enableImplicitHeightAnimation: true
|
||||
property real clickedWidth: baseWidth + (isAtSide ? 10 : 20)
|
||||
property real clickedHeight: baseHeight
|
||||
property var parentGroup: root.parent
|
||||
@@ -61,10 +63,12 @@ Button {
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.enableImplicitWidthAnimation
|
||||
animation: Appearance.animation.clickBounce.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
enabled: root.enableImplicitHeightAnimation
|
||||
animation: Appearance.animation.clickBounce.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -73,14 +73,14 @@ AbstractQuickPanel {
|
||||
Repeater {
|
||||
id: usedRowsRepeater
|
||||
model: ScriptModel {
|
||||
values: root.toggleRows
|
||||
values: Array(root.toggleRows.length)
|
||||
}
|
||||
delegate: ButtonGroup {
|
||||
id: toggleRow
|
||||
required property var modelData
|
||||
required property int index
|
||||
property var modelData: root.toggleRows[index]
|
||||
property int startingIndex: {
|
||||
const rows = usedRowsRepeater.model.values;
|
||||
const rows = root.toggleRows;
|
||||
let sum = 0;
|
||||
for (let i = 0; i < index; i++) {
|
||||
sum += rows[i].length;
|
||||
@@ -91,7 +91,8 @@ AbstractQuickPanel {
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
values: toggleRow.modelData
|
||||
values: toggleRow?.modelData ?? []
|
||||
objectProp: "type"
|
||||
}
|
||||
delegate: AndroidToggleDelegateChooser {
|
||||
startingIndex: toggleRow.startingIndex
|
||||
@@ -131,16 +132,18 @@ AbstractQuickPanel {
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
values: root.unusedToggleRows
|
||||
values: Array(root.unusedToggleRows.length)
|
||||
}
|
||||
delegate: ButtonGroup {
|
||||
id: unusedToggleRow
|
||||
required property var modelData
|
||||
required property int index
|
||||
property var modelData: root.unusedToggleRows[index]
|
||||
spacing: root.spacing
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
values: unusedToggleRow.modelData
|
||||
values: unusedToggleRow?.modelData ?? []
|
||||
objectProp: "type"
|
||||
}
|
||||
delegate: AndroidToggleDelegateChooser {
|
||||
startingIndex: -1
|
||||
|
||||
+15
@@ -23,6 +23,21 @@ GroupButton {
|
||||
baseHeight: root.baseCellHeight
|
||||
|
||||
property bool editMode: false
|
||||
enableImplicitWidthAnimation: !editMode
|
||||
enableImplicitHeightAnimation: !editMode
|
||||
Behavior on baseWidth {
|
||||
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
|
||||
}
|
||||
Behavior on baseHeight {
|
||||
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
|
||||
}
|
||||
opacity: 0
|
||||
Component.onCompleted: {
|
||||
opacity = 1
|
||||
}
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
signal openMenu()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user