updated race view that does not use a split pane

This commit is contained in:
hba56
2017-09-14 13:45:46 +12:00
parent 87f3265640
commit 083eb5a4bc
3 changed files with 137 additions and 123 deletions
@@ -250,7 +250,7 @@ public class InGameLobbyController extends Controller {
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
RaceViewController rvc = (RaceViewController)
loadScene("raceView.fxml");
loadScene("newRaceView.fxml");
rvc.startRace(visualiserRaceEvent, controllerClient,
isHost);
} catch (IOException e) {
@@ -12,6 +12,7 @@ import javafx.scene.chart.LineChart;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.MeshView;
@@ -64,7 +65,7 @@ public class RaceViewController extends Controller {
// note: it says it's not used but it is! do not remove :)
private @FXML ArrowController arrowController;
private @FXML GridPane canvasBase;
private @FXML SplitPane racePane;
private @FXML AnchorPane newRacePane;
private @FXML StackPane arrowPane;
private @FXML Label timer;
private @FXML Label FPS;
@@ -77,6 +78,7 @@ public class RaceViewController extends Controller {
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
private @FXML LineChart<Number, Number> sparklineChart;
private @FXML Label tutorialText;
private @FXML AnchorPane infoWrapper;
/**
* Displays a specified race.
@@ -125,7 +127,7 @@ public class RaceViewController extends Controller {
* Sets up the listener and actions that occur when a key is pressed.
*/
private void initKeypressHandler() {
racePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
String codeString = event.getCode().toString();
// tab key
@@ -255,7 +257,7 @@ public class RaceViewController extends Controller {
});
// Bind zooming to keypress (Z/X default)
racePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
ControlKey key = keyFactory.getKey(e.getCode().toString());
if (key != null) {
switch (key.toString()) {
@@ -442,23 +444,7 @@ public class RaceViewController extends Controller {
* toggles if the info table is shown
*/
private void toggleTable() {
double tablePercent = 1 - (boatPlacingColumn.getPrefWidth() +
boatTeamColumn.getPrefWidth() + boatMarkColumn.getPrefWidth()
+ boatSpeedColumn.getPrefWidth())/racePane.getWidth();
if (infoTableShow) {
racePane.setDividerPositions(tablePercent);
arrowPane.setScaleX(0.5);
arrowPane.setScaleY(0.5);
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*tablePercent);
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
} else {
racePane.setDividerPositions(1);
arrowPane.setScaleX(1);
arrowPane.setScaleY(1);
arrowPane.setTranslateX(0);
arrowPane.setTranslateY(0);
}
infoWrapper.setVisible(infoTableShow);
boatInfoTable.refresh();
infoTableShow = !infoTableShow;
}