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