Package com.treasure.hunt.view
Class CanvasController
- java.lang.Object
-
- com.treasure.hunt.view.CanvasController
-
public class CanvasController extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description javafx.scene.canvas.Canvas
canvas
javafx.scene.layout.Pane
canvasPane
-
Constructor Summary
Constructors Constructor Description CanvasController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drawShapes()
javafx.scene.canvas.Canvas
getCanvas()
PointTransformation
getTransformation()
void
initialize()
void
makeCanvasResizable()
void
onCanvasClicked(javafx.scene.input.MouseEvent mouseEvent)
void
onCanvasDragged(javafx.scene.input.MouseEvent mouseEvent)
This will be executed, when the mouse is pressed (and not released) and moves over the canvasvoid
onCanvasZoom(javafx.scene.input.ScrollEvent scrollEvent)
void
onMouseLifted(javafx.scene.input.MouseEvent mouseEvent)
Handler for when the mouse press event on the canvas ends.void
setGameManager(javafx.beans.property.ObjectProperty<GameManager> gameManager)
-
-
-
Method Detail
-
initialize
public void initialize()
-
makeCanvasResizable
public void makeCanvasResizable()
-
drawShapes
public void drawShapes()
-
onCanvasClicked
public void onCanvasClicked(javafx.scene.input.MouseEvent mouseEvent)
-
onCanvasDragged
public void onCanvasDragged(javafx.scene.input.MouseEvent mouseEvent)
This will be executed, when the mouse is pressed (and not released) and moves over the canvasIt will swipe the game to the dragged position.
- Parameters:
mouseEvent
- correspondingMouseEvent
-
onMouseLifted
public void onMouseLifted(javafx.scene.input.MouseEvent mouseEvent)
Handler for when the mouse press event on the canvas ends. We determine that if if we didn't dragged the mouse moving the canvas rendering, we can fire a click selection event.- Parameters:
mouseEvent
- event of the lifted mouse position
-
onCanvasZoom
public void onCanvasZoom(javafx.scene.input.ScrollEvent scrollEvent)
-
setGameManager
public void setGameManager(javafx.beans.property.ObjectProperty<GameManager> gameManager)
-
getCanvas
public javafx.scene.canvas.Canvas getCanvas()
-
getTransformation
public PointTransformation getTransformation()
-
-