# Class: KonvaWhiteboardRenderer

## Constructor

#### new KonvaWhiteboardRenderer()

  KonvaWhiteboardRenderer extends Collaboration module WhiteboardRenderer.
  Provides functionality for rendering shapes on the whiteboard canvas.

## Members

#### strokeWidth :number

  ##### Type:

  - number

## Methods

#### _resubscribeWinEvents()

  Resubscribe current window on mouse events if it has been changed

#### _updateKonvaShapeModel(konvaShape, points)

  Update Konva shape internal model start and relative points

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `konvaShape` | Konva.Shape |
  `points` | AvayaClientServices.Services.Collaboration.Point |

#### autoFit(width, height) → {number}

  Scales the whiteboard to the maximum width or height of the parent container.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `width` | number | Width of the whiteboard parent container in pixels.
  `height` | number | Height of the hiteboard parent container in pixels.

  ##### Returns:

  { number }

  scale

#### clearContent() → {void}

  Deletes all the shapes from the whiteboard canvas.

  ##### Returns:

  { void }

#### drawShape(shape) → {void}

  Draws a given shape on the whiteboard canvas.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that is going to be drawn on the whiteboard canvas.

  ##### Returns:

  { void }

#### end(containerId) → {void}

  Ends the whiteboard service and clears all the HTML canvas elements.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `containerId` | string | ID of DOM element with the whiteboard canvas which is going to be removed.

  ##### Returns:

  { void }

#### getAllowedPrimitiveShapes() → {Number|undefined}

  Returns allowed primitive shapes

  ##### Returns:

  { Number | undefined }

#### getHeight() → {Number}

  Returns height of the stage

  ##### Returns:

  { Number }

#### getStrokeWidth() → {Number}

  Returns stroke width

  ##### Returns:

  { Number }

#### getWidth() → {Number}

  Returns width of the stage

  ##### Returns:

  { Number }

#### removeShape(shape) → {void}

  Removes a given shape from the whiteboard canvas.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that is going to be removed from the whiteboard canvas.

  ##### Returns:

  { void }

#### setColor(cl) → {void}

  Allows to select and set a color for the whiteboard tool.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `cl` | string | Hexadecimal color.

  ##### Returns:

  { void }

#### setSelectionToolOptions(options) → {void}

  Allows to set a option for selection tools.
  e.g. resize, rotation, ignoreStroke etc.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | object | selection tool options like resize, rotation and ignoreStroke

  ##### Returns:

  { void }

#### setTool(tool, mode, stroke) → {void}

  Allows to select and set the whiteboard tool, tool mode (if exists) and tool stroke width (if exists).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tool` | AvayaClientServices.Services.Collaboration.WhiteboardToolTypes | Tool that is going to be selected.
  `mode` | string | Tool mode: filled or stroke.
  `stroke` | number | Tool stroke width.

  ##### Returns:

  { void }

#### start(containerId) → {void}

  Starts the whiteboard canvas.
  Depending on the selected tool, calls the appropriate function on mouse click event.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `containerId` | string | ID of DOM element where the whiteboard canvas will be append to.

  ##### Returns:

  { void }

#### start() → {void}

  Sets up whiteboard canvas.
  Depending on the selected tool, calls the appropriate function on mouse click event.

  ##### Returns:

  { void }

#### updateShape(shape, moveToX, moveToY) → {void}

  Updates the shape position, when the shape is moved by the selection tool.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `shape` | AvayaClientServices.Services.Collaboration.AbstractShape | Shape that is going to be updated.
  `moveToX` | Number | undefined |
  `moveToY` | Number | undefined |

  ##### Returns:

  { void }

#### zoom(scale) → {void}

  Scales canvas, making the whiteboard smaller or bigger, depending on the scale parameter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `scale` | number | Minimal value is 0. Default value is 1. Value between 0 and 1 makes canvas smaller. Value higher than 1 makes canvas bigger.

  ##### Returns:

  { void }