Skip to content

Latest commit

 

History

History
137 lines (96 loc) · 3.44 KB

advanced.md

File metadata and controls

137 lines (96 loc) · 3.44 KB

Advanced usage

Undo redo

The following events and properties will automatically switch application objects according to the focus window

Get the number of steps that can be undone/redoed

manager.canUndoSteps
manager.canRedoSteps

Monitor changes in the number of steps that can be undone/redoed

canRedoStepsChange and canUndoStepsChange will retrigger when switching windows

manager.emitter.on("canUndoStepsChange", (steps: number) => {
     // undoable steps update
})
manager.emitter.on("canRedoStepsChange", (steps: number) => {
     // Update the number of steps that can be redone
})

Undo/Redo

manager.undo() // undo
manager.redo() // redo

Clear screen

Because there are multiple whiteboards in multi-window mode, if you want to clear the current focus whiteboard, you only need to call

manager.cleanCurrentScene()

If you only want to clean up the handwriting on the main whiteboard, you need

manager.mainView.cleanCurrentScene()

Determine whether to open a certain APP

manager.emitter.on("ready", () => { // ready event is triggered after all app creation is complete
     const apps = manager.queryAll(); // Get all opened apps
     const hasSlide = apps.some(app => app.kind === "Slide"); // Determine whether there is Slide in the opened APP
});

page controller

manager provides a pageState to get the current index and the total number of pages

manager.pageState.index // current index
manager.pageState.length // total number of pages

manager.emitter.on("pageStateChange", state => {
     // This event will be triggered when the current index changes and the total number of pages changes
});

Previous/Next/Add a page

manager.nextPage()
manager.prevPage()
manager.addPage()

View follow

ViewMode in multi-window has broadcaster freedom two modes

  • freedom

    Free mode, users can freely zoom and move the viewing angle

    Even if there is an anchor in the room, the anchor cannot affect the user's perspective

  • broadcaster

    Host mode, other people's perspectives will follow me during operation

    At the same time, other people in broadcaster mode will also affect my perspective

    When isWritable is false, it will only follow other broadcaster perspectives


Insert an image into the current app

// Determine whether the current is maximized
if (manager.boxState === "maximized") {
     // The value of `focused` will vary depending on the currently focused app
     const app = manager.queryOne(manager. focused)
     // Only apps with a view can insert pictures, apps like video and audio do not have a view
     if (app.view) {
         var imageInformation = {
             uuid: uuid,
             centerX: centerX,
             centerY: centerY,
             width: width,
             height: height,
             locked: false,
         };
         app.view.insertImage(imageInformation);
         app.view.completeImageUpload(uuid, src);
     }
}