API.e2D
Summary
API for wanaplan's 2D engine.
Constructor
API.e2D
Syntax
API.e2D
()
Summary
Item Index
Methods
getColorConstants
Syntax
Summary
Returns a set of colors used to display several things in 2D.
Returns:
Set of labeled colors
getDynamicCanvas
Syntax
getDynamicCanvas
()
HTMLCanvasElement
Summary
Gets the 2D dynamic canvas
.
Returns:
the dynamic canvas.
getMousePos
Syntax
getMousePos
()
BABYLON.Vector2
Summary
Returns the mouse position in the 2D plan coordinates. It will give you unexploitable results in 3D.
Returns:
The mouse position
getNearestWallFromMousePos
Syntax
Summary
Returns the nearest wall from the mouse position.
Parameters:
-
structure
FloorStructureThe floor for which to consider the walls
Returns:
The nearest wall among those of the chosen floor
getStaticCanvas
Syntax
getStaticCanvas
()
HTMLCanvasElement
Summary
Gets the 2D static canvas
.
Returns:
the static canvas.
getSymbols2D
Syntax
Summary
Returns the symbols2D class for drawing things on the canvas.
Returns:
The symbols2D class
getTranslation
Syntax
getTranslation
()
BABYLON.Vector2
Summary
Returns the translation applied to the canvas.
Returns:
The translation (x, y).
getZoom
Syntax
Summary
Returns the level of zoom currently applied to the canvas.
Returns:
The zoom, also called scale.
registerEventCb
Syntax
registerEventCb
-
id
-
priority
-
evName
-
mode
-
objType
-
callback
-
[data]
Summary
Registers a callback for a specific event.
Parameters:
-
id
StringA unique identifier for this event (ex: "coreComponentWallClick").
-
priority
NumberThe priority for this event (defines callback call order).
-
evName
StringThe event name associated to the callback.
-
mode
NumberMode in which the event will be active (ex:
Core.MODE_NORMAL|Core.MODE_DRAG
). -
objType
ObjectThe type of object that must be targeted, or
null
. -
callback
FunctionThe function to call.
-
[data]
Object optionalData passed to the callback.
requestDynamicDraw
Syntax
requestDynamicDraw
()
Summary
Requests a redraw of the top "dynamic" canvas at the next frame. The top canvas is used to draw things that may need refreshing when the mouse moves. Typically, it is the symbols displayed when the mouse hovers something.
requestStaticDraw
Syntax
requestStaticDraw
()
Summary
Requests a redraw of the bottom "static" canvas at the next frame. The bottom canvas is used to draw things that don't usually need redrawing when the mouse moves, like the walls, the rooms, the grid etc... NB : The top "dynamic" canvas will also be redrawn
setMagnetismAnglePrecision
Syntax
setMagnetismAnglePrecision
-
precision
Summary
Changes the precision angle of the magnetism.
Parameters:
-
precision
FloatThe new precision (in radians)
setTranslation
Syntax
setTranslation
-
translation
Summary
Sets the translation to apply to the canvas.
Parameters:
-
translation
BABYLON.Vector2The translation (x, y).
setZoom
Syntax
setZoom
-
zoom
Summary
Sets the zoom to apply to the canvas.
Parameters:
-
zoom
NumberThe zoom, also called scale.
toRealCoord
Syntax
toRealCoord
-
vector
-
[translation]
-
[zoom]
Summary
Transforms a vector from 2D plan coordinates to canvas coordinates.
Parameters:
-
vector
BABYLON.Vector2Plan coordinates.
-
[translation]
BABYLON.Vector2 optionalTranslation applied on the canvas.
-
[zoom]
BABYLON.Vector2 optionalZoom applied on the canvas.
Returns:
The vector transformed to canvas coordinates.
unregisterEventCb
Syntax
unregisterEventCb
-
id
Summary
Unregisters a callback for a specific event.
Parameters:
-
id
StringThe unique identifier of the callback to remove.