diff options
author | Suchinton Chakravarty <suchinton.2001@gmail.com> | 2024-10-10 18:16:07 +0530 |
---|---|---|
committer | Suchinton Chakravarty <suchinton.2001@gmail.com> | 2024-10-14 15:03:20 +0530 |
commit | 2e2dd79e41b27a1d50be3c118955cdbd76e65539 (patch) | |
tree | 1650d28a3dd3de761303a8c4013e4415bdcabf03 /QMLWidgets/Full_Gauge/SpeedGauge.qml | |
parent | 554ec4cd07d68f4bcb569277881e368c450d993a (diff) |
Add Tire Pressure, Keypad elements and misc. UI Changes
- Increased slider grab handle size
- Add floating menu for Tire Pressure UI
- Show errow in Playback toggle when CAN interface is not available
- Update Half gauges to show Unit and logo correctly
- Update App resources
- Add new tumbler input for HVAC temp
- Add new get function to KuksaClient to get Tire Pressure unit and Current value to increment
Fixes:
- Check for vcar dbc file at '/etc/kuksa-dbc-feeder/'
- Increase font size in Settings page
- Allow for tumbler/ spin wheel values to wrap around
Bug-AGL: SPEC-5161
Change-Id: I2386bf7dc762b09b83cef1be104a35d6afc0a704
Signed-off-by: Suchinton Chakravarty <suchinton.2001@gmail.com>
Diffstat (limited to 'QMLWidgets/Full_Gauge/SpeedGauge.qml')
-rw-r--r-- | QMLWidgets/Full_Gauge/SpeedGauge.qml | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/QMLWidgets/Full_Gauge/SpeedGauge.qml b/QMLWidgets/Full_Gauge/SpeedGauge.qml index 263e7f1..02531b7 100644 --- a/QMLWidgets/Full_Gauge/SpeedGauge.qml +++ b/QMLWidgets/Full_Gauge/SpeedGauge.qml @@ -94,9 +94,26 @@ Item { function drawProgress(ctx, center, progress) {
ctx.lineWidth = 20;
+
+ // Create a linear gradient
+ var gradient = ctx.createLinearGradient(
+ center.x + gaugeRadius * Math.cos(startAngle),
+ center.y + gaugeRadius * Math.sin(startAngle),
+ center.x + gaugeRadius * Math.cos(startAngle + fullAngle),
+ center.y + gaugeRadius * Math.sin(startAngle + fullAngle)
+ );
+
+ // Set gradient stops
+ gradient.addColorStop(0.3, "#00FF00"); // Green color
+ gradient.addColorStop(0.3, primaryColor); // Primary color
+ gradient.addColorStop(0.3, "#FFD700"); // Yellow color
+ gradient.addColorStop(1, "#FF0000"); // Red color
+
ctx.beginPath();
ctx.arc(center.x, center.y, gaugeRadius, startAngle, startAngle + (progress / 270) * fullAngle);
- ctx.strokeStyle = primaryColor;
+
+ // Apply the gradient to the stroke style
+ ctx.strokeStyle = gradient;
ctx.stroke();
}
@@ -118,17 +135,17 @@ Item { }
function drawProgressTick(ctx, center, progress) {
-
+
ctx.lineWidth = tickLength * 3
ctx.strokeStyle = '#FFFFFF'
ctx.beginPath()
-
+
const progressAngle = startAngle + (progress / 270) * fullAngle
const x1 = center.x + gaugeRadius * Math.cos(progressAngle)
const y1 = center.y + gaugeRadius * Math.sin(progressAngle)
const x2 = center.x + (gaugeRadius - tickLength * 1.5) * Math.cos(progressAngle)
const y2 = center.y + (gaugeRadius - tickLength * 1.5) * Math.sin(progressAngle)
-
+
ctx.moveTo(x1, y1)
ctx.lineTo(x2, y2)
ctx.stroke()
|