One of Cbn.Enums.CtrlProperties
Waits until the viewer was fully loaded & bootstrapped before returning the viewer instance.
A Viewer instance or throws if an unexpected error occurs during bootstrapping.
When setting the viewer controls version property
to Injected
, this function is used to provide the viewer which should be used by the control.
Example usage:
import { Viewer } from '@combeenation/3d-viewer';
// ...
CfgrUtils.onCfgrReady(() => {
// ...
CtrlUtils.getViewerCtrl('viewer3d').injectViewer(Viewer);
// ...
});
See Combeenation docs for more details on how to use this.
The Viewer class which should be used by the control
This function is actually inherited from ExtJS: https://docs.sencha.com/extjs/6.2.0/modern/Ext.mixin.Observable.html#method-on
Can be used to adjust the viewer control's auto generated spec to your likings e.g. by changing default engine settings, adding named animations & positions or manually defining variant elements etc.
You can directly manipulate the control's auto generated spec which is passed as the only argument to the callback.
E.g.:
CtrlUtils.getViewerCtrl('viewer3d').onAfterSpecCreated(spec => {
spec.scene.engine.options.useHighPrecisionMatrix = true;
spec.scene.placements = {
insideCar: {
position: '(a, b, c)',
target: '(x, y, z)',
}
}
});
See Combeenation docs for more details on how to use this.
Called right after the spec
has been generated and before the viewer is beeing created with the
spec
.
Arguments passed to the callback:
- spec: AutoSpecStructureJson
Typical use case for this is to create custom parameter observers in the callback but it can also be used to adjust the initial tag manager parameter values, add event listeners to the viewer etc.
E.g.:
CtrlUtils.getViewerCtrl('viewer3d').onBeforeBootstrap((viewer, initialParams) => {
// Add custom parameter named "PivotPoint" which allows adjustment of a nodes pivot point
viewer.tagManager.setParameterObserver('PivotPoint', async ({ nodes, newValue }) => {
nodes
.filter(node => node instanceof AbstractMesh)
.forEach(node => {
const pivotPoint = Parameter.parseVector(newValue);
node.setPivotPoint(pivotPoint);
});
return true;
});
// Add a new initial value using the new custom parameter "PivotPoint".
// When using the viewer control's `set parameter values` slot, you can also add these values
// there which should be preferred whenever possible.
initialParams.push({
nodeName: 'doorhandle',
parameterName: 'PivotPoint',
value: '(x, y, z)',
});
});
See Combeenation docs for more details on how to use this.
Called right after the viewer has been created and before it is being bootstrapped with the
initial tag manager parameter values.
Arguments passed to the callback:
- viewer: Viewer
- initialParams: TagManagerParameterValue[]
A css compliant background string
CSS size string with or without unit or number which will be interpreted as px
Show or hide the control
True:
"Show"
False:
"PluggedOut"
CSS size string with or without unit or number which will be interpreted as px
One or more CSS classes which are added to the control. Previously added classes are removed.
Starts augmented reality session for the current scene content of the viewer control.
This includes:
See Combeenation docs for more details on how to use this.
This function is actually inherited from ExtJS: https://docs.sencha.com/extjs/6.2.0/modern/Ext.mixin.Observable.html#method-un
Generated using TypeDoc
This is the actual name of the component