Skip to main content

ADR 3D Viewer Web Component 2026 R1

Events

Last update: 17.04.2026

The component is designed to communicate intrinsic status changes via custom JavaScript events.
Events are scoped to the 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:

<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]

Connect with Ansys