Reference Source
public class | source

PointerLens

A PointerLens shows a magnified view of a Viewer's canvas, centered at the position of the mouse or touch pointer.

This component is used by DistanceMeasurementsControl and AngleMeasurementsControl to help position the pointer when snap-to-vertex or snap-toedge is enabled.

[Run an example]


 import {Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsMouseControl, PointerLens} from "../../dist/xeokit-sdk.es.js";

 const viewer = new Viewer({
     canvasId: "myCanvas",
     dtxEnabled: true
 });

 viewer.camera.eye = [-3.93, 2.85, 27.01];
 viewer.camera.look = [4.40, 3.72, 8.89];
 viewer.camera.up = [-0.01, 0.99, 0.039];

 const xktLoader = new XKTLoaderPlugin(viewer);

 const sceneModel = xktLoader.load({
     id: "myModel",
     src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt",
     edges: true
 });

 const angleMeasurements = new AngleMeasurementsPlugin(viewer);

 const angleMeasurementsMouseControl  = new AngleMeasurementsMouseControl(angleMeasurements, {
     pointerLens : new PointerLens(viewer, {
         zoomFactor: 2
     })
 })

 angleMeasurementsMouseControl.activate();

Constructor Summary

Public Constructor
public

constructor(viewer: *, cfg: *)

Constructs a new PointerLens.

Member Summary

Public Members
public set

active(active: *)

Sets if this PointerLens is active.

public get

Gets if this PointerLens is active.

public set

canvasPos(canvasPos: *)

Sets the canvas central position of the lens.

public get

Gets the canvas central position of the lens.

public

scene: *

public set

snappedCanvasPos(snappedCanvasPos: *)

Sets the canvas coordinates of the pointer.

public get

Gets the canvas coordinates of the snapped pointer.

public

viewer: *

public set

zoomFactor(zoomFactor: *)

Sets the zoom factor for the lens.

public get

zoomFactor: *: *

Gets the zoom factor for the lens.

Method Summary

Public Methods
public

Destroys this PointerLens.

public

update()

Updates this PointerLens.

Public Constructors

public constructor(viewer: *, cfg: *) source

Constructs a new PointerLens.

Params:

NameTypeAttributeDescription
viewer *

The Viewer

cfg *
  • optional

PointerLens configuration.

cfg.active *
  • optional
  • default: true

Whether PointerLens is active. The PointerLens can only be shown when this is true (default).

Public Members

public set active(active: *) source

Sets if this PointerLens is active.

public get active: Boolean: * source

Gets if this PointerLens is active.

Return:

Boolean

public set canvasPos(canvasPos: *) source

Sets the canvas central position of the lens.

public get canvasPos: Number[]: * source

Gets the canvas central position of the lens.

Return:

Number[]

public scene: * source

public set snappedCanvasPos(snappedCanvasPos: *) source

Sets the canvas coordinates of the pointer.

public get snappedCanvasPos: Number[]: * source

Gets the canvas coordinates of the snapped pointer.

Return:

Number[]

public viewer: * source

public set zoomFactor(zoomFactor: *) source

Sets the zoom factor for the lens.

This is 2 by default.

public get zoomFactor: *: * source

Gets the zoom factor for the lens.

This is 2 by default.

Return:

*

Number

Public Methods

public destroy() source

Destroys this PointerLens.

public update() source

Updates this PointerLens.