Skip to content
Snippets Groups Projects
Commit 0d5f0d09 authored by Edvard Granheim Harbo's avatar Edvard Granheim Harbo
Browse files

Merge branch 'ExtraUserOptions' into 'dev'

Finished styling the menu

See merge request !34
parents a6bdfa2e 844728ae
Branches
Tags
2 merge requests!54Final release,!34Finished styling the menu
......@@ -5,5 +5,5 @@ import javafx.scene.paint.Color;
public final class Colorpalette{
public static final Color White = Color.web("#FFFFFF");
public static final Color Black = Color.web("#000000");
public static final Color Primary = Color.web("#7971EA");
public static final Color Primary = Color.web("#5072A7");
}
\ No newline at end of file
......@@ -8,8 +8,10 @@ import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.control.Slider;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
public class ExtraUserOptions extends VBox {
......@@ -21,7 +23,6 @@ public class ExtraUserOptions extends VBox {
private final RotationButton rotationButton;
private final InformationButton informationButton;
public ExtraUserOptions(Node node) {
this.node = node;
resetViewButton = new Button("Reset View");
......@@ -29,22 +30,31 @@ public class ExtraUserOptions extends VBox {
rotationButton = new RotationButton(node);
informationButton = new InformationButton("Additional Information");
zoomSlider = new Slider(0.5, 4.0, 1.0);
extraUserOptionsLabel();
Label rotationLabel = new Label("Rotate the view");
rotationLabel.setStyle("-fx-font-size: 14px; ");
Label zoomLabel = new Label("Zoom");
zoomLabel.setStyle("-fx-font-size: 14px; ");
this.getChildren().addAll(resetViewButton,
this.getChildren().addAll(
zoomLabel,
createZoomSliderWithLabels(),
rotationLabel,
rotationButton,
createSeparator(),
resetViewButton,
clearCanvasButton,
informationButton);
informationButton
);
extraUserOptionsInitialize();
}
private HBox createZoomSliderWithLabels() {
Label zoomInLabel = new Label("Zoom In");
Label zoomOutLabel = new Label("Zoom Out");
Label zoomInLabel = new Label("In");
Label zoomOutLabel = new Label("Out");
zoomSlider.setPrefWidth(100);
HBox sliderWithLabels = new HBox(zoomOutLabel, zoomSlider, zoomInLabel);
......@@ -77,12 +87,12 @@ public class ExtraUserOptions extends VBox {
setPrefHeight(0.3 * screenHeight);
setMaxHeight(0.3 * screenHeight);
setAlignment(Pos.CENTER);
setPadding(new Insets(10, 0, 10, 0));
setPadding(new Insets(10, 20, 10, 20));
setSpacing(10);
}
private void extraUserOptionsStyling() {
setPadding(new Insets(10, 10, 10, 10));
setStyle("-fx-background-color: #f4f4f4;");
setStyle("-fx-background-color: #eed9c4;");
}
private void sliderToZoom() {
......@@ -106,4 +116,18 @@ public class ExtraUserOptions extends VBox {
node.setTranslateY(0);
});
}
private void extraUserOptionsLabel() {
Label extraUserOptionsLabel = new Label("Extra Functions");
extraUserOptionsLabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold;");
getChildren().add(extraUserOptionsLabel);
}
private Separator createSeparator() {
Separator separator = new Separator();
separator.setMaxWidth(Double.MAX_VALUE);
VBox.setVgrow(separator, Priority.ALWAYS);
return separator;
}
}
......@@ -19,12 +19,14 @@ public class InformationButton extends Button {
String contentText = "Fractals use 3 primary colors to show hit density:\n" +
"Red: Top 33% hit most\nBlue: Mid 33%\nGreen: Bottom 33%\n\n" +
"Right side: Main menu - create, select, edit fractals\n" +
"Bottom menu: Extra user options for canvas interaction\n\n" +
"Bottom menu: Extra user options for canvas interaction" +
"The reset view button brings the canvas back to its original zoom and rotation\n" +
"The clear canvas button clears the whole canvas\n\n" +
"Interact with canvas: Zoom with mouse, click-hold to move";
alert.setContentText(contentText);
alert.getDialogPane().setPrefWidth(400);
alert.getDialogPane().setPrefHeight(250);
alert.getDialogPane().setPrefHeight(300);
alert.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
......
......@@ -4,30 +4,37 @@ import edu.ntnu.idatt2003.mappevurderingprog2.controllers.GameController;
import edu.ntnu.idatt2003.mappevurderingprog2.views.View;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.layout.VBox;
public class Menu extends VBox {
private ExistingFractalsMenu existingFractalsMenu;
private CreateFractalMenu createFractalMenu;
private EditFractalMenu editFractalMenu; // Add this line
private EditFractalMenu editFractalMenu;
private ExtraUserOptions extraUserOptions;
public Menu(View view, GameController gameController) {
existingFractalsMenu = new ExistingFractalsMenu(view, gameController);
createFractalMenu = new CreateFractalMenu();
editFractalMenu = new EditFractalMenu(view, gameController); // Initialize here
editFractalMenu = new EditFractalMenu(view, gameController);
extraUserOptions = new ExtraUserOptions(view.getMainCanvas());
initializeMenu();
}
private void initializeMenu() {
Label menuLabel = new Label("Menu");
menuLabel.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
menuLabel.setStyle("-fx-font-size: 20px; -fx-font-weight: bold;-fx-font-family: 'Times New Roman'");
setPrefWidth(200);
getChildren().addAll(menuLabel, existingFractalsMenu, createFractalMenu, editFractalMenu); // Add to children
getChildren().addAll(menuLabel, new Separator(),
existingFractalsMenu,
createFractalMenu,
editFractalMenu,
new Separator(),
extraUserOptions);
setAlignment(Pos.TOP_CENTER);
setSpacing(20);
setStyle("-fx-background-color: #f4f4f4;");
setStyle(" -fx-background-color: #faf0e6;");
}
}
\ No newline at end of file
......@@ -16,8 +16,8 @@ public class RotationButton extends HBox {
public RotationButton(Node node) {
this.node = node;
rotateClockwise = new Button("Clockwise");
rotateCounterClockwise = new Button("Counter Clockwise");
rotateClockwise = new Button("Right");
rotateCounterClockwise = new Button("Left");
initializeUI();
attachEventHandlers();
......
......@@ -9,8 +9,6 @@ import edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGame;
import edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGameObserver;
import edu.ntnu.idatt2003.mappevurderingprog2.utils.Colorpalette;
import edu.ntnu.idatt2003.mappevurderingprog2.utils.Size;
import edu.ntnu.idatt2003.mappevurderingprog2.views.Components.Zoom;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
......@@ -18,13 +16,11 @@ import java.util.List;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.control.Separator;
public class View extends BorderPane implements ChaosGameObserver {
......@@ -98,15 +94,7 @@ public class View extends BorderPane implements ChaosGameObserver {
this.setBackground(new Background(new BackgroundFill(Colorpalette.Primary, CornerRadii.EMPTY, Insets.EMPTY)));
this.setCenter(mainCanvas);
this.menu = new Menu(this, gameController);
VBox rightContainer = new VBox();
rightContainer.setAlignment(Pos.BOTTOM_RIGHT);
rightContainer.getChildren().add(extraUserOptions);
this.setRight(rightContainer);
this.setLeft(menu);
new Separator();
return new Scene(this, Size.getScreenWidth(), Size.getScreenHeight());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment