@twinfinity/core
    Preparing search index...

    Class MeasureHandler

    Contains methods to add, remove and preview distance measurement.

    Index

    Constructors

    Accessors

    Methods

    • Creates and updates laser preview on canvas upon mouse move, by means of createOrUpdateLaserPreview.

      Returns void

    • Removes all measurements and deactivates laser preview. Also removes coordinate trackers for labels if present.

      Returns void

    • Gets the pointer positions on screen and finds where the geometry is hit. From that intersection on the geometry it creates a preview laser measurement. This method can be run for every frame or activated using activateLaserPreview.

      Returns undefined | Ray

    • This method adds a visual measurement to viewer from a intersection on the geometry.

      Parameters

      • id: unknown

        String for identifying a unique measurement.

      • laserOrigin: Intersection

        The origin position of the measurement, including surface normal to project ray for finding endpoint of distance to measure.

      • labelDistanceFromOrigin: number = 0.75

        Value between 0 and 1 to describe in percent distance from origin along the ray to use as label coordinate anchor. Default 0.75 (75%).

      • OptionalonLabelUpdate: LabelUpdateHandler

        If this optional callback is provided it tracks the position calculated from labelDistanceFromOrigin and tells where the coordinate is in screen space.

      Returns undefined | Ray

    • Deactivates and removes laser preview on canvas upon mouse move.

      Returns void

    • Removes all measurements and deactivates laser preview. Also removes coordinate trackers for labels if present.

      Returns void

      Use clear instead. The naming convention for this method is incorrect as it does not actually dispose the object but clears it.

    • Removes a measurement by its ID.

      Parameters

      • id: unknown

        of measurement to be removed.

      Returns boolean

      true if wall laser was removed. ´false´ if it did not exist.