.. role:: ts-api-decorator

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

.. container:: ts-api-section

   .. 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/communicator/latest/prog_guide/viewing/scene_attributes/axis-triad-and-navcube.html).



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :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
=======

.. rst-class:: ts-api-section

disable
-------

.. js:method:: NavCube.disable()



   Disables the NavCube.


   :rtype: Promise <void>

.. rst-class:: ts-api-section

enable
------

.. js:method:: NavCube.enable()



   Enables the NavCube.


   :rtype: Promise <void>

.. rst-class:: ts-api-section

getAnchor
---------

.. js:method:: NavCube.getAnchor()



   Gets the anchor position for the NavCube. Default position is in the UpperRightCorner, see [[OverlayAnchor]] for more details.


   :rtype: OverlayAnchor

.. rst-class:: ts-api-section

getEnabled
----------

.. js:method:: NavCube.getEnabled()



   Gets whether the NavCube is currently enabled.


   :rtype: boolean

.. rst-class:: ts-api-section

getOverlayId
------------

.. js:method:: NavCube.getOverlayId()



   Gets the associated overlay id.


   :rtype: number

.. rst-class:: ts-api-section

getPreserveModelUp
------------------

.. js:method:: NavCube.getPreserveModelUp()



   Gets the NavCube preserveModelUp state.

   :returns: true if model up is preserved, false if camera up is preserved.


   :rtype: boolean

.. rst-class:: ts-api-section

insideOverlay
-------------

.. js:method:: NavCube.insideOverlay( mousePos)

   :param mousePos: None
   :type mousePos: Point2


   Determines whether or not a point is inside the NavCube overlay.

   :returns: Boolean indicating whether the provided point is inside the NavCube overlay


   :rtype: boolean

.. rst-class:: ts-api-section

onClickSelection
----------------

.. js:method:: NavCube.onClickSelection( selection)

   :param selection: None
   :type selection: null | SelectionItem


   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.


   :rtype: Promise <void>

.. rst-class:: ts-api-section

onMoveSelection
---------------

.. js:method:: NavCube.onMoveSelection( selection)

   :param selection: None
   :type selection: null | SelectionItem


   Called when the NavCube is "moused over". Displays face/edge/corner that will be selected.


   :rtype: void

.. rst-class:: ts-api-section

setAnchor
---------

.. js:method:: NavCube.setAnchor( anchor)

   :param anchor: the anchor position.
   :type anchor: OverlayAnchor


   Sets the anchor position for the NavCube.


   :rtype: Promise <void>

.. rst-class:: ts-api-section

setPreserveModelUp
------------------

.. js:method:: NavCube.setPreserveModelUp( preserve)

   :param preserve: If true, model up is preserved. Otherwise, camera up is preserved.
   :type preserve: boolean


   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``.


   :rtype: void

