Skip to content

Commit 38f7b9a

Browse files
committed
Fine-tune BatteryParticles.qml for consistent visuals
- Updated designProperties for subtler particle sizes: - Diamonds/Bubbles: initialSize 0.3 (was 0.4), maxSize 0.9 (was 1.0). - Logos: initialSize 0.4 (was 0.5), maxSize 1.2. - Flashes: initialSize 0.6, maxSize 1.4 (unchanged). - Set maxOpacity to 0.6 across all designs for consistent appearance. - Removed console logs for PR readiness.
1 parent d2bb5be commit 38f7b9a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/controls/qml/BatteryParticles.qml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,18 @@ Item {
111111
*/
112112
property string design: "diamonds"
113113

114+
/*!
115+
\qmlproperty rect BatteryParticles::clipBounds
116+
The bounding rectangle (x, y, width, height) for clipping. Particles are destroyed if they move outside this area.
117+
*/
118+
property rect clipBounds: Qt.rect(0, 0, 0, 0)
119+
114120
// Define design-specific properties
115121
property var designProperties: {
116-
"diamonds": { initialSize: 0.4, maxSize: 1.0, initialOpacity: 0, maxOpacity: 0.4 },
117-
"bubbles": { initialSize: 0.4, maxSize: 1.0, initialOpacity: 0, maxOpacity: 0.4 },
118-
"logos": { initialSize: 0.5, maxSize: 1.2, initialOpacity: 0, maxOpacity: 0.6 },
119-
"flashes": { initialSize: 0.6, maxSize: 1.4, initialOpacity: 0, maxOpacity: 0.7 }
122+
"diamonds": { initialSize: 0.3, maxSize: 0.9, initialOpacity: 0, maxOpacity: 0.6 },
123+
"bubbles": { initialSize: 0.3, maxSize: 0.9, initialOpacity: 0, maxOpacity: 0.6 },
124+
"logos": { initialSize: 0.4, maxSize: 1.2, initialOpacity: 0, maxOpacity: 0.6 },
125+
"flashes": { initialSize: 0.6, maxSize: 1.4, initialOpacity: 0, maxOpacity: 0.6 }
120126
}
121127

122128
// Get design properties with fallback
@@ -126,6 +132,15 @@ Item {
126132
: designProperties["diamonds"][propName];
127133
}
128134

135+
// Check if particle is outside clipBounds and destroy if so
136+
onXChanged: {
137+
if (clipBounds.width > 0 && clipBounds.height > 0) {
138+
if (x < clipBounds.x - maxSize || x > clipBounds.x + clipBounds.width) {
139+
particleRoot.destroy();
140+
}
141+
}
142+
}
143+
129144
// Destroy timer to handle particle cleanup
130145
Timer {
131146
id: destroyTimer

0 commit comments

Comments
 (0)