@onirix/node-inspector

1.0.1 • Public • Published

Version
Documentation Twitter: onirix

OnirixNodeInspector

OnirixNodeInspector is a JavaScript library designed to interact with the Onirix Embed SDK. It provides functionality to load, inspect, and highlight nodes in a 3D scene, display associated data sheets for selected nodes, and manage interactions with nodes in the scene.

To learn more about this module visit our documentation.

Install

You can install the library via npm:

npm install @onirix/node-inspector

Alternatively, include the dependency in the HTML

tag:
<head>
    <script src="https://unpkg.com/@onirix/node-inspector@1.0.0/dist/ox-node-inspector.umd.js"></script>
</head>

Or use it as an ES module:

import OnirixNodeInspector from "https://unpkg.com/@onirix/node-inspector@1.0.0/dist/ox-node-inspector.esm.js";

Usage

Initialization

To initialize the OnirixNodeInspector module, create a new instance of the class and pass the Onirix EmbedSDK instance.

import OnirixEmbedSDK from "https://unpkg.com/@onirix/embed-sdk@1.17.0/dist/ox-embed-sdk.esm.js";
import OnirixNodeInspector from "https://unpkg.com/@onirix/node-inspector@1.0.0/dist/ox-node-inspector.esm.js";

const embedSdk = new OnirixEmbedSDK();
embedSdk.connect();

const nodeInspector = new OnirixNodeInspector(embedSdk);

const nodeInspector = new OnirixNodeInspector(embedSdk, {
    enableHighlight: true,
    highlightParams: { type: "box", border: { enable: true } },
    showNodeData: true,
    onlyWithDatasheets: false,
});

Onirix Node Inspector offers you several options to adapt its use to your needs. You can configure the operation through a second parameter in the module builder. These are the available options:

  • embedSdk (required): Instance of the Onirix Embed SDK.
  • params (optional): Configuration parameters for the inspector:
    • enableHighlight (default: true): Whether to enable node highlighting.
    • dataStructure(default: ox-node-inspector): Name of the datasheet data structure.
    • highlightParams (default: {type: "box", border: {enable: false}}): Parameters for node highlighting.
    • showNodeData (default: true): Whether to show node data in the UI panel when a node is selected.
    • onlyWithDatasheets (default: false): Whether to only include nodes with associated datasheets.
    • onNodeSelected (default: null): Callback function to execute when a node is selected.
import OnirixEmbedSDK from "https://unpkg.com/@onirix/embed-sdk@1.17.0/dist/ox-embed-sdk.esm.js";
import OnirixNodeInspector from "https://unpkg.com/@onirix/node-inspector@1.0.0/dist/ox-node-inspector.esm.js";

const embedSdk = new OnirixEmbedSDK();
embedSdk.connect();

const params = {
    'highlightParams': {
        'color': '#F00'
    },
    'dataStructure': 'my-structure',
    'onlyWithDatasheets': true
}

const nodeInspector = new OnirixNodeInspector(embedSdk, params);

OnirixNodeInspector Class

Methods

setHighlightingParams(enable, params)

Configures the highlighting parameters for nodes. More information about the highlighting options in the EmbedSDK documentation.

  • Parameters:
    • enable (boolean): Whether to enable node highlighting.
    • params (object): Highlighting parameters, such as type and border settings.
  • Example:
nodeInspector.setHighlightingParams(true, { type: "box", border: { enable: true } });

Example

import OnirixEmbedSDK from "https://unpkg.com/@onirix/embed-sdk@1.12.0/dist/ox-embed-sdk.esm.js";
import OnirixNodeInspector from "https://unpkg.com/@onirix/node-inspector@0.0.1/dist/ox-node-inspector.esm.js";

const embedSdk = new OnirixEmbedSDK();
embedSdk.connect();

const nodeInspector = new OnirixNodeInspector(embedSdk);

// Configure highlighting
nodeInspector.setHighlightingParams(true, { type: "box", border: { enable: true } });

Author

👤 Onirix

Package Sidebar

Install

npm i @onirix/node-inspector

Weekly Downloads

3

Version

1.0.1

License

Propietary

Unpacked Size

170 kB

Total Files

7

Last publish

Collaborators

  • frangaren
  • onirix_development
  • vifergo