Netless

Netless

  • JavaScript
  • Android
  • iOS
  • Server
  • FAQ
  • GitHub
  • 🇨🇳 中文

›Features

Document structure

  • Outline

Installation guide

  • SDK install
  • Version history
  • Open source
  • Debug

Quick start

  • Precondition
  • Room authentication
  • Real-time room
  • replay

Initialization

  • SDK parameters
  • Room parameters
  • Replay parameters

Features

  • Tools
  • Perspective operation
  • Page (scene) management
  • Status listen
  • Whiteboard operation
  • Custom event
  • Cursor position sync
  • Document conversion
  • Replay
  • Big class read-only
  • Plugins

Upgrade

  • SDK v2 migration

Tools

The room variables in this chapter are examples of whiteboard rooms.

Ordinary tools

In the state of room, the memberState attribute exists (you can read State Management for morestate information). Common teaching aids can be described by memberState.

MemberState structure

type MemberState = {
    // Name of current tool
    currentApplianceName: string;
    // The current tool color is an array of integers, which respectively represent [R, G, B] and an integer ranging from 0 to 255.
    // This value affects all common tool
    strokeColor: Color;
    // Current tool thickness, default 4
    strokeWidth: number;
    // Text aid font size, default 16px
    textSize: number;
};

Kind

namestringdescription
SelectorselectorSelect, you can select one or more graphics, and move, zoom, delete (del key)
Pencil (default)pencilDraw colored tracks
RectanglerectangleDraw a rectangle or square (shift key)
EllipseellipseDraw an ellipse or a perfect circle (shift key)
ErasereraserDelete track
TexttextEdit, enter text

Adjust teaching aids (kind, color, thickness, size)

// Modify the teaching aids, just pass in the fields you want to modify
room.setMemberState({
    currentApplianceName: "pencil",
    strokeColor: [255, 0, 0],
    strokeWidth: 4,
    textSize: 14,
});

Inquiry about teaching aids

You can access the contents of memberState by the following methods.

const memberState = room.state.memberState;
const appliance = room.state.memberState.currentApplianceName;
//...Other tool details

Eraser erase picture configuration

Eraser can be configured additionally, whether it can erase pictures:

  1. During initialization, configure according to the disableEraseImage field in [Initialization Parameters-Room Parameters] (../ parameters / room.md # disableeraseimage):Whether you can erase the picture (default can be)
  2. Set the room.disableEraseImage property.

Picture (Internet address)

sdk supports inserting network pictures into the current whiteboard page (if you need local pictures, please handle the upload yourself to get the network picture logic).

Typescript signature

type ImageInformation = {
    // The unique identifier of the image. This uuid is used to ensure that completeImageUpload updates the correct insertImage address.
    uuid: string;
    // The coordinates of the center of the picture in the internal coordinate system of the whiteboard. The center far point is the center when the whiteboard is initialized
    centerX: number;
    centerY: number;
    // The width and height you want to display, which is the width and height before the whiteboard is not scaled
    width: number;
    height: number;
};

// Insert picture placeholder
public insertImage(imageInfo: ImageInformation): void;
// Image url replacement
public completeImageUpload(uuid: string, src: string): void;

Sample code

  1. Call the insertImage method to ensure that theuuid string is unique and configure the image position (size, center position) information. Then through the server or local upload to the cloud storage warehouse, get the network address of the picture information to be inserted, and call method 2 to pass in the picture network address.
// Method 1 Insert picture placeholder information
// Use uuid to ensure that completeImageUpload updates the same image address
room.insertImage({
    uuid: uuid,
    centerX: x,
    centerY: y,
    width: imageFile.width,
    height: imageFile.height
});
// Method 2 Pass in the picture placeholder uuid and the picture network address.
room.completeImageUpload(uuid, imageUrl)

The difference between picture tool andppt background map

DifferenceInsert background image putScenesinsertImage and completeImageUpload
Relationship to the pageCreate a blank page with a background imageAn image is inserted in the current page, and the front and back are determined according to the drawing relationship
PositionCenterLayout in the internal system of the whiteboard according to the position information of the insertImage input parameter
eraserCannot be alteredIt can be altered by default. It can be changed by modifying the disableEraseImage property ofroom or by configuring the disableEraseImage parameter during initialization.

Hand tool

Shortcut settings

Please read the handToolKey field description in Initialization Parameters-SDK Parameters.

Active activation / deactivation

Modify the handToolActive property of room directly.

// active activation
room.handToolActive = true;
// active shutdown
room.handToolActive = false;

Activate / deactivate callback

When the grabber tool is activated, the onHandToolActive method of callbacks in Initialization Parameters-Room Parameters will be called back.

Disable tool

2.2.0 Add API

Modify the disableDeviceInputs property of room or configure the disableDeviceInputs parameter during initialization.

// Prohibition of tool operation
room.disableDeviceInputs = true;
// Resume tool operation
room.disableDeviceInputs = false;

sdk.joinRoom({uuid: "uuid", roomToken: "roomToken", disableDeviceInputs: true})
.then(function(room) {
    //room operate
});
Last updated on 3/5/2020 by leavesster
← Replay parametersPerspective operation →
  • Ordinary tools
    • MemberState structure
    • Kind
    • Adjust teaching aids (kind, color, thickness, size)
    • Inquiry about teaching aids
    • Eraser erase picture configuration
  • Picture (Internet address)
    • Typescript signature
    • Sample code
    • The difference between picture tool andppt background map
  • Hand tool
    • Shortcut settings
    • Active activation / deactivation
    • Activate / deactivate callback
  • Disable tool
Netless
Let's interactive.
Product
ConsoleHomepageDemoGithub
Company
Join usServicePrivacy
Contact
support@netless.linkCommunity
Copyright © 2020 Netless