mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added drawing to fx thread
#fix
This commit is contained in:
@@ -43,12 +43,14 @@ public class MiniMap extends MapPreview {
|
||||
boatIcons.put(yacht, boatIcon);
|
||||
boatIcon.getTransforms().add(new Rotate(0));
|
||||
yacht.addLocationListener((boat, lat, lon, heading, sailIn, velocity) -> {
|
||||
Platform.runLater(() -> {
|
||||
Polygon bi = boatIcons.get(boat);
|
||||
Point2D p2d = scaledPoint.findScaledXY(lat, lon);
|
||||
bi.setLayoutX(p2d.getX());
|
||||
bi.setLayoutY(p2d.getY());
|
||||
((Rotate) bi.getTransforms().get(0)).setAngle(heading);
|
||||
});
|
||||
});
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
gameObjects.getChildren().addAll(boatIcons.values());
|
||||
|
||||
@@ -28,8 +28,7 @@ public class Marker2D extends Group {
|
||||
mark.setRadius(5);
|
||||
mark.setCenterX(0);
|
||||
mark.setCenterY(0);
|
||||
Platform.runLater(() -> this.getChildren()
|
||||
.addAll(mark, new Group())); //Empty group placeholder or arrows.
|
||||
Platform.runLater(() -> this.getChildren().add(mark));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,13 +81,9 @@ public class Marker2D extends Group {
|
||||
|
||||
private void showArrow(List<Group> arrowList, int arrowListIndex) {
|
||||
if (arrowListIndex < arrowList.size()) {
|
||||
if (arrowListIndex == 1) {
|
||||
;
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
this.getChildren().remove(1);
|
||||
this.getChildren().add(arrowList.get(arrowListIndex));
|
||||
});
|
||||
Platform.runLater(() ->
|
||||
this.getChildren().setAll(mark, arrowList.get(arrowListIndex))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user