Picture
Extends:
The Picture class is used to draw images on the screen. Extra attention must be made when waiting for the image to load.
Constructor Summary
Public Constructor | ||
public |
constructor(path: string, opts: object) |
Member Summary
Public Members | ||
public |
Height of the scaled image in units. |
|
public |
Image object where picture will be loaded. |
|
public |
Flag for allowing the picture to be dragged around. |
|
public |
Flag for when the image has fully loaded. |
|
public |
Sets the pivot point around which the picture is drawn. |
|
public |
Width of the scaled image in units. |
Method Summary
Public Methods | ||
public |
Tests if the image is fully loaded. |
Private Methods | ||
private |
draw() Main draw function for the picture called by the World automatically. |
|
private |
Tests if the mouse is over the picture. |
Inherited Summary
From class WorldElement | ||
public |
Sets the color in HEX format of the element. |
|
public |
Sets the cursor style when the mouse is over the element. |
|
public |
Flag for enabling or diabling this element. |
|
public |
Flag set when the element is being dragged around. |
|
public |
Sets the font of the element. |
|
public |
Sets the current height of the element. |
|
public |
Flag for allowing the element to be dragged around. |
|
public |
Sets the move style of the element. |
|
public |
Flag set when the mouse is over the element. |
|
public |
Sets a callback function for when the element is dragged around. |
|
public |
Sets the position of the element. |
|
public |
Sets the renderer used for the element. |
|
public |
Sets the rotation of the element. |
|
public |
A copy of the z-index value is stored here. |
|
public |
Sets the drawing scale of the element. |
|
public |
Flag for determining if the element will be a top-most element when dragged around. |
|
public |
Flag used to determine if an object is a child of WorldElement. |
|
public |
Sets the current width of the element. |
|
public |
Sets the world where this element is found. |
|
public |
Sets the z-index of the element. |
|
public |
addPosition(x: number, y: number) Adds the provided coordinates to the position. |
|
public |
Sets if the element is draggable. |
|
public |
Function called when the mouse moves to check if the pointer is over the element. |
|
public |
Sets the color in HEX format of the element. |
|
public |
setPosition(x: number, y: number) Sets the position of the element. |
|
public |
Sets the scale of the element. |
|
public |
Sets the z-index of the element. |
|
private |
resize() Function called when the canvas gets resized. |
|
private |
Sets the world object where element will be drawn. |
|
private |
Sets the element as a topmost element. |
Public Constructors
public constructor(path: string, opts: object) source
Override:
WorldElement#constructorPublic Members
public isDraggable: boolean source
Flag for allowing the picture to be dragged around. Default value is true.
Override:
WorldElement#isDraggablepublic loaded: boolean source
Flag for when the image has fully loaded. It is set after the onload event fires.
Public Methods
public isLoaded(): boolean source
Tests if the image is fully loaded. This means that its properties such as the width are available.
Private Methods
private isMouseOver(): boolean source
Tests if the mouse is over the picture.