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


###############################
MeasureBodyBodyDistanceOperator
###############################

.. js:class:: wv.Operators.Measure.MeasureBodyBodyDistanceOperator

   This operator allows you to measure the minimum distance between two bodies. Moving the mouse over the model will highlight the body that will be measured. Clicking will select the first node to be measured, it will stay highlighted as you move the mouse away. Clicking a second time on a different body will begin the measurement. Once the measurement is completed you can move the mouse to position the measurement text box. The markup drawn represents the shortest distance between the two bodies you selected. Clicking a final time will place the measurement text box and finalize the measurement.
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.constructor`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.addMapping`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.checkMapping`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.clearMapping`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.isActive`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.isDragging`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.onDoubleClick`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.onMouseDown`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.onTouchEnd`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.onTouchMove`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.onTouchStart`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.setMapping`
   * :js:meth:`~wv.Operators.Measure.MeasureBodyBodyDistanceOperator.stopInteraction`
   
   



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

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


.. js:method:: wv.Operators.Measure.MeasureBodyBodyDistanceOperator.constructor

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



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

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


.. js:method:: wv.Operators.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.onMouseDown

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | onMouseDown(**event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`\ ): *void*
      
      Base method for handling mouse down events. It tracks the time between mouse down events to determine if a double click has occurred, and checks the button and key modifier mapping to determine if the operator should be activated. If the operator is activated, it stores the initial mouse position and sets the dragging state to true.
      
      **Parameters**
      
      
         **event**\ : :js:class:`MouseInputEvent <wv.Event.MouseInputEvent>`
      
      
            The mouse down event to handle.
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.Operators.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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.Measure.MeasureBodyBodyDistanceOperator.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*
      




