Skip to main content

MeasureHandler

Contains methods to add, remove and preview distance measurement.

Index

Constructors

constructor

Accessors

publicisLaserPreviewActive

  • get isLaserPreviewActive(): boolean
  • true if activateLaserPreview has been called. false if not called or if either deactivateLaserPreview or dispose is called.


    Returns boolean

Methods

publicactivateLaserPreview

  • activateLaserPreview(): void
  • Creates and updates laser preview on canvas upon mouse move, by means of createOrUpdateLaserPreview.


    Returns void

publicclear

  • clear(): void
  • Removes all measurements and deactivates laser preview. Also removes coordinate trackers for labels if present.


    Returns void

publiccreateOrUpdateLaserPreview

  • createOrUpdateLaserPreview(): undefined | Ray
  • 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

publiccreateWallLaser

  • 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

publicdeactivateLaserPreview

  • deactivateLaserPreview(): void
  • Deactivates and removes laser preview on canvas upon mouse move.


    Returns void

publicdispose

  • dispose(): void
  • Removes all measurements and deactivates laser preview. Also removes coordinate trackers for labels if present.

    @deprecated

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


    Returns void

publicremoveWallLaser

  • removeWallLaser(id: unknown): boolean
  • 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.