.. role:: clio-inherited
   :class: clio-flag clio-flag-inherited


##############
HandleOperator
##############

.. js:class:: wv.Operators.HandleOperator

   Handles are added scene elements that can update the position of your parts through user interaction. Find more information `here <https://docs.techsoft3d.com/hoops/visualize-web/tutorials/additive-manufacturing/handles.html>`__\ .
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~wv.Operators.HandleOperator.constructor`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~wv.Operators.HandleOperator.addAxisRotationHandle`
   * :js:meth:`~wv.Operators.HandleOperator.addAxisTranslationHandle`
   * :js:meth:`~wv.Operators.HandleOperator.addHandles`
   * :js:meth:`~wv.Operators.HandleOperator.addMapping`
   * :js:meth:`~wv.Operators.HandleOperator.addPlaneTranslationHandle`
   * :js:meth:`~wv.Operators.HandleOperator.addTrackedPoint`
   * :js:meth:`~wv.Operators.HandleOperator.addViewPlaneTranslationHandle`
   * :js:meth:`~wv.Operators.HandleOperator.checkMapping`
   * :js:meth:`~wv.Operators.HandleOperator.clearMapping`
   * :js:meth:`~wv.Operators.HandleOperator.clearTrackedPoints`
   * :js:meth:`~wv.Operators.HandleOperator.generateGroupId`
   * :js:meth:`~wv.Operators.HandleOperator.getNodeIds`
   * :js:meth:`~wv.Operators.HandleOperator.getPosition`
   * :js:meth:`~wv.Operators.HandleOperator.getTrackedPoints`
   * :js:meth:`~wv.Operators.HandleOperator.getTranslation`
   * :js:meth:`~wv.Operators.HandleOperator.isActive`
   * :js:meth:`~wv.Operators.HandleOperator.isDragging`
   * :js:meth:`~wv.Operators.HandleOperator.isEnabled`
   * :js:meth:`~wv.Operators.HandleOperator.onDeactivate`
   * :js:meth:`~wv.Operators.HandleOperator.onDoubleClick`
   * :js:meth:`~wv.Operators.HandleOperator.onTouchEnd`
   * :js:meth:`~wv.Operators.HandleOperator.onTouchMove`
   * :js:meth:`~wv.Operators.HandleOperator.onTouchStart`
   * :js:meth:`~wv.Operators.HandleOperator.removeHandles`
   * :js:meth:`~wv.Operators.HandleOperator.setAxisMeshData`
   * :js:meth:`~wv.Operators.HandleOperator.setHandleSize`
   * :js:meth:`~wv.Operators.HandleOperator.setMapping`
   * :js:meth:`~wv.Operators.HandleOperator.setNodeIds`
   * :js:meth:`~wv.Operators.HandleOperator.setPlaneMeshData`
   * :js:meth:`~wv.Operators.HandleOperator.setRotateMeshData`
   * :js:meth:`~wv.Operators.HandleOperator.setViewPlaneMeshData`
   * :js:meth:`~wv.Operators.HandleOperator.showHandles`
   * :js:meth:`~wv.Operators.HandleOperator.stopInteraction`
   * :js:meth:`~wv.Operators.HandleOperator.updatePosition`
   
   



.. rst-class:: kind-group kind-constructors

.. rubric:: Constructors
   :class: kind-group-title


.. js:method:: wv.Operators.HandleOperator.constructor

      .. rst-class:: sig-pretty-signature
      
         | HandleOperator(**viewer**\ : :js:class:`IWebViewer <wv.IWebViewer>`\ , **view**\ : :js:class:`IView <wv.IView>`\ ): :js:class:`HandleOperator <wv.Operators.HandleOperator>`
      
      **Parameters**
      
      
         **viewer**\ : :js:class:`IWebViewer <wv.IWebViewer>`
      
         **view**\ : :js:class:`IView <wv.IView>`
      
      
      **Returns**\ : :js:class:`HandleOperator <wv.Operators.HandleOperator>`
      



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: wv.Operators.HandleOperator.addAxisRotationHandle

      .. rst-class:: sig-pretty-signature
      
         | addAxisRotationHandle(**position**\ : :js:class:`Point3 <wv.Point3>`\ , **axis**\ : :js:class:`Point3 <wv.Point3>`\ , **color**\ : :js:class:`Color <wv.Color>`\ , **positionNormal**\ : (*None* | :js:class:`Point3 <wv.Point3>`\ )?, **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Adds a handle that rotates around an axis
      
      **Parameters**
      
      
         **position**\ : :js:class:`Point3 <wv.Point3>`
      
      
            center of the handle.
      
      
         **axis**\ : :js:class:`Point3 <wv.Point3>`
      
      
            axis to rotate around
      
      
         **color**\ : :js:class:`Color <wv.Color>`
      
      
            color of the handle geometry
      
      
         **positionNormal**\ : (*None* \| :js:class:`Point3 <wv.Point3>`\ ) = null
      
      
            optional vector to control the orientation of the handle geometry.
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter to associate this handle with a group of NodeIds
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.addAxisTranslationHandle

      .. rst-class:: sig-pretty-signature
      
         | addAxisTranslationHandle(**position**\ : :js:class:`Point3 <wv.Point3>`\ , **axis**\ : :js:class:`Point3 <wv.Point3>`\ , **color**\ : :js:class:`Color <wv.Color>`\ , **positionNormal**\ : (*None* | :js:class:`Point3 <wv.Point3>`\ )?, **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Adds a handle that moves along an axis.
      
      **Parameters**
      
      
         **position**\ : :js:class:`Point3 <wv.Point3>`
      
      
            center of the handle.
      
      
         **axis**\ : :js:class:`Point3 <wv.Point3>`
      
      
            axis to move along
      
      
         **color**\ : :js:class:`Color <wv.Color>`
      
      
            color of the handle geometry
      
      
         **positionNormal**\ : (*None* \| :js:class:`Point3 <wv.Point3>`\ ) = null
      
      
            optional vector to control the orientation of the handle geometry.
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter to associate this handle with a group of NodeIds
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.addHandles

      .. rst-class:: sig-pretty-signature
      
         | addHandles(**nodeIds**\ : *number*\ [], **position**\ : (*None* | :js:class:`Point3 <wv.Point3>`\ )?, **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Adds all handles into the scene, oriented along the primary axes
      
      **Parameters**
      
      
         **nodeIds**\ : *number*\ []
      
      
            corresponding to the parts that will move with the handles
      
      
         **position**\ : (*None* \| :js:class:`Point3 <wv.Point3>`\ ) = null
      
      
            world space coordinates the the handle position
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.addMapping

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | addMapping(**button**\ : :js:data:`Button <wv.Button>`\ , **modifier**\ : :js:data:`KeyModifiers <wv.KeyModifiers>`\ ?): *void*
      
      Adds a button and key modifier mapping for the operator. If no mapping is provided, all combinations are considered valid. All mappings require a mouse button, but a key modifier is optional.
      
      **Parameters**
      
      
         **button**\ : :js:data:`Button <wv.Button>`
      
         **modifier**\ : :js:data:`KeyModifiers <wv.KeyModifiers>` = KeyModifiers.None
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.addPlaneTranslationHandle

      .. rst-class:: sig-pretty-signature
      
         | addPlaneTranslationHandle(**position**\ : :js:class:`Point3 <wv.Point3>`\ , **normal**\ : :js:class:`Point3 <wv.Point3>`\ , **faceColor**\ : :js:class:`Color <wv.Color>`\ , **lineColor**\ : :js:class:`Color <wv.Color>`\ , **positionNormal**\ : (*None* | :js:class:`Point3 <wv.Point3>`\ )?, **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Adds a handle that restricts movement to a plane.
      
      **Parameters**
      
      
         **position**\ : :js:class:`Point3 <wv.Point3>`
      
      
            center of the handle.
      
      
         **normal**\ : :js:class:`Point3 <wv.Point3>`
      
      
            normal of the plane
      
      
         **faceColor**\ : :js:class:`Color <wv.Color>`
      
      
            face color of the handle geometry
      
      
         **lineColor**\ : :js:class:`Color <wv.Color>`
      
      
            outline color of the handle geometry
      
      
         **positionNormal**\ : (*None* \| :js:class:`Point3 <wv.Point3>`\ ) = null
      
      
            optional vector to control the orientation of the handle geometry.
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter to associate this handle with a group of NodeIds
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.addTrackedPoint

      .. rst-class:: sig-pretty-signature
      
         | addTrackedPoint(**point**\ : :js:class:`Point3 <wv.Point3>`\ ): *number*
      
      Add a point to the tracked points list. When the handle moves, these points will update in world space.
      
      **Parameters**
      
      
         **point**\ : :js:class:`Point3 <wv.Point3>`
      
      
      **Returns**\ : *number*
      
      
         point index
      
      



.. js:method:: wv.Operators.HandleOperator.addViewPlaneTranslationHandle

      .. rst-class:: sig-pretty-signature
      
         | addViewPlaneTranslationHandle(**position**\ : :js:class:`Point3 <wv.Point3>`\ , **color**\ : :js:class:`Color <wv.Color>`\ , **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Adds a handle that restricts movement to the viewplane.
      
      **Parameters**
      
      
         **position**\ : :js:class:`Point3 <wv.Point3>`
      
      
            center of the handle
      
      
         **color**\ : :js:class:`Color <wv.Color>`
      
      
            geometry color
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter to associate this handle with a group of NodeIds
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.checkMapping

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | checkMapping(**event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`\ ): *boolean*
      
      Checks if the given mouse event matches any of the button and key modifier mappings for the operator. If no mappings are defined, it returns true.
      
      **Parameters**
      
      
         **event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`
      
      
            The mouse event to check against the operator's mappings.
      
      
      
      **Returns**\ : *boolean*
      
      
         True if the event matches any mapping or if no mappings are defined, false otherwise.
      
      



.. js:method:: wv.Operators.HandleOperator.clearMapping

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | clearMapping(): *void*
      
      Clears any button and key modifier mappings for the operator.
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.clearTrackedPoints

      .. rst-class:: sig-pretty-signature
      
         | clearTrackedPoints(): *void*
      
      Clear the list of tracked points.
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.generateGroupId

      .. rst-class:: sig-pretty-signature
      
         | generateGroupId(): *number*
      
      This will generate a unique id to associate a group of handles with a group of NodeIds.
      
      **Returns**\ : *number*
      



.. js:method:: wv.Operators.HandleOperator.getNodeIds

      .. rst-class:: sig-pretty-signature
      
         | getNodeIds(**groupId**\ : (*None* | *number*\ )?): *number*\ []
      
      Gets the NodeIds that the handles in the scene will move.
      
      **Parameters**
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter that specifies if the NodeIds to retrieve are part of a group.
      
      
      
      **Returns**\ : *number*\ []
      



.. js:method:: wv.Operators.HandleOperator.getPosition

      .. rst-class:: sig-pretty-signature
      
         | getPosition(): (*None* | :js:class:`Point3 <wv.Point3>`\ )
      
      **Returns**\ : (*None* \| :js:class:`Point3 <wv.Point3>`\ )
      
      
         the current handle position or null if not currently active.
      
      



.. js:method:: wv.Operators.HandleOperator.getTrackedPoints

      .. rst-class:: sig-pretty-signature
      
         | getTrackedPoints(): :js:class:`Point3 <wv.Point3>`\ []
      
      Gets the tracked point list.
      
      **Returns**\ : :js:class:`Point3 <wv.Point3>`\ []
      



.. js:method:: wv.Operators.HandleOperator.getTranslation

      .. rst-class:: sig-pretty-signature
      
         | getTranslation(): :js:class:`Point3 <wv.Point3>`
      
      **Returns**\ : :js:class:`Point3 <wv.Point3>`
      
      
         the total translation applied to the handles.
      
      



.. js:method:: wv.Operators.HandleOperator.isActive

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | isActive(): *boolean*
      
      Checks if the operator is currently active, which is determined by whether the button and key modifier mapping is active or a touch event is active, and that a double click has not occurred and the context menu is not open.
      
      **Returns**\ : *boolean*
      
      
         True if the operator is active, false otherwise.
      
      



.. js:method:: wv.Operators.HandleOperator.isDragging

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | isDragging(): *boolean*
      
      Checks if the operator is currently dragging.
      
      **Returns**\ : *boolean*
      
      
         True if the operator is dragging, false otherwise.
      
      



.. js:method:: wv.Operators.HandleOperator.isEnabled

      .. rst-class:: sig-pretty-signature
      
         | isEnabled(): *boolean*
      
      Returns a boolean value indicating if handles are available to be added to the scene If there is an active explode, active measure, or the model is a 2d drawing. this will be false.
      
      **Returns**\ : *boolean*
      



.. js:method:: wv.Operators.HandleOperator.onDeactivate

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onDeactivate(): (*void* | *Promise*\ )
      
      Called when the operator is deactivated. This method stops any ongoing interactions and resets the primary touch ID. It can be overridden by child classes to provide additional cleanup behavior when the operator is deactivated.
      
      **Returns**\ : (*void* \| *Promise*\ )
      
      
         A promise that resolves when the deactivation process is complete, or void if no asynchronous operations are performed.
      
      



.. js:method:: wv.Operators.HandleOperator.onDoubleClick

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onDoubleClick(**_event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`\ ): *void*
      
      NO-OP method for handling double click events. By default, it does nothing, but child classes can override this method to provide specific behavior for double click events.
      
      **Parameters**
      
      
         **_event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`
      
      
            The double click event to handle.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.onTouchEnd

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onTouchEnd(**event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`\ ): *void*
      
      Base method for handling touch end events. If the touch event corresponds to the primary touch point, it emulates a mouse up event using the touch position and resets the primary touch ID. It also sets the event as handled based on the operator's setHandled method.
      
      **Parameters**
      
      
         **event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`
      
      
            The touch end event to handle.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.onTouchMove

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onTouchMove(**event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`\ ): *Promise*
      
      Base method for handling touch move events. If the touch event corresponds to the primary touch point, it emulates a mouse move event using the touch position. It awaits the onMouseMove method to allow for asynchronous behavior in child classes.
      
      **Parameters**
      
      
         **event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`
      
      
            The touch move event to handle.
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.onTouchStart

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onTouchStart(**event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`\ ): *void*
      
      Base method for handling touch start events. It tracks the primary touch point and emulates a mouse down event using the touch position. If there is already an active touch, it ignores additional touch start events.
      
      **Parameters**
      
      
         **event**\ : :js:class:`TouchInputEvent <wv.Event.TouchInputEvent>`
      
      
            The touch start event to handle.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.removeHandles

      .. rst-class:: sig-pretty-signature
      
         | removeHandles(): *Promise*
      
      Removes all handles from the scene.
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.setAxisMeshData

      .. rst-class:: sig-pretty-signature
      
         | setAxisMeshData(**meshData**\ : :js:class:`MeshData <wv.MeshData>`\ ): *Promise*
      
      Sets the mesh data for axis handles.
      
      **Parameters**
      
      
         **meshData**\ : :js:class:`MeshData <wv.MeshData>`
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.setHandleSize

      .. rst-class:: sig-pretty-signature
      
         | setHandleSize(**size**\ : *number*\ ): *void*
      
      Takes a scale value to change the handle size with 1 representing the default size
      
      **Parameters**
      
      
         **size**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.setMapping

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | setMapping(**button**\ : :js:data:`Button <wv.Button>`\ , **modifier**\ : :js:data:`KeyModifiers <wv.KeyModifiers>`\ ?): *void*
      
      Sets the button and key modifier mapping for the operator.
      
      **Parameters**
      
      
         **button**\ : :js:data:`Button <wv.Button>`
      
         **modifier**\ : :js:data:`KeyModifiers <wv.KeyModifiers>` = KeyModifiers.None
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.setNodeIds

      .. rst-class:: sig-pretty-signature
      
         | setNodeIds(**nodeIds**\ : *number*\ [], **groupId**\ : (*None* | *number*\ )?): *void*
      
      Sets the NodeIds that any handles in the scene will move.
      
      **Parameters**
      
      
         **nodeIds**\ : *number*\ []
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
            optional parameter that associates a group of NodeIds with a group of handles.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.setPlaneMeshData

      .. rst-class:: sig-pretty-signature
      
         | setPlaneMeshData(**meshData**\ : :js:class:`MeshData <wv.MeshData>`\ ): *Promise*
      
      Sets the mesh data for plane handles.
      
      **Parameters**
      
      
         **meshData**\ : :js:class:`MeshData <wv.MeshData>`
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.setRotateMeshData

      .. rst-class:: sig-pretty-signature
      
         | setRotateMeshData(**meshData**\ : :js:class:`MeshData <wv.MeshData>`\ ): *Promise*
      
      Sets the mesh data for rotation handles.
      
      **Parameters**
      
      
         **meshData**\ : :js:class:`MeshData <wv.MeshData>`
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.setViewPlaneMeshData

      .. rst-class:: sig-pretty-signature
      
         | setViewPlaneMeshData(**meshData**\ : :js:class:`MeshData <wv.MeshData>`\ ): *Promise*
      
      Sets the mesh data for view plane handles.
      
      **Parameters**
      
      
         **meshData**\ : :js:class:`MeshData <wv.MeshData>`
      
      
      **Returns**\ : *Promise*
      



.. js:method:: wv.Operators.HandleOperator.showHandles

      .. rst-class:: sig-pretty-signature
      
         | showHandles(): *void*
      
      Shows any handles that have been added to the scene.
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.stopInteraction

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      Stops an operator from interacting with the scene.
      
      .. rst-class:: sig-pretty-signature
      
         | stopInteraction(): *void*
      
      Stops the current interaction by triggering the "endInteraction" event on the viewer, and resets the dragging state, drag count, and button modifier active state.
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.HandleOperator.updatePosition

      .. rst-class:: sig-pretty-signature
      
         | updatePosition(**translation**\ : :js:class:`Point3 <wv.Point3>`\ , **rotation**\ : :js:class:`Matrix <wv.Matrix>`\ , **finalizePosition**\ : *boolean*\ , **groupId**\ : (*None* | *number*\ )?): *Promise*
      
      Updates the current handle position.
      
      **Parameters**
      
      
         **translation**\ : :js:class:`Point3 <wv.Point3>`
      
      
            additional translation
      
      
         **rotation**\ : :js:class:`Matrix <wv.Matrix>`
      
      
            additional rotation
      
      
         **finalizePosition**\ : *boolean*
      
      
            keep translation and rotation. If true, added translation and rotation will not reset the next time the position is updated.
      
      
         **groupId**\ : (*None* \| *number*\ ) = null
      
      
      **Returns**\ : *Promise*
      




