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.Canvascanvasjavafx.scene.layout.PanecanvasPane
-
Constructor Summary
Constructors Constructor Description CanvasController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawShapes()javafx.scene.canvas.CanvasgetCanvas()PointTransformationgetTransformation()voidinitialize()voidmakeCanvasResizable()voidonCanvasClicked(javafx.scene.input.MouseEvent mouseEvent)voidonCanvasDragged(javafx.scene.input.MouseEvent mouseEvent)This will be executed, when the mouse is pressed (and not released) and moves over the canvasvoidonCanvasZoom(javafx.scene.input.ScrollEvent scrollEvent)voidonMouseLifted(javafx.scene.input.MouseEvent mouseEvent)Handler for when the mouse press event on the canvas ends.voidsetGameManager(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()
-
-