From 43399c9f45c8fd4c85f6d3c46d565e99db420c0e Mon Sep 17 00:00:00 2001 From: orblazer Date: Thu, 2 Dec 2021 13:59:26 +0100 Subject: [PATCH] fix(graph): correctly show the value of clock when hover --- package/contents/ui/components/SensorGraph.qml | 8 ++++++-- package/contents/ui/main.qml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package/contents/ui/components/SensorGraph.qml b/package/contents/ui/components/SensorGraph.qml index 7913bfb..5b08fcb 100644 --- a/package/contents/ui/components/SensorGraph.qml +++ b/package/contents/ui/components/SensorGraph.qml @@ -159,6 +159,7 @@ Item { id: secondLineLabel width: parent.width height: contentHeight + property string lastValue: '' text: secondLabel color: secondLabelColor @@ -259,7 +260,7 @@ Item { if (plotter.values.length > 1) { secondLineLabel.text = formatLabel(plotter.values[1], sensorGraph.secondSensorUnits) secondLineLabel.visible = true - } else { + } else if (!secondLineLabel.keepVisible) { secondLineLabel.text = '' secondLineLabel.visible = false } @@ -306,7 +307,10 @@ Item { firstLineLabel.text = formatLabel(plotter.values[0], sensorGraph.firstSensorUnits) if (plotter.values.length > 1) { secondLineLabel.text = formatLabel(plotter.values[1], sensorGraph.secondSensorUnits) - secondLineLabel.visible = (plotter.values[1] !== 0 || secondLabelWhenZero) ? true : false + secondLineLabel.visible = plotter.values[1] !== 0 || secondLabelWhenZero + } else if (secondLineLabel.lastValue != 0 && secondLabelWhenZero) { + secondLineLabel.text = secondLineLabel.lastValue + secondLineLabel.visible = true } else { secondLineLabel.text = '' secondLineLabel.visible = false diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index d5952e1..cf32281 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -144,7 +144,8 @@ Item { // Update labels if (cpuGraph.valueVisible) { - cpuGraph.secondLineLabel.text = cpuGraph.formatLabel(sensorData.getData(sensorData.sensors.averageClock), units) + cpuGraph.secondLineLabel.text = cpuGraph.secondLineLabel.lastValue = cpuGraph.formatLabel( + sensorData.getData(sensorData.sensors.averageClock), units) cpuGraph.secondLineLabel.visible = true } }