Class: Input

Input


new Input(config)

Input stack for registering one drawing events path ex. for one finger on touch devices Input stack can by chuckend into smaller parts used to draw current frame or be sended to server

Parameters:
Name Type Description
config object

{id, layers, tool, color, fillColor, size}

Methods


addPoint(t, x, y)

Add point to input path

Parameters:
Name Type Description
t timestamp

current timestamp of move

x integer

x coordinate

y integer

y coordinate


getLastPoint()

Returns last point

Returns:
  • ex. {x: 0, y: 0} or false
Type
object

getPointsToSend()

Returns part of input stack that were not yet send

Returns:
  • ex. {t: [0, 3, 6], x: [0, 1, 2], y: [3, 2, 1]}
Type
object

getPointsToDraw()

Returns part of input stack that were not yet drawed

Returns:
  • {t: [0, 3, 6], x: [0, 1, 2], y: [3, 2, 1]}
Type
object