skinman55
skinman55

Reputation: 39

Is there a way to enable partial selection using the BoxSelection extension in the viewer

We are using a custom extension to handle window selection in the forge viewer following the steps from this blog post: https://forge.autodesk.com/blog/custom-window-selection-forge-viewer-part-iii.

We're able to set 'partial selection' mode on that extension. Is there a way to do this with the new BoxSelection extension that was added in v7.32?

Upvotes: 1

Views: 289

Answers (1)

Xiaodong Liang
Xiaodong Liang

Reputation: 2196

A new option is added with Autodesk.BoxSelection extension: useGeometricIntersection

Due to the other issue, this option is not on by default, you can switch it by the code below. After it is loaded again, Left to right mouse drag is containment, Right to left mouse drag is intersection.

async function enableGeomtricBoxSelection() {
    // unload the extension, which was loaded with geometric selection turned off
    viewer.unloadExtension('Autodesk.BoxSelection');
    // reload the extension with geometric selection turned on
    ext = await viewer.loadExtension('Autodesk.BoxSelection', {
        useGeometricIntersection: true
    });
    // Display the toolbar button (optional) in the toolbar. You can invoke box 
    // selection by holding cmd(mac) / ctrl(windows) + mouse drag
    ext.addToolbarButton(true);
}

enableGeomtricBoxSelection();

Upvotes: 3

Related Questions