CHG: [history] wrap around

This commit is contained in:
Chris "koying" Browet 2019-06-27 17:26:03 +02:00 committed by Chris "Koying" Browet
parent 57c3083f9f
commit 13102a6b04
3 changed files with 34 additions and 1 deletions

View File

@ -202,6 +202,11 @@ class _CombinedHistoryChartWidgetState extends State<CombinedHistoryChartWidget>
_selectedId -= 1;
});
}
else {
setState(() {
_selectedId = _parsedHistory.first.data.length - 1;
});
}
}
void _selectNext() {
@ -210,6 +215,12 @@ class _CombinedHistoryChartWidgetState extends State<CombinedHistoryChartWidget>
_selectedId += 1;
});
}
else {
setState(() {
_selectedId = 0;
});
}
}
void _onSelectionChanged(charts.SelectionModel model) {

View File

@ -132,6 +132,11 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
_selectedId -= 1;
});
}
else {
setState(() {
_selectedId = _parsedHistory.first.data.length - 1;
});
}
}
void _selectNext() {
@ -140,6 +145,12 @@ class _NumericStateHistoryChartWidgetState extends State<NumericStateHistoryChar
_selectedId += 1;
});
}
else {
setState(() {
_selectedId = 0;
});
}
}
void _onSelectionChanged(charts.SelectionModel model) {

View File

@ -137,14 +137,25 @@ class _SimpleStateHistoryChartWidgetState extends State<SimpleStateHistoryChartW
_selectedId -= 1;
});
}
else {
setState(() {
_selectedId = _parsedHistory.first.data.length - 1;
});
}
}
void _selectNext() {
if (_selectedId < (_parsedHistory.first.data.length - 2)) {
if (_selectedId < (_parsedHistory.first.data.length - 1)) {
setState(() {
_selectedId += 1;
});
}
else {
setState(() {
_selectedId = 0;
});
}
}
void _onSelectionChanged(charts.SelectionModel model) {