Skip to content

Commit 4e693de

Browse files
committed
fix: widget background clipping not working with foreground shadow
1 parent 54f408b commit 4e693de

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

package/contents/ui/components/CustomBackground.qml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ Rectangle {
751751
}
752752

753753
DropShadow {
754-
id: dropShadow
754+
id: foregroundShadow
755755
anchors.fill: parent
756756
// we need to compensate because we now space widgets with margins
757757
// instead of the layout spacing for the widget islands feature
@@ -769,7 +769,7 @@ Rectangle {
769769
samples: radius * 2 + 1
770770
spread: 0.35
771771
color: {
772-
return Utils.getColor(shadowColorCfg, rect.targetIndex, rect.color, rect.itemType, dropShadow);
772+
return Utils.getColor(shadowColorCfg, rect.targetIndex, rect.color, rect.itemType, foregroundShadow);
773773
}
774774
source: rect.target?.applet ?? null
775775
visible: rect.fgShadowEnabled
@@ -995,7 +995,7 @@ Rectangle {
995995
}
996996

997997
ShaderEffectSource {
998-
id: clipSourceShaderItem
998+
id: clipAppletSource
999999
live: true
10001000
sourceItem: {
10011001
if (rect.backgroundClipping) {
@@ -1006,6 +1006,18 @@ Rectangle {
10061006
hideSource: true
10071007
}
10081008

1009+
ShaderEffectSource {
1010+
id: clipShadowSource
1011+
live: true
1012+
sourceItem: {
1013+
if (rect.backgroundClipping && rect.fgShadowEnabled) {
1014+
return foregroundShadow;
1015+
}
1016+
return null;
1017+
}
1018+
hideSource: true
1019+
}
1020+
10091021
// clip widget content to custom background shape
10101022
// TODO: figure out how to do the same with the panel
10111023
OpacityMask {
@@ -1016,6 +1028,16 @@ Rectangle {
10161028
anchors.bottomMargin: rect.horizontal ? undefined : rect.marginBottom
10171029
maskSource: mask
10181030
visible: !!source
1019-
source: clipSourceShaderItem
1031+
source: clipAppletSource
1032+
}
1033+
OpacityMask {
1034+
anchors.fill: parent
1035+
anchors.leftMargin: rect.horizontal ? rect.marginLeft : undefined
1036+
anchors.rightMargin: rect.horizontal ? rect.marginRight : undefined
1037+
anchors.topMargin: rect.horizontal ? undefined : rect.marginTop
1038+
anchors.bottomMargin: rect.horizontal ? undefined : rect.marginBottom
1039+
maskSource: mask
1040+
visible: !!source
1041+
source: clipShadowSource
10201042
}
10211043
}

0 commit comments

Comments
 (0)