Properties
append
Optional
boolean | null
Whether the DOM node should be appended after the annotation, or replace it.
Default Value
falsenoZoom
Optional
boolean | null
Whether to automatically zoom the DOM node as the current NutrientViewer.ViewState#zoom changes.
Default Value
falseonDisappear
Optional
Callback to be called whenever the custom DOM node is unmounted.
This object defines the properties of a custom annotation renderer.
It's returned from a CustomRenderers
Annotationcallback.Note that when
append=false(which is the default value for the property), the default appearance of the annotation is not rendered, including the pointer event listeners.This means that, if you want you custom content to select the annotation when clicked, you'll have to add some logic to support it.
You can add an event listener to your node in your custom renderer code, and also supply a callback to the
onDisappearproperty to remove the listener:The
onDisappearcallback function will be run whenever the returned node reference changes, and when the custom rendered component unmounts (is removed from the DOM). With this in mind, and in order to save the browser some unnecessary work, you could rewrite the previous example as follows:In this example the
onDisappear()reference changes on every call, but since thenodereference doesn't change,onDisappear()will only be called when the component unmounts.Note that the component does not only unmount when the page it's included is scrolled some pages out, but also, for example, when the annotation it's associated with is selected in the UI, in which case the component is unmounted and mounted again.