Changed the zoom method to take speckle ids instead of guids, since everyother method in the API that takes ids, takes speckle ids
This commit is contained in:
@@ -181,7 +181,7 @@ export default class Sandbox {
|
||||
})
|
||||
zoomExtents.on('click', () => {
|
||||
this.viewer.zoom(
|
||||
this.selectionList.map((val) => val.guid) as string[],
|
||||
this.selectionList.map((val) => val.userData.id) as string[],
|
||||
undefined,
|
||||
true
|
||||
)
|
||||
|
||||
@@ -51,7 +51,7 @@ viewer.on(ViewerEvent.ObjectClicked, async (selectionInfo: SelectionEvent) => {
|
||||
}
|
||||
if (!selectionInfo.multiple) multiSelectList.length = 0
|
||||
|
||||
let guids = multiSelectList.map((val) => val.guid)
|
||||
const guids = multiSelectList.map((val) => val.guid)
|
||||
if (
|
||||
(selectionInfo.multiple && !guids.includes(selectionInfo.guid)) ||
|
||||
multiSelectList.length === 0
|
||||
@@ -59,7 +59,6 @@ viewer.on(ViewerEvent.ObjectClicked, async (selectionInfo: SelectionEvent) => {
|
||||
multiSelectList.push(selectionInfo)
|
||||
}
|
||||
|
||||
guids = multiSelectList.map((val) => val.guid)
|
||||
const ids = multiSelectList.map((val) => val.userData.id)
|
||||
|
||||
await viewer.selectObjects(ids as string[])
|
||||
|
||||
@@ -34,7 +34,7 @@ import SpeckleDepthMaterial from './materials/SpeckleDepthMaterial'
|
||||
import SpeckleStandardMaterial from './materials/SpeckleStandardMaterial'
|
||||
import { NodeRenderView } from './tree/NodeRenderView'
|
||||
import { Viewer } from './Viewer'
|
||||
import { WorldTree } from './tree/WorldTree'
|
||||
import { TreeNode, WorldTree } from './tree/WorldTree'
|
||||
import {
|
||||
CanonicalView,
|
||||
DefaultLightConfiguration,
|
||||
@@ -535,16 +535,24 @@ export default class SpeckleRenderer {
|
||||
return
|
||||
}
|
||||
const box = new Box3()
|
||||
objectIds.forEach((value: string) => {
|
||||
const rvs: NodeRenderView[] =
|
||||
WorldTree.getRenderTree().getRenderViewsForNodeId(value)
|
||||
for (let k = 0; k < rvs.length; k++) {
|
||||
let rvBox = null
|
||||
if ((rvBox = rvs[k].aabb) !== null) {
|
||||
box.union(rvBox)
|
||||
const rvs: NodeRenderView[] = []
|
||||
if (objectIds.length > 0) {
|
||||
WorldTree.getInstance().walk((node: TreeNode) => {
|
||||
if (!node.model.atomic) return true
|
||||
if (!node.model.raw) return true
|
||||
if (objectIds.indexOf(node.model.raw.id) !== -1) {
|
||||
rvs.push(...WorldTree.getRenderTree().getRenderViewsForNode(node, node))
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
for (let k = 0; k < rvs.length; k++) {
|
||||
let rvBox = null
|
||||
if ((rvBox = rvs[k].aabb) !== null) {
|
||||
box.union(rvBox)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (box.getSize(new Vector3()).length() === 0) {
|
||||
console.error(`'zoom' to object ids resulted in empty box`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user