> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

The component is designed to communicate intrinsic status changes via custom JavaScript events.\
Events are scoped to the \<ansys-adr-viewer> element and handlers should be attached
to the viewer element itself.  An example of connecting to the partlist changed event assuming
instantiation via the previous example code:

```html theme={null}
<script> 
  function partlistChangedFunc(e) { 
     var obj = document.getElementById("Viewer"); 
     const new_list = obj.parts; 
     // Event handler code goes here...
  } 

  var viewer = document.getElementById("Viewer"); 
  viewer.addEventListener("parts-changed", partlistChangedFunc); 
</script> 
```

In general, events do not contain significant data payloads, relying on
properties to contain the changed state values.

## Event details

There are a number of available events. Many are in common over all the renderers, but not all.

| Event | Trigger | Renderer | Details |
| - | - | - | - |
| **active-changed** | 'active' changes | all | \{active: bool} |
| **src-changed** | 'src' changes | all | \{src:url, ext:filename\_ext} |
| **parts-changed** | 'parts' changes | webgl,envnc | \{} |
| **proxy-img-changed** | 'proxy-img' changes  Note: not the actual aspect ratio, just the property | all | \{proxy\_image:url} |
| **aspect-ratio-changed** | 'aspect-ratio' changes | all | \{aspect\_ratio: float} |
| **part-attributes-changed** | Emitted when setAttributes() is called. | SCDOC | \{parts:\[names], changed:\[attrnames]} |
| **gltfviewer-data-probe** | The event emits by default and is controlled by the "\_okToSendViewEvent" property, which can be accessed through:  viewer\_element.\_render\_instance.\_renderer.scene.navigator (viewer\_element = \<ansys-adr-viewer />) | webgl | \{ emitEle: \[the viewer element that emits this event], guid: \[viewer guid], xy: \[x,y coordinate of the current cursor], syncCursorRay: \[current cursor location's data] width: \[viewer width] , height: \[viewer height]} |
| **gltfviewer-view-change** | The event emits by default for non-animated scene and is controlled by the "\_okToSendViewEvent" property, which can be accessed through:  viewer\_element.\_render\_instance.\_renderer.scene.navigator (viewer\_element = \<ansys-adr-viewer />) | webgl | \{ proj: \[current viewer's camera projection],  animateSwitch: \[false by default], guid: \[viewer guid]} |
| **gltfviewer-spaceclaim-showhover** | tooltip changes | webgl  SCDOC datafile | \{tip:tiptext} |
| **gltfviewer-spaceclaim-showfacepoint** | a point is picked on a face/edge/body | webgl  SCDOC datafile | \{x:float,y:float,z:float} |
| **gltfviewer-spaceclaim-pick** | new entity is selected (face/edge/body)  The viewer must be in picking mode. | webgl  SCDOC datafile | **see below** |

**gltfviewer-spaceclaim-pick** details:

* name: part name
* path: complete "path" to the pick target
* type: SELECTION\_NONE|SELECTION\_EDGE|SELECTION\_FACE|SELECTION\_BODY

Additional fields if type==SELECTION\_EDGE or type==SELECTION\_FACE:

* min: \[xmin, ymin, zmin]
* max: \[xmax, ymax, zmax]
* vertices: \[\[x,y,z], ...]

Additional fields if type==SELECTION\_BODY:

* min: \[xmin, ymin, zmin]
* max: \[xmax, ymax, zmax]
