notifs: rounded clippingrect
This commit is contained in:
parent
e4770e51f5
commit
f6df636286
1 changed files with 64 additions and 58 deletions
|
|
@ -16,81 +16,87 @@ Item {
|
|||
implicitWidth: NotifsConfig.sizes.width + root.padding * 2
|
||||
implicitHeight: list.implicitHeight + root.padding * 2
|
||||
|
||||
ListView {
|
||||
id: list
|
||||
|
||||
model: ScriptModel {
|
||||
values: [...Notifs.popups].reverse()
|
||||
}
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: root.padding
|
||||
|
||||
implicitHeight: {
|
||||
let height = (count - 1) * spacing;
|
||||
for (let i = 0; i < count; i++)
|
||||
height += itemAtIndex(i)?.nonAnimHeight ?? 0;
|
||||
color: "transparent"
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
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;
|
||||
ListView {
|
||||
id: list
|
||||
|
||||
model: ScriptModel {
|
||||
values: [...Notifs.popups].reverse()
|
||||
}
|
||||
|
||||
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) {
|
||||
const h = panel.session.y - BorderConfig.rounding * 2;
|
||||
if (height > h)
|
||||
height = h;
|
||||
return Math.max(61, Math.min((screen?.height ?? 0) - root.padding * 2 - BorderConfig.thickness * 2, height));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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 {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
displaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
Anim {
|
||||
property: "y"
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue