Skip to main content
Version: v4.5

IafViewer

IafViewer overview#

The IafViewer is a React component which enables a user to interact with a digital twin model in 3D space using various tools.

This page describes how to install and import the IafViewer component and describes the range of React data props available.

Note: For a general introduction to the IafViewer, refer to the IafViewer page in the Concepts section.

Install#

npm install @invicara/iaf-viewer

Import#

import { IafViewer } from "@invicara/iaf-viewer";

Props#

Data props#

PropTypeDescriptionDefault valueRequired
toolbarSizeStringSets the size of the toolbar. Pass small, medium, or large.mediumNo
showToolTipBooleanEnables or disables the tool tip hover-over descriptions. Pass true or false.trueNo
sidePanelColorStringSets the side panel color. You can pass a hex code, RGB value, or a color name."#1D1D1D"No
onHoverIconColorStringSets the icon color during a mouse hover event. You can pass a hex code, RGB value, or a color name.invert(40%) sepia(86%) saturate(6224%) hue-rotate(311deg) brightness(83%) contrast(101%)No
onActiveIconColorStringSets the color of the active icon. You can pass a hex code, RGB value, or a color name.invert(40%) sepia(86%) saturate(6224%) hue-rotate(311deg) brightness(83%) contrast(101%)No
toolbarColorStringSets the toolbar color. You can pass a hex code, RGB value, or a color name."#333333"No
isShowNavCubeBooleanShows or hides the navigation cube. Pass true or false.trueNo
modelVersionIdStringPass the model's version number as a string.No
showNotificationBooleanShow or hide notificationstrueNo
enableFocusModeBooleanEnable or disable focus modetrueNo
enable2DViewerBooleanToggles the display of the 2D viewertrueNo
enableOptimizedSelectionBooleanEnables a performance-optimized algorithm that improves 2D and 3D node selection speed and prevents unnecessary rerenderingfalseNo
WorkflowStringSupports multiple animations, including animated GIFS, offers properties such as scale, rotation, and opacity to bring dynamic visuals to the interface. Allows you to specify an animation script and set the duration of a looping animation.list: [ { uuid: 1, timeInSeconds: 4.5, loop: true, script: [] } ], active: undefined // change to desired UUIDNo
modelCompositionStringSets default visibility for specific model disciplines, ensuring critical components are consistently displayed. Using a JSON object of Boolean values, this enables you to specify which components are displayed from the building model, from a selection of: structural, architectural, mechanical, electrical, plumbing, fire protection and infrastructure.initial: { Structural: false, Architectural: true, Mechanical: false, Electrical: false, Plumbing: false, FireProtection: false, Infrastructural: false, default: false }No

Callback props#

PropEvent that triggers callback functionReturns
OnIsolateElementChangeCallbackThe user isolates an element in the graphics viewer when they right-click the element, then click IsolateThe ID of the isolated element
OnSelectedElementChangeCallbackThe user selects one or more elements in the graphics viewerAn updated array of the selected elements' IDs
OnResetCallbackThe user clicks the Reset buttontrue
OnHiddenElementChangeCallbackThe user hides one or more elements in the graphics viewerAn updated array of the hidden elements' IDs
saveSettingsThe user clicks the Save & Close button in the Settings pane.The IafViewer settings as a JSON object for your function to store in local storage.
OnNotificationCallbackAn info, warning or error notification event occurs.The notification as a JSON object

Example#

import React, {useEffect} from "react";import { IafViewer } from "@invicara/iaf-viewer";
const ViewerPage = () => {
  const mySaveSettingsFunction = (settings) => {    //your function here  }
  return (    <PageTemplate>      <IafViewer         toolbarSize="large"         saveSettings={mySaveSettingsFunction}      />    </PageTemplate>  )}
export default ViewerPage;