Documentation

Grid Scene

Description

Grid Scene allows marking squares on grid by Programming Command Prompt, Blockly Code Editor or javascript code.

Properties

The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Rows Rows in the grid scene. Maximum 40 rows.
Columns Columns in the grid scene. Maximum 40 columns.
Default Color The first selected color. An empty value is equal to black.
Delay A delay between called commands in the grid scene. An empty value is equal to zero. The delay is in ms.
Default Commands
Property name Description
Command Alias Command translation. The old command name will be replaced by an alias. Old command name is not available in the code executed by the scene code.
Argument Aliases Argument translations. Old arguments' aliases will be replaced by aliases. getCommands and getDefaultCommands will be displayed as argument aliases.
Is Disabled Disable command.
Custom Command New commands' definitions list.
Property name Description
Name Custom command name.
Arguments Arguments separated by comma passed to custom command.
Code The code executed by custom command. Custom command should be called by name. In the code there are arguments available by names.
Is Disabled Disable command.
Custom Commands JSON Object New commands definitions in JSON. Commands should be called by command_name. ** Definiton example ** { "first_command" : { "command_arguments" : "x,y", "is_disabled" : false, "command_code" : "mark(x,y);", "command_name" : "first" }, "second_command" : { "command_arguments" : "x,y", "is_disabled" : false, "command_code" : "clearMark(x,y);", "command_name" : "second" } }
Answer Addon answer. Answer must be written in JS code.

Supported commands

Command name Params Description
show --- Shows the addon.
hide --- Hides the addon.
mark x, y Mark cell in grid.
drawLeft steps Draw left from actual cursor position.
drawRight steps Draw right from the actual cursor position.
drawDown steps Draw down from the actual cursor position.
drawUp steps Draw up from the actual cursor position.
drawLeftFrom x, y, steps Draw left from [x,y] position.
drawRightFrom x, y, steps Draw right from [x,y] position.
drawDownFrom x, y, steps Draw down from [x,y] position.
drawUpFrom x, y, steps Draw up from [x,y] position.
setCursor x, y Set curson in [x,y] position.
setColor colorName Set color by name.
clearMark x, y Clear mark in [x,y] position.
clear --- Clear all marks in the grid scene and set cursor to start position.
reset --- Clear all marks in the grid scene and set cursor to start position.
executeCode code Execute code from string. The executed code will be delayed by the value from the Delay property.
getDefaultCommands withParams Get default commands from the scene. If withParams is false, the addon retursn commands without params.
getCustomCommands withParams Get custom commands from the scene. If withParams is false, the addon returns commands without params.
getCommands withParamstd Get all commands from the scene. If withParams is false, the addon returns commands without params.

Events

The Grid Scene addon sends the event when the state has been updated.

Field name Description
Item N/A
Value N/A
Score N/A

The Grid Scene addon sends the event when the drawing commands are called.

Field name Description
Item Name of the command
Value Coordinates of the point and number of steps
Score N/A

CSS classes

Class name Description
grid-scene-cell Main DIV element surrounding all grid cells.
grid-scene-cell-element Grid element
grid-scene-cell-element-wrapper Grid element surrounding the element allowing to create the border for elements.
grid-scene-correct Correct selected grid element
grid-scene-wrong Wrong selected grid element

Demo presentation

Demo presentation contains examples showing how this addon can be used.