Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancellable measurements #1490

Merged
merged 3 commits into from
May 15, 2024
Merged

Cancellable measurements #1490

merged 3 commits into from
May 15, 2024

Conversation

xeolabs
Copy link
Member

@xeolabs xeolabs commented May 15, 2024

Addresses #1480

Extends controls for all measurements plugins; adds behaviour to the reset methods on measurements controls to destroy any measurement that is currently being constructed.

Adds reset action to context menus for examples.

Usage

The following example shows how reset is used with DistanceMeasurementsMouseControl. This is the same for all mouse and touch controls for other measurements plugins as well.

import {Viewer, XKTLoaderPlugin, ContextMenu, DistanceMeasurementsPlugin, DistanceMeasurementsMouseControl, PointerLens} from "../../dist/xeokit-sdk.es.js";

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

   //...

    const distanceMeasurementsPlugin = new DistanceMeasurementsPlugin(viewer);

    //...
    
    const distanceMeasurementsMouseControl = new 
        DistanceMeasurementsMouseControl(distanceMeasurementsPlugin, {
        })

    //...

    distanceMeasurementsMouseControl.activate();

   //..

    // Resets control and destroys any measurement currently in progress
    
    distanceMeasurementsMouseControl.reset();

Example:

@xeolabs xeolabs merged commit 9342247 into master May 15, 2024
3 of 4 checks passed
@xeolabs xeolabs added this to the 2.6.0 milestone May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant