nlineargauge: comment cleanup and simplified logic with a single "raw" property

This commit is contained in:
Lemmy
2026-03-04 09:49:07 -05:00
parent ced71e945f
commit 57b9c2edd9
+4 -6
View File
@@ -14,14 +14,12 @@ Rectangle {
property color fillColor: Color.mPrimary
// Fill that grows from bottom if vertical and left if horizontal.
// Snap to zero if the computed pixel length is smaller than 2*radius
// (the minimum needed to render a clean pill), rather than clamping to a minimum.
// Snap to zero if the computed pixel length is sub-pixel (< 1px).
Rectangle {
readonly property real clampedRatio: Math.min(1, Math.max(0, root.ratio))
readonly property real rawWidth: root.width * clampedRatio
readonly property real rawHeight: root.height * clampedRatio
width: orientation === Qt.Vertical ? root.width : (rawWidth < 1 ? 0 : rawWidth)
height: orientation === Qt.Vertical ? (rawHeight < 1 ? 0 : rawHeight) : root.height
readonly property real rawFill: (orientation === Qt.Vertical ? root.height : root.width) * clampedRatio
width: orientation === Qt.Vertical ? root.width : (rawFill < 1 ? 0 : rawFill)
height: orientation === Qt.Vertical ? (rawFill < 1 ? 0 : rawFill) : root.height
radius: root.radius
color: root.fillColor
anchors.bottom: orientation === Qt.Vertical ? parent.bottom : undefined