
#######
NavCube
#######

.. js:class:: NavCube

   This class provides an interface to the navigational cube which is enabled by default. The default functionality changes the camera's view orientation based on the location the user clicks on the cube. This cube is initialized and associated with an overlay when the view is created. For additional information on overlays please refer to the [[OverlayManager]].
   
   More information can be found `here <https://docs.techsoft3d.com/hoops/visualize-web/latest/prog_guide/viewing/scene_attributes/axis-triad-and-navcube.html>`_\ .
   
   
   Index
   =====
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~NavCube.disable`
   * :js:meth:`~NavCube.enable`
   * :js:meth:`~NavCube.getAnchor`
   * :js:meth:`~NavCube.getEnabled`
   * :js:meth:`~NavCube.getOverlayId`
   * :js:meth:`~NavCube.getPreserveModelUp`
   * :js:meth:`~NavCube.insideOverlay`
   * :js:meth:`~NavCube.onClickSelection`
   * :js:meth:`~NavCube.onMoveSelection`
   * :js:meth:`~NavCube.setAnchor`
   * :js:meth:`~NavCube.setPreserveModelUp`
   
   




Methods
=======

.. js:method:: NavCube.disable

   .. rst-class:: sig-pretty-signature
   
      | disable(): *Promise*
   
   Disables the NavCube.
   
   **Returns**\ : *Promise*
   



.. js:method:: NavCube.enable

   .. rst-class:: sig-pretty-signature
   
      | enable(): *Promise*
   
   Enables the NavCube.
   
   **Returns**\ : *Promise*
   



.. js:method:: NavCube.getAnchor

   .. rst-class:: sig-pretty-signature
   
      | getAnchor(): :js:data:`~OverlayAnchor`
   
   Gets the anchor position for the NavCube. Default position is in the UpperRightCorner, see [[OverlayAnchor]] for more details.
   
   **Returns**\ : :js:data:`~OverlayAnchor`
   



.. js:method:: NavCube.getEnabled

   .. rst-class:: sig-pretty-signature
   
      | getEnabled(): *boolean*
   
   Gets whether the NavCube is currently enabled.
   
   **Returns**\ : *boolean*
   



.. js:method:: NavCube.getOverlayId

   .. rst-class:: sig-pretty-signature
   
      | getOverlayId(): *number*
   
   Gets the associated overlay id.
   
   **Returns**\ : *number*
   



.. js:method:: NavCube.getPreserveModelUp

   .. rst-class:: sig-pretty-signature
   
      | getPreserveModelUp(): *boolean*
   
   Gets the NavCube preserveModelUp state.
   
   **Returns**\ : *boolean*
   
      true if model up is preserved, false if camera up is preserved.
   
   



.. js:method:: NavCube.insideOverlay

   .. rst-class:: sig-pretty-signature
   
      | insideOverlay(**mousePos**\ : :js:class:`~Point2`\ ): *boolean*
   
   Determines whether or not a point is inside the NavCube overlay.
   
   **Parameters**
   
      **mousePos**\ : :js:class:`~Point2`
   
   
   **Returns**\ : *boolean*
   
      Boolean indicating whether the provided point is inside the NavCube overlay
   
   



.. js:method:: NavCube.onClickSelection

   .. rst-class:: sig-pretty-signature
   
      | onClickSelection(**selection**\ : (*None* \| :js:class:`SelectionItem <Selection.SelectionItem>`\ )): *Promise*
   
   Called when the NavCube is clicked. Realigns the view to the side/edge/corner selected by ``selection``\ , or rotates the view 90 degrees if the selection matches the current view orientation, or does nothing if no side is selected.
   
   **Parameters**
   
      **selection**\ : (*None* \| :js:class:`SelectionItem <Selection.SelectionItem>`\ )
   
   
   **Returns**\ : *Promise*
   



.. js:method:: NavCube.onMoveSelection

   .. rst-class:: sig-pretty-signature
   
      | onMoveSelection(**selection**\ : (*None* \| :js:class:`SelectionItem <Selection.SelectionItem>`\ )): *void*
   
   Called when the NavCube is "moused over". Displays face/edge/corner that will be selected.
   
   **Parameters**
   
      **selection**\ : (*None* \| :js:class:`SelectionItem <Selection.SelectionItem>`\ )
   
   
   **Returns**\ : *void*
   



.. js:method:: NavCube.setAnchor

   .. rst-class:: sig-pretty-signature
   
      | setAnchor(**anchor**\ : :js:data:`~OverlayAnchor`\ ): *Promise*
   
   Sets the anchor position for the NavCube.
   
   **Parameters**
   
      **anchor**\ : :js:data:`~OverlayAnchor`
   
         the anchor position.
   
   
   
   **Returns**\ : *Promise*
   



.. js:method:: NavCube.setPreserveModelUp

   .. rst-class:: sig-pretty-signature
   
      | setPreserveModelUp(**preserve**\ : *boolean*\ ): *void*
   
   Determines if model up or camera up will the preserved when navigating with the NavCube. If model up is preserved, navigation with the NavCube will keep the model upright all the time. If camera up is preserved, navigation with the NavCube will attempt to preserve the current up direction of the camera as much as possible. Defaults to ``true``\ .
   
   **Parameters**
   
      **preserve**\ : *boolean*
   
         If true, model up is preserved. Otherwise, camera up is preserved.
   
   
   
   **Returns**\ : *void*
   





