Class: Sketchpad

Sketchpad


new Sketchpad(config)

Canvas Sketchpad plugin

Parameters:
Name Type Description
config object

Config of sketchpad

Properties
Name Type Argument Default Description
containerEl HTMLElement <optional>
window

HTML element that will contain Sketchpad

token string <optional>
"#public"

Room token

backgroundImage url <optional>

url to image that will be on background of sketchpad

backgroundPdf url <optional>

url to pdf that will be on background of sketchpad

foregroundImage url <optional>

url to image that will be on foreground of sketchpad

ws WebSocket <optional>

WebSocket that will be used to exchange draw events

readOnly boolean <optional>
false

define if sketchpad should be drawable or not

syncNetworkDataFrequency integer <optional>
100

how offen data should be send in ms

Properties:
Name Type Description
config object

The current config passed to create sketchpad.

defaults.players number

The default number of players.

defaults.level string

The default level for the party.

defaults.treasure object

The default treasure.

Properties
Name Type Description
gold number

How much gold the party starts with.

gold boolean

How much gold the party starts with.

Returns:
  • instance of sketchpad
Type
Sketchpad
Example
{
  containerEl: sketchpadEl, //HTMLElement
  token: room_token, //string token of room where user is connected
  backgroundImage: "images/bg.png", //image behind scene
  backgroundPdf: "images/bg.pdf", //pdf behind scene
  foregroundImage: "images/fg.png", //image covering scene
  ws: ws, //WebSocket adapter or null for standalone mockup
  readOnly: false, //set true for disabling drawing
}

Classes

room

Members


<inner> config :object

Current config

Type:
  • object

token :string

current room token

Type:
  • string

ws :WebSocket

web socket to exchange data

Type:
  • WebSocket

containerEl :HTMLElement

HTML element that will contain Sketchpad

Type:
  • HTMLElement

progressParentEl

Progress bar parent


syncNetworkDataFrequency :integer

How offen shoud send sketchpad update Bigger values casuses bigger delay Smaller values incrase usage of bandwitch

Type:
  • integer

centerViewport :boolean

set true if center of viewport should be at center of screen

Type:
  • boolean

readOnly :boolean

set to true to disable use input

Type:
  • boolean

tools :Object

list of registered tools

Type:
  • Object

tool :string|integer

id of current tool

Type:
  • string | integer

viewportX :Number

[viewportX description]

Type:
  • Number

viewportY :Number

[viewportY description]

Type:
  • Number

scale :Number

Saved scale

Type:
  • Number

rotation

Saved rotation - in deg


receivingHistory :Boolean

if true received commands will be executed immediately

Type:
  • Boolean

inputs :Array

list of active inputs in current time (ex. touched finger)

Type:
  • Array

backgroundIFrame

Background iframe??


background

Background image


hudsEl

Container for viewports


projectorEl

Container for tools projector


canvas :HTMLCanvas

Foreground canvas

Type:
  • HTMLCanvas

canvasB :HTMLCanvas

Background canvas

Type:
  • HTMLCanvas

canvasProjector :HTMLCanvas

foreground canvas do project input from tools

Type:
  • HTMLCanvas

foreground

Foreground


crosshairEl

Crosshair


loadingEl

Loading


width :Number

width of sketchpad

Type:
  • Number

height :Number

height of sketchpad

Type:
  • Number

room :Room

current room

Type:

away

user is away