notifs: rounded clippingrect

This commit is contained in:
2 * r + 2 * t 2025-05-27 09:08:19 +08:00
parent e4770e51f5
commit f6df636286

View file

@ -16,81 +16,87 @@ Item {
implicitWidth: NotifsConfig.sizes.width + root.padding * 2 implicitWidth: NotifsConfig.sizes.width + root.padding * 2
implicitHeight: list.implicitHeight + root.padding * 2 implicitHeight: list.implicitHeight + root.padding * 2
ListView { ClippingWrapperRectangle {
id: list
model: ScriptModel {
values: [...Notifs.popups].reverse()
}
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: root.padding anchors.margins: root.padding
implicitHeight: { color: "transparent"
let height = (count - 1) * spacing; radius: Appearance.rounding.normal
for (let i = 0; i < count; i++)
height += itemAtIndex(i)?.nonAnimHeight ?? 0;
const screen = QsWindow.window?.screen; ListView {
const visibilities = Visibilities.screens[screen]; id: list
const panel = Visibilities.panels[screen];
if (visibilities && panel) { model: ScriptModel {
if (visibilities.osd) { values: [...Notifs.popups].reverse()
const h = panel.osd.y - BorderConfig.rounding * 2; }
if (height > h)
height = h; anchors.fill: parent
implicitHeight: {
let height = (count - 1) * spacing;
for (let i = 0; i < count; i++)
height += itemAtIndex(i)?.nonAnimHeight ?? 0;
const screen = QsWindow.window?.screen;
const visibilities = Visibilities.screens[screen];
const panel = Visibilities.panels[screen];
if (visibilities && panel) {
if (visibilities.osd) {
const h = panel.osd.y - BorderConfig.rounding * 2;
if (height > h)
height = h;
}
if (visibilities.session) {
const h = panel.session.y - BorderConfig.rounding * 2;
if (height > h)
height = h;
}
} }
if (visibilities.session) { return Math.max(61, Math.min((screen?.height ?? 0) - root.padding * 2 - BorderConfig.thickness * 2, height));
const h = panel.session.y - BorderConfig.rounding * 2; }
if (height > h)
height = h; orientation: Qt.Vertical
spacing: Appearance.spacing.smaller
cacheBuffer: QsWindow.window?.screen.height ?? 0
delegate: ClippingRectangle {
id: wrapper
required property Notifs.Notif modelData
readonly property alias nonAnimHeight: notif.nonAnimHeight
color: "transparent"
radius: notif.radius
implicitWidth: notif.width
implicitHeight: notif.height
Notification {
id: notif
modelData: wrapper.modelData
} }
} }
return Math.max(61, Math.min(screen?.height - root.padding * 2 - BorderConfig.thickness * 2, height)); move: Transition {
} Anim {
property: "y"
orientation: Qt.Vertical }
spacing: Appearance.spacing.smaller
cacheBuffer: QsWindow.window?.screen.height ?? 0
clip: true
delegate: ClippingRectangle {
id: wrapper
required property Notifs.Notif modelData
readonly property alias nonAnimHeight: notif.nonAnimHeight
color: "transparent"
radius: notif.radius
implicitWidth: notif.width
implicitHeight: notif.height
Notification {
id: notif
modelData: wrapper.modelData
} }
}
move: Transition { displaced: Transition {
Anim { Anim {
property: "y" property: "y"
}
} }
}
displaced: Transition { Behavior on implicitHeight {
Anim { Anim {}
property: "y"
} }
} }
Behavior on implicitHeight {
Anim {}
}
} }
component Anim: NumberAnimation { component Anim: NumberAnimation {