Interface: Painter

Painter

An interface for a a rendering backend for a Canvas, that can be implemented in order to create UI representations of a puzzle.
Source:

Methods

draw(canvas)

Draws the canvas figures in the rendering backend
Parameters:
Name Type Description
canvas Canvas
Source:

fill(canvas, piece, figure)

Fills a piece using the canvas image information assigned for it
Parameters:
Name Type Description
canvas Canvas
piece Piece
figure Figure
Source:

initialize(canvas, id)

Creates the rendering backend, initializig all its contents. After this call, painter is ready to receive any other messages
Parameters:
Name Type Description
canvas Canvas
id string
Source:

label(canvas, piece, figure)

Adds piece's label to the given figure in the rendering backend
Parameters:
Name Type Description
canvas Canvas
piece Piece
figure Figure the rendering backend information for this piece. This method may mutate it if necessary
Source:

logicalTranslate(canvas, piece, group)

Parameters:
Name Type Description
canvas Canvas
piece Piece
group Group
Source:

onDrag(canvas, piece, group, f)

Registers a drag-start callback
Parameters:
Name Type Description
canvas Canvas
piece Piece
group Group
f VectorAction
Source:

onDragEnd(canvas, piece, group, f)

Registers a drag-end callback
Parameters:
Name Type Description
canvas Canvas
piece Piece
group Group
f Action
Source:

physicalTranslate(canvas, group, piece)

Translates th given piece
Parameters:
Name Type Description
canvas Canvas
group Group
piece Piece
Source:

registerKeyboardGestures(canvas, gestures)

Register keyboard gestures
Parameters:
Name Type Description
canvas Canvas
gestures object a map of key strokes and puzzle actions
Source:

reinitialize(canvas)

Recreates the rendering backend, clearing all its contents After this call, painter is ready to receive any other messages as it had been just initialized.
Parameters:
Name Type Description
canvas Canvas
Source:

resize(canvas, width, height)

Parameters:
Name Type Description
canvas Canvas
width number
height number
Source:

scale(canvas, factor)

Scales the canvas contents
Parameters:
Name Type Description
canvas Canvas
factor Vector
Source:

sketch(canvas, piece, figure, outline)

Adds a piece to the rendering backend, so that it is ready to be drawn
Parameters:
Name Type Description
canvas Canvas
piece Piece
figure Figure the rendering backend information for this piece. This method may mutate it if necessary
outline Outline
Source: