Skip to content

Commit

Permalink
Added clearMeasurements functionality to the measurements extension (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandruPopovici authored Feb 9, 2024
1 parent b8f7953 commit f2f278d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/viewer-sandbox/src/Sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,13 @@ export default class Sandbox {
.on('click', () => {
this.viewer.getExtension(MeasurementsExtension).removeMeasurement()
})
container
.addButton({
title: 'Delete All'
})
.on('click', () => {
this.viewer.getExtension(MeasurementsExtension).clearMeasurements()
})
}

private getBVHSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ export class MeasurementsExtension extends Extension {
}
}

public clearMeasurements() {
this.removeMeasurement()
this.measurements.forEach((measurement: Measurement) => {
this.renderer.scene.remove(measurement)
})
this.measurements = []
this.viewer.requestRender()
}

protected flashMeasurement() {
let flashCount = 0
const maxFlashCount = 5
Expand Down

0 comments on commit f2f278d

Please sign in to comment.