mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-15 02:02:08 -04: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,8 +70,12 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape {
|
|
||||||
|
Loader {
|
||||||
id: barShape
|
id: barShape
|
||||||
|
anchors.fill: parent
|
||||||
|
active: mainPathCorrectShape
|
||||||
|
sourceComponent: Shape {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
preferredRendererType: Shape.CurveRenderer
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
|
||||||
@@ -66,12 +89,12 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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,6 +102,11 @@ 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"
|
||||||
@@ -92,6 +120,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generatePathForPosition(w, h) {
|
function generatePathForPosition(w, h) {
|
||||||
if (isTop)
|
if (isTop)
|
||||||
|
|||||||
Reference in New Issue
Block a user