# Class: WhiteboardSurface

## Constructor

#### new WhiteboardSurface(whiteboard, whiteboardService)

  Whiteboard surface is a single "page" of Whiteboard.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboard` | AvayaClientServices.Services.Collaboration.Whiteboard |
  `whiteboardService` | AvayaClientServices.Services.Collaboration.WhiteboardService |

## Methods

#### addCircle(circle) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Adds a circle to the whiteboard surface.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `circle` | AvayaClientServices.Services.Collaboration.Circle |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### addShape(shape) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Adds a shape to the whiteboard surface.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.Shape |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### addText(whiteboardText) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Adds text to the whiteboard surface.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboardText` | AvayaClientServices.Services.Collaboration.WhiteboardText |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### clearContent() → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Clears a content of the whiteboard.

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### finishShape(shape) → {AvayaClientServices.Base.Promise.<(Boolean|Undefined)>}

  Finishes received shape.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Boolean|Undefined)> }

#### getAllowedPrimitiveShapes() → {Number}

  Returns number of allowed primitive shapes to draw
  Primitive shape for each of the following shape
  Reactangle - four
  Circle - one
  Line - one
  Stamp - five
  Text - one
  Pen/Marker - number of points drawn

  ##### Returns:

  { Number }

#### getShapes() → {Object.<number, AvayaClientServices.Services.Collaboration.AbstractShape>}

  Returns the map that contains shapes belonging to the surface.
  ShapeId is a key and shape of type AbstractShape is a value.

  ##### Returns:

  { Object.<number, AvayaClientServices.Services.Collaboration.AbstractShape> }

#### getSurfaceId() → {String}

  Returns the surface unique ID.

  ##### Returns:

  { String }

#### isActive() → {boolean}

  Determines whether the surface is active or not.

  ##### Returns:

  { boolean }

#### removeShape(shape) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Removes shape with given SDK Shape.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### resizeCircle(oldCircle, newCircle) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Resizes a circle to new circle.

  As the server does not have an API to resize circle, we are deleting the
  existing circle and drawing a newly resized circle.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `oldCircle` | AvayaClientServices.Services.Collaboration.Circle |
  `newCircle` | AvayaClientServices.Services.Collaboration.Circle |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### resizeShape(oldShape, newShape) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Resizes a shape to the new shape.

  As the server does not have an API to resize shape, we are deleting the
  existing shape and drawing a newly resized shape.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `oldShape` | AvayaClientServices.Services.Collaboration.Shape |
  `newShape` | AvayaClientServices.Services.Collaboration.Shape |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### setAsActive() → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Sets this surface as current (active).

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

#### updateShape(shape) → {AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)>}

  Updates shape position.
  This function is being invoked when the shape is moved by selection tool.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape |

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(Undefined|AvayaClientServices.Services.Collaboration.CollaborationError)> }

### Managing callbacks

#### addOnShapeAddedCallback(callback) → {void}

  Adds new onShapeAddedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeAddedCallback |

  ##### Returns:

  { void }

#### addOnShapeDeletedCallback(callback) → {void}

  Adds new onShapeDeletedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeDeletedCallback |

  ##### Returns:

  { void }

#### addOnShapeUpdatedCallback(callback) → {void}

  Adds new onShapeUpdatedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeUpdatedCallback |

  ##### Returns:

  { void }

#### addOnSurfaceClearedCallback(callback) → {void}

  Adds new onSurfaceClearedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onSurfaceClearedCallback |

  ##### Returns:

  { void }

#### removeOnShapeAddedCallback(callback) → {void}

  Removes existing onShapeAddedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeAddedCallback |

  ##### Returns:

  { void }

#### removeOnShapeDeletedCallback(callback) → {void}

  Removes existing onShapeDeletedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeDeletedCallback |

  ##### Returns:

  { void }

#### removeOnShapeUpdatedCallback(callback) → {void}

  Removes existing onShapeUpdatedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onShapeUpdatedCallback |

  ##### Returns:

  { void }

#### removeOnSurfaceClearedCallback(callback) → {void}

  Removes existing onSurfaceClearedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Collaboration.WhiteboardSurface#onSurfaceClearedCallback |

  ##### Returns:

  { void }

## Type Definitions

#### onShapeAddedCallback(whiteboardSurface, shape) → {void}

  Interface for callback function invoked when a new shape is added.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboardSurface` | AvayaClientServices.Services.Collaboration.WhiteboardSurface | Whiteboard instance.
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that has been added.

  ##### Returns:

  { void }

#### onShapeDeletedCallback(whiteboardSurface, shape) → {void}

  Interface for callback function invoked when a shape is deleted from a surface.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboardSurface` | AvayaClientServices.Services.Collaboration.WhiteboardSurface | Whiteboard instance.
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that has been deleted.

  ##### Returns:

  { void }

#### onShapeUpdatedCallback(whiteboardSurface, shape) → {void}

  Interface for callback function invoked when the shape has been updated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboardSurface` | AvayaClientServices.Services.Collaboration.WhiteboardSurface | Whiteboard instance.
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that has been updated.

  ##### Returns:

  { void }

#### onSurfaceClearedCallback(whiteboardSurface) → {void}

  Interface for callback function invoked when the surface is cleared.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `whiteboardSurface` | AvayaClientServices.Services.Collaboration.WhiteboardSurface | Whiteboard instance.

  ##### Returns:

  { void }