This is an attribute that determines if the coordinate system should be aligned with the one of the HTML canvas element. The default is true.
The underlying camera of the board. The camera of the board can be switched. The boundaries are based on camera. Meaning you can have camera with different boundaries, and you can switch between them during runtime.
The context used to draw stuff on the canvas.
Determines if the board should be full screen. If this is set to true, the width and height of the board will be set to the window's inner width and inner height respectively. If set to true the width and height of the board will resize with the window.
This is in sync with the canvas height and the camera view port height. This is not the board's height. If the limitEntireViewPort is set to true, the min zoom level is updated based on the height.
The strategy used to handle the keyboard, mouse events. The default strategy is the DefaultBoardKMTStrategy. You can implement your own strategy by implementing the BoardKMTStrategy interface.
Determines the behavior of the camera when the camera is at the edge of the boundaries. If set to true, the entire view port would not move beyond the boundaries. If set to false, only the center of the camera is bounded by the boundaries.
The max translation height of the camera. This is the maximum distance the camera can move in the vertical direction.
The max translation width of the camera. This is the maximum distance the camera can move in the horizontal direction.
The strategy used to handle touch events. The default strategy is the DefaultTouchStrategy. You can implement your own strategy by implementing the BoardTouchStrategy interface.
This is in sync with the canvas width and the camera view port width. This is not the board's width.
If the limitEntireViewPort
is set to true, the min zoom level is updated based on the width of the canvas.
Add an camera movement event listener. The events are "pan", "zoom", and "rotate".
The event name to listen for. The events are "pan", "zoom", and "rotate".
The callback function to call when the event is triggered. The event provided to the callback is different for the different events.
The converted point in world coordinates.
Add an input event listener. The events are "pan", "zoom", and "rotate". This is different from the camera event listener as this is for input events. Input event does not necesarily mean that the camera will move. The input event is the event that is triggered when the user interacts with the board.
This is the step function that is called in the animation frame. This function is responsible for updating the canvas context and the camera state.
This function is used to set up the board. It adds all the event listeners and starts the resize observer and the attribute observer.
This function is used to clean up the board. It removes all the event listeners and disconnects the resize observer and the attribute observer.
Usage
Alternatively you can import the board class as from a subdirectory; this shaves the bundle size a bit but not a lot though. As the board is the overall entry point for the library.