UNPKG

pencil.js

Version:

Nice modular interactive 2D drawing library.

42 lines (41 loc) 1.29 kB
/** * @module Instruction */ /** * Instruction class * @class */ export default class Instruction { /** * Unimplemented * FIXME */ static from(): void; /** * @callback InstructionCallback * @param {Path2D} path - Current drawing path * @param {Position} target - Target position * @param {Position} previousPosition - Position from where instruction started */ /** * Instruction constructor * @param {InstructionCallback} action - Function to execute * @param {PositionDefinition} target - Position to go to */ constructor(action: (path: Path2D, target: Position, previousPosition: Position) => Instruction, target: PositionDefinition); action: (path: Path2D, target: Position, previousPosition: Position) => Instruction; target: Position; /** * Follow the instruction * @param {Path2D} path - Current drawing path * @param {Position} previousPosition - Position from where the instruction start * @return {Position} The position reached */ execute(path: Path2D, previousPosition: Position): Position; /** * Unimplemented * FIXME: How to serialize a wrapper of a function ? */ toJSON(): void; } import Position from "@pencil.js/position";