1.1.26 • Published 1 year ago

whiteboard-util v1.1.26

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

whiteboard-util

Installation and Use npm install whiteboard-util --save

Use this code to integrate the utility of the whiteboard

import { Whiteboard, REDO, UNDO } from "whiteboard-util";

To connect and use the methods

const openRoom = () => { wbRef.current = new Whiteboard(); wbRef.current.socketConnection = isSocketConnected; wbRef.current.roomId = sessionId; wbRef.current.readOnly = readOnly; // wbRef.current.apiHost = "https://whiteboard.thekolony.app/"; wbRef.current.apiHost = "http://localhost:5000/"; wbRef.current.extraData.userId = userId; wbRef.current.extraData.userType = userType; wbRef.current.openRoom({ thickness: strokeWidth }); wbRef.current.onObjectSelected = (canvasObject) => { const { fill, stroke, strokeWidth, type } = canvasObject; if (type !== "Image") { setStrokeColor(stroke); setFillColor(fill); setStrokeWidth(strokeWidth); } setSelectedType(type); };

wbRef.current.onObjectSelectCleared = () => {
  setSelectedType("");
};

onOpenRoom(wbRef.current);
if (Array.isArray(prevResponse)) {
  return;
}
if (prevResponse) {
  wbRef.current.loadFromJSON(prevResponse);
}

};

Canvas Id

 this.canvasId = "drawCanvasId";

To add the object on canvas

wbRef.current.addObject(object);

To Edit the object

wbRef.current.editObject(obj);

To undo the changes

wbRef.current.onUndoRedo(action);

To Close the service

wbRef.current.close();

To connect the socket

wbRef.current.socketConnection = true; // This is boolean,you want to use the whiteboard as share system or not

To set the width of the drawing

wbRef.current.setDrawingWidth(value);

To set the drawing mode

wbRef.current.setDrawingMode(true);

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago