You have successfully initialized your first Core instance. Now let me show you on how to pass a call onto the render, with the renderer being the bridge. This man-in-the-middle concept will be applied throughout your application. Here is a demonstration on how the concept will work.
Do not call the components as if it is yours, or else, you will not get the expected results. Use the renderer’s shared instance to satisfy on what you are looking for
The usage will always follow this format: <renderer variable>.<component>.<function or component variable>
LogicDisplay
function and variablescustomSyntax(syntax: string)
: Returns the stringed values of operations (e.g. \\return
will print out the current component)exportJSON()
: Returns the stringified JSON file, ready to be distributed.importJSON(object: Array, parent: Array)
: Imports the JSON into the parent. object
is the importing object (must be an unstringifed data; aka: raw JSON data). parent
is the parent component hierarchy. For the best results, use renderer.logicDisplay.components
as the parent object, so it could be embedded directly.components
: Returns the component raw JSON data, which is an array object.GraphicDisplay
function and variableszoomIn()
: Zooms in the canvas by 1.1x.zoomOut()
: Zooms out the canvas by 0.9x.undo()
: Returns the component state to a previous stateredo()
: Forwards to the most recent state. Only works when undo returns a previous state.setMode(mode: MODES)
: Sets the mode to the desired mode. Available modes: ADDPOINT, ADDLINE, ADDCIRCLE, ADDRECTANGLE, ADDARC, ADDMEASURE, ADDLABEL, ADDSHAPE, DELETE, NAVIGATE, MOVE
setModeShape(shape: Shape)
: Switches mode to shape placement mode. Object must me a Shape
object. Learn more on the Working with custom shapes subpage.displayWidth
and displayHeight
: Sets the respective width and height of the render instance. A canvas width and height change is required to drive a smooth and intended experience.KeyboardHandler
function and variables