Default Process

The default process allows a user to receive a common callback from a scene.

Class of process (TypeScript):

export type DefaultProcess = {
    name: "Default"
    options: {
        [key: string]: unknown
    },
    events:{
        onContextMenu?:(xClient:number, yClient:number, uuid?:string, modelUuid?:string)=>void
        onEdit?:(xClient:number, yClient:number, uuid?:string, modelUuid?:string, ext?:{text?: boolean})=>void
        onEditText?:(uuid:string, index?:number)=>void
        onHint?:(xClient:number, yClient:number, uuid?:string, modelUuid?:string)=>void
        onSelect?:(uuid?:string, modelUuid?:string)=>void|true
    }
}

To run the process, you should call the command RunProcessCommand with the Default name of a process.

Example (TypeScript):

view.runCommand({
    name: "RunProcessCommand", // name of command
    // next arguments
    process:{
        name:"Default", // process name
        options:{}, // process options
        events:{} // process events
    }
})

Events

Available events:

  • onContextMenu(x, y, uuid, modelUuid): emitted with a left click on a model, receives x, y (viewport coordinates of the event) and a uuid linked to a geometry object.

  • onEdit(x, y, uuid, modelUuid): emitted with a double click on a model, receives x, y (viewport coordinates of the event) and a uuid linked to a geometry object.

  • onEditText(uuid, index): emitted with a single click on a text geometry object, receives a uuid of objects and an index (not active at the moment).

  • onHint(x, y, uuid, modelUuid): emitted when the mouse hovers over a geometry object, receives x, y (viewport coordinates of the event) and a uuid linked to a geometry object (uuid can be empty in cases of hints).

  • onSelect(uuid, modelUuid): emitted with a single click on geometry, receives a uuid of this geometry which can be empty when non-geometry clicking. If it returns true, the geometry is highlighted. If a uuid is empty and it returns true, highlighting clears up.

Important

Updating process is not provided!

New in version 1.7.0: Added the parameter modelUuid to the parameter list of each callback.