import {PointerLens} from '@xeokit/xeokit-sdk/src/extras/PointerLens/PointerLens.js'
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.
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 |
snappedCanvasPos: Number[]: * 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 |
destroy() Destroys this PointerLens. |
|
public |
update() Updates this PointerLens. |
Public Constructors
public constructor(viewer: *, cfg: *) source
Constructs a new PointerLens.
Params:
Name | Type | Attribute | Description |
viewer | * | The Viewer |
|
cfg | * |
|
PointerLens configuration. |
cfg.active | * |
|
Whether PointerLens is active. The PointerLens can only be shown when this is |
Public Members
public scene: * source
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 |