-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fe4955
commit 9ca6ba3
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
# Using FSI Viewer with React | ||
|
||
If you want to use the FSI Viewer with React, we recommend that you create an FSI component to ensure that the viewers are initialised correctly. | ||
|
||
Simply embedding the viewers as a component may work, but will cause problems as the viewer will be initialised in the shadow DOM and changes will not be recognised. | ||
|
||
This sample shows a sample FSI component and how it is embedded. As this is a standalone sample, the embedding is slightly different. | ||
|
||
In `fsi-component.js` you will find the class that extends the React component. You can read more about this in the corresponding documentation section [Creating the FSI Component] (https://docs.neptunelabs.com/docs/fsi-viewer/using-with-react). | ||
|
||
You can use this FSIComponent in two ways, either directly in the files or as a separate component. | ||
In `sample.js` it is directly embedded: | ||
|
||
```html | ||
<div className='fsi-viewer-section'> | ||
<FSIComponent tagName="fsi-viewer" id={"Viewer_2D"} width={"100%"} height={"500px"} | ||
dir={"/images/samples/shoe-spin/"} | ||
plugins={"FullScreen,Resize,autoSpin"} autoSpin_speed={"10"} /> | ||
</div> | ||
``` | ||
|
||
The `tagName` defines which viewer script is loaded, in this case `fsi-viewer`. The other attributes are the normal viewer parameters you would set. | ||
|
||
If you want to use this in React, unlike in this standalone example, it is important to import the FSIComponent accordingly. | ||
You can read more about this in the [Using the FSIComponent](https://docs.neptunelabs.com/docs/fsi-viewer/using-with-react#using-fsicomponent) section of the documentation. | ||
|
||
|