Merge branch 'bug4202' of ssh://sapsailing.com/home/trac/git into bug4202

This commit is contained in:
Steffen Schaefer
2018-08-02 13:47:44 +02:00
3 changed files with 20 additions and 3 deletions
@@ -1226,7 +1226,7 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
private void updateBoatPositions(final Date newTime, final long transitionTimeInMillis,
final Map<CompetitorDTO, Boolean> hasTailOverlapForCompetitor,
final Iterable<CompetitorDTO> competitorsToShow, Map<CompetitorDTO, List<GPSFixDTOWithSpeedWindTackAndLegType>> boatData, boolean updateTailsOnly) {
if (zoomingAnimationsInProgress == 0) {
if (zoomingAnimationsInProgress == 0 || currentlyDragging) {
fixesAndTails.updateFixes(boatData, hasTailOverlapForCompetitor, RaceMap.this, transitionTimeInMillis);
showBoatsOnMap(newTime, transitionTimeInMillis,
/* re-calculate; it could have changed since the asynchronous request was made: */
@@ -1298,7 +1298,7 @@ public class RaceMap extends AbstractCompositeComponent<RaceMapSettings> impleme
}
private void showCourseMarksOnMap(CoursePositionsDTO courseDTO, long transitionTimeInMillis) {
if (zoomingAnimationsInProgress == 0) {
if (zoomingAnimationsInProgress == 0 || currentlyDragging) {
if (map != null && courseDTO != null) {
WaypointDTO endWaypointForCurrentLegNumber = null;
if (courseDTO.currentLegNumber > 0 && courseDTO.currentLegNumber <= courseDTO.totalLegsCount) {
@@ -232,11 +232,15 @@ public abstract class CanvasOverlayV3 {
protected abstract void draw();
protected void onAttach() {
}
protected OverlayViewOnAddHandler getOnAddHandler() {
OverlayViewOnAddHandler result = new OverlayViewOnAddHandler() {
@Override
public void onAdd(OverlayViewMethods methods) {
methods.getPanes().getMapPane().appendChild(canvas.getElement());
CanvasOverlayV3.this.onAttach();
}
};
return result;
@@ -70,6 +70,7 @@ public class WindStreamletsRaceboardOverlay extends MovingCanvasOverlay {
private double latitudeSum;
private ElementStyleMutationObserver observer;
private boolean dragging = false;
private boolean isAttached = false, startObserverWhenAttached = false;
public WindStreamletsRaceboardOverlay(MapWidget map, int zIndex, final Timer timer,
RegattaAndRaceIdentifier raceIdentifier, SailingServiceAsync sailingService,
@@ -298,6 +299,14 @@ public class WindStreamletsRaceboardOverlay extends MovingCanvasOverlay {
return this.visible;
}
@Override
protected void onAttach() {
isAttached = true;
if (startObserverWhenAttached) {
Scheduler.get().scheduleDeferred(() -> addObserverIfNecessary());
}
}
@Override
public void setVisible(boolean isVisible) {
if (getCanvas() != null) {
@@ -306,7 +315,11 @@ public class WindStreamletsRaceboardOverlay extends MovingCanvasOverlay {
this.streamletLegend.setVisible(true);
}
this.startStreamlets();
Scheduler.get().scheduleDeferred(() -> addObserverIfNecessary());
if (isAttached) {
Scheduler.get().scheduleDeferred(() -> addObserverIfNecessary());
} else {
startObserverWhenAttached = true;
}
this.visible = isVisible;
} else {
if (this.windField.getColors()) {