mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 05:23:51 +00:00
fixed drawKnob for the case where curValue or min/max are not yet initialized
This commit is contained in:
1 parent
f590b71f4c
commit
4e9421110d
3 files changed
+25
-5
No files matched your search
+23
-3
@@ -21,6 +21,13 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
|
||||
private RegattaAndRaceIdentifier selectedRace;
|
||||
private boolean autoAdjustPlayMode;
|
||||
private RaceTimesInfoDTO lastRaceTimesInfo;
|
||||
|
||||
/**
|
||||
* When a marker update is required but min/max are not yet initialized, this flag is set. If later
|
||||
* {@link #setMinMax(Date, Date, boolean)} is invoked and this flag is set, a {@link #redrawAllMarkers(RaceTimesInfoDTO)}
|
||||
* will be issued and the flag is cleared.
|
||||
*/
|
||||
private boolean redrawAllMarkersPendingForMinMaxBeingInitialized;
|
||||
|
||||
public RaceTimePanel(Timer timer, TimeRangeWithZoomProvider timeRangeProvider, StringMessages stringMessages,
|
||||
RaceTimesInfoProvider raceTimesInfoProvider, boolean canReplayWhileLiveIsPossible) {
|
||||
@@ -105,7 +112,7 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
|
||||
// maybe show a special state for this like "Race did not start yet"
|
||||
}
|
||||
}
|
||||
lastRaceTimesInfo = raceTimesInfo;
|
||||
lastRaceTimesInfo = raceTimesInfo; // TODO bug 3122: when not redrawn yet because min/max not initialized yet, further redraw is disabled by this.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,6 +188,15 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinMax(Date min, Date max, boolean fireEvent) {
|
||||
super.setMinMax(min, max, fireEvent);
|
||||
if (redrawAllMarkersPendingForMinMaxBeingInitialized && timeSlider.isMinMaxInitialized()) {
|
||||
redrawAllMarkers(lastRaceTimesInfo);
|
||||
redrawAllMarkersPendingForMinMaxBeingInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When in {@link PlayModes#Replay} mode, tries to put the {@link #timer} to the time point when the last leg was
|
||||
* finished first. If this time point is not (yet?) known, tries to put the {@link #timer} to the
|
||||
@@ -239,8 +255,12 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
|
||||
requiresMarkerUpdate = true;
|
||||
}
|
||||
}
|
||||
if (requiresMarkerUpdate && timeSlider.isMinMaxInitialized()) {
|
||||
redrawAllMarkers(newRaceTimesInfo);
|
||||
if (requiresMarkerUpdate) {
|
||||
if (timeSlider.isMinMaxInitialized()) { // TODO bug 3122 later, the lastRaceTimesInfo will be updated even if not redrawn because min/max not initialized
|
||||
redrawAllMarkers(newRaceTimesInfo);
|
||||
} else {
|
||||
redrawAllMarkersPendingForMinMaxBeingInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -405,7 +405,7 @@ public class TimePanel<T extends TimePanelSettings> extends SimplePanel implemen
|
||||
timeSlider.setMinValue(new Double(min.getTime()), fireEvent);
|
||||
}
|
||||
if (changed) {
|
||||
if(!timeRangeProvider.isZoomed()) {
|
||||
if (!timeRangeProvider.isZoomed()) {
|
||||
timeRangeProvider.setTimeRange(min, max, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public class TimeSlider extends SliderBar {
|
||||
return;
|
||||
|
||||
Element knobElement = knobImage.getElement();
|
||||
if(curValue >= minValue && curValue <= maxValue) {
|
||||
if (curValue != null && minValue != null && maxValue != null && curValue >= minValue && curValue <= maxValue) {
|
||||
// Move the knob to the correct position
|
||||
int lineWidth = lineElement.getOffsetWidth();
|
||||
int knobWidth = knobElement.getOffsetWidth();
|
||||
|
||||
Reference in new issue
Block a user