Using jQuery
Using jQuery is also supported when working with the 2D Viewer API.
For legacy reasons small differences exist in the way you interact with the 2D Viewer when using jQuery.
Include jQuery in your HTML file using a script tag.
Include the 2D Viewer in your HTML file using a script tag, this will add the global bimsync object to the window object.
Create a div element for attaching a 2D Viewer instance to.
Set a callback function and then invoke the loadViewer2d method, the 2D Viewer is ready once callback invoked.
Initialize the 2D Viewer by invoking the viewer2d method on the jQuery object for the div where you want to attach the 2D Viewer.
Call methods on the 2D Viewer instance to interact with the 2D Viewer.
The options for the 2D Viewer are the same when using jQuery but the default value may differ.
Name | Type | Default | Description |
---|---|---|---|
hoverSpaces | Boolean | true | Whether mouse hover highlights space below the cursor |
showViewpoint | Boolean | true | Sets viewpoint visibility |
selectColor | String | #a7f555 | Sets the CSS color of selected objects |
In general, the methods are the same when using jQuery but the way you call them is different.
Some methods are also available under their deprecated names.
Method | Deprecated Names |
---|---|
getStoreyByElevation | storeyByElevation |
getStoreys | storeys |
hideStoreys | hidestoreys |
moveTo | moveto |
showStorey | showstorey |
transformModel | setTransformation |
For legacy reasons some methods have different signatures when using jQuery.
When using jQuery the name for this method is screenshot.
Usage
onScreenshot
Type |
---|
(imageData: String) => Void |
When using jQuery the name for this method is loadUrlPromise.
Usage
Callbacks for 2D Viewer events may have different signatures when using jQuery. Each event documentation page details any differences.