mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
nlineargauge: comment cleanup and simplified logic with a single "raw" property
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user