mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Fix tankbar offset at gas switch event
When painting the tankbar the function triggers on change in cylinder index, as a result the new gascolour are changed at the next sample time point. On a divecomputer with a reasonable fast sample rate the 2-3s offset are hardly noticable, especially on a longer dive. For divecomputers with slow sample rate the 10-30s offset are clearly visible. This is fixed by start painting the new gascolour at the time point of the switch event rather than the time point of the next sample. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
f7cecf506f
commit
dd2791fa1e
1 changed files with 4 additions and 2 deletions
|
@ -93,6 +93,7 @@ void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &b
|
||||||
|
|
||||||
// walk the list and figure out which tanks go where
|
// walk the list and figure out which tanks go where
|
||||||
struct plot_data *entry = pInfoEntry;
|
struct plot_data *entry = pInfoEntry;
|
||||||
|
struct plot_data *lastentry = pInfoEntry;
|
||||||
int cylIdx = entry->cylinderindex;
|
int cylIdx = entry->cylinderindex;
|
||||||
int i = -1;
|
int i = -1;
|
||||||
int startTime = 0;
|
int startTime = 0;
|
||||||
|
@ -100,14 +101,15 @@ void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &b
|
||||||
qreal width, left;
|
qreal width, left;
|
||||||
while (++i < pInfoNr) {
|
while (++i < pInfoNr) {
|
||||||
entry = &pInfoEntry[i];
|
entry = &pInfoEntry[i];
|
||||||
|
lastentry = &pInfoEntry[i-1];
|
||||||
if (entry->cylinderindex == cylIdx)
|
if (entry->cylinderindex == cylIdx)
|
||||||
continue;
|
continue;
|
||||||
width = hAxis->posAtValue(entry->sec) - hAxis->posAtValue(startTime);
|
width = hAxis->posAtValue(lastentry->sec) - hAxis->posAtValue(startTime);
|
||||||
left = hAxis->posAtValue(startTime);
|
left = hAxis->posAtValue(startTime);
|
||||||
createBar(left, width, gas);
|
createBar(left, width, gas);
|
||||||
cylIdx = entry->cylinderindex;
|
cylIdx = entry->cylinderindex;
|
||||||
gas = &diveCylinderStore.cylinder[cylIdx].gasmix;
|
gas = &diveCylinderStore.cylinder[cylIdx].gasmix;
|
||||||
startTime = entry->sec;
|
startTime = lastentry->sec;
|
||||||
}
|
}
|
||||||
width = hAxis->posAtValue(entry->sec) - hAxis->posAtValue(startTime);
|
width = hAxis->posAtValue(entry->sec) - hAxis->posAtValue(startTime);
|
||||||
left = hAxis->posAtValue(startTime);
|
left = hAxis->posAtValue(startTime);
|
||||||
|
|
Loading…
Reference in a new issue