mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
Adde Loader to only load shapes once the correct path has been generated (#851)
This commit is contained in:
@@ -31,6 +31,25 @@ Item {
|
|||||||
readonly property string mainPath: generatePathForPosition(width, height)
|
readonly property string mainPath: generatePathForPosition(width, height)
|
||||||
readonly property string borderFullPath: generateBorderFullPath(width, height)
|
readonly property string borderFullPath: generateBorderFullPath(width, height)
|
||||||
readonly property string borderEdgePath: generateBorderEdgePath(width, height)
|
readonly property string borderEdgePath: generateBorderEdgePath(width, height)
|
||||||
|
property bool mainPathCorrectShape: false
|
||||||
|
property bool borderFullPathCorrectShape: false
|
||||||
|
property bool borderEdgePathCorrectShape: false
|
||||||
|
|
||||||
|
onMainPathChanged: {
|
||||||
|
if (width > 0 && height > 0){
|
||||||
|
root:mainPathCorrectShape = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBorderFullPathChanged: {
|
||||||
|
if (width > 0 && height > 0){
|
||||||
|
root:borderFullPathCorrectShape = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBorderEdgePathChanged: {
|
||||||
|
if (width > 0 && height > 0){
|
||||||
|
root:borderEdgePathCorrectShape = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -51,27 +70,31 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape {
|
|
||||||
|
Loader {
|
||||||
id: barShape
|
id: barShape
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
preferredRendererType: Shape.CurveRenderer
|
active: mainPathCorrectShape
|
||||||
|
sourceComponent: Shape {
|
||||||
|
anchors.fill: parent
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
|
||||||
ShapePath {
|
ShapePath {
|
||||||
fillColor: barWindow._bgColor
|
fillColor: barWindow._bgColor
|
||||||
strokeColor: "transparent"
|
strokeColor: "transparent"
|
||||||
strokeWidth: 0
|
strokeWidth: 0
|
||||||
|
|
||||||
PathSvg {
|
PathSvg {
|
||||||
path: root.mainPath
|
path: root.mainPath
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape {
|
Loader {
|
||||||
id: barBorder
|
id: barBorder
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: barConfig?.borderEnabled ?? false
|
active: borderFullPathCorrectShape && borderEdgePathCorrectShape
|
||||||
preferredRendererType: Shape.CurveRenderer
|
|
||||||
|
|
||||||
readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1)
|
readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1)
|
||||||
readonly property real inset: showFullBorder ? Math.ceil(borderThickness / 2) : borderThickness / 2
|
readonly property real inset: showFullBorder ? Math.ceil(borderThickness / 2) : borderThickness / 2
|
||||||
@@ -79,16 +102,22 @@ Item {
|
|||||||
readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary
|
readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary
|
||||||
readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0)
|
readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0)
|
||||||
readonly property bool showFullBorder: (barConfig?.spacing ?? 4) > 0
|
readonly property bool showFullBorder: (barConfig?.spacing ?? 4) > 0
|
||||||
|
sourceComponent: Shape {
|
||||||
|
id: barBorderShape
|
||||||
|
anchors.fill: parent
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
visible: barConfig?.borderEnabled ?? false
|
||||||
|
|
||||||
ShapePath {
|
ShapePath {
|
||||||
fillColor: "transparent"
|
fillColor: "transparent"
|
||||||
strokeColor: barBorder.borderColor
|
strokeColor: barBorder.borderColor
|
||||||
strokeWidth: barBorder.borderThickness
|
strokeWidth: barBorder.borderThickness
|
||||||
joinStyle: ShapePath.RoundJoin
|
joinStyle: ShapePath.RoundJoin
|
||||||
capStyle: ShapePath.FlatCap
|
capStyle: ShapePath.FlatCap
|
||||||
|
|
||||||
PathSvg {
|
PathSvg {
|
||||||
path: barBorder.showFullBorder ? root.borderFullPath : root.borderEdgePath
|
path: barBorder.showFullBorder ? root.borderFullPath : root.borderEdgePath
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user