forked from Shinonome/dots-hyprland
booru: prevent GOAWAY on sidebar resize
This commit is contained in:
@@ -22,7 +22,7 @@ Rectangle {
|
||||
property string downloadPath
|
||||
property string nsfwPath
|
||||
|
||||
property real availableWidth: parent.width ?? 0
|
||||
property real availableWidth: parent.width
|
||||
property real rowTooShortThreshold: 185
|
||||
property real imageSpacing: 5
|
||||
property real responsePadding: 5
|
||||
@@ -31,6 +31,26 @@ Rectangle {
|
||||
anchors.right: parent?.right
|
||||
implicitHeight: columnLayout.implicitHeight + root.responsePadding * 2
|
||||
|
||||
Component.onCompleted: {
|
||||
// Break property bind to prevent aggressive updates
|
||||
availableWidth = parent.width
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: parent
|
||||
function onWidthChanged() {
|
||||
updateWidthTimer.restart()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: updateWidthTimer
|
||||
interval: 100
|
||||
onTriggered: {
|
||||
availableWidth = parent.width
|
||||
}
|
||||
}
|
||||
|
||||
radius: Appearance.rounding.normal
|
||||
color: Appearance.colors.colLayer1
|
||||
|
||||
@@ -159,7 +179,8 @@ Rectangle {
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: {
|
||||
model: ScriptModel {
|
||||
values: {
|
||||
// Group two images every row, ensuring they are of the same height
|
||||
// If the height ends up being too small, put one image in the row and continue
|
||||
// In other words, this is similar to Android's gallery layout at largest zoom level
|
||||
@@ -199,6 +220,7 @@ Rectangle {
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
delegate: RowLayout {
|
||||
id: imageRow
|
||||
property var rowHeight: modelData.height
|
||||
|
||||
Reference in New Issue
Block a user