PaperAPI

The PixelPaper JavaScript object comes with a bunch of handy, accessible methods that you can use to create custom workflows and experiences for your users. We've documented these below. Please note, this is an incomplete list! If you'd like lower-level access to PixelPaper's features, drop us an email.

Undo an Action

pixel.undoLastAction();
Undoes this user's most recent action.

Redo an Action

pixel.redo();
Redoes this user's most recent action.

Re-center View

pixel.recenterView();
Adjusts the user's view so they can see everything currently on the board (useful if they're "lost").

Draw a Line

pixel.drawLine(start_point, end_point);
Draws a line from start_point to point_b. Note: each point is an object with the coordinates keys x and y, like so:
{
x: 123,
y: 300
}

Draw Rectangle

pixel.drawRectangle(ax, ay, bx, by, { filled: true });
Draws a rectangle on this user's whiteboard.

Draw Ellipse

pixel.drawEllipse(x_coordinate, y_coordinate, radius_x, radius_y, { filled: true });
Draws a ellipse on this user's whiteboard. The x_coordinate and y_coordinate make up the top-left coordinate of the 'box' containing the ellipse. The radius_x and radius_y control the width and height of the ellipse.

Zoom In

pixel.zoomInOneClick();
Zooms in 2% on the board.

Zoom Out

pixel.zoomOutOneClick();
Zooms out 2% on the board.

Disconnect

pixel.disconnect();
Disconnects this user from the PixelPaper and destroys the containing div.

Want to request more functionality to be added to the PaperAPI? Drop us an email here and we'll add it in.