module:Instruction

module:Instruction

Instruction class

Constructor

# new module:Instruction(action, target)

Instruction constructor

Parameters:
Name Type Description
action InstructionCallback

Function to execute

target PositionDefinition

Position to go to

Methods

# (static) from()

Unimplemented FIXME

# execute(path, previousPosition) → {Position}

Follow the instruction

Parameters:
Name Type Description
path Path2D

Current drawing path

previousPosition Position

Position from where the instruction start

Returns:

The position reached

Type
Position

# toJSON()

Unimplemented FIXME: How to serialize a wrapper of a function ?

Type Definitions

# InstructionCallback(path, target, previousPosition)

Parameters:
Name Type Description
path Path2D

Current drawing path

target Position

Target position

previousPosition Position

Position from where instruction started