viewer small fixes

This commit is contained in:
cristi8
2021-11-15 19:16:32 +02:00
parent 5de4f381c6
commit 21a4cfee87
4 changed files with 17 additions and 5 deletions
@@ -20,8 +20,10 @@ export default class FilteringManager {
transparent: false,
clippingPlanes: this.viewer.sectionBox.planes
} )
}
this.colorLegend = {}
}
filterAndColorObject( obj, filter ) {
if ( !filter )
return obj.clone()
@@ -86,6 +88,9 @@ export default class FilteringManager {
color = `hsl(${colorHue}, 50%, 30%)`
}
if ( objValue !== undefined && objValue !== null )
this.colorLegend[ objValue.toString() ] = color
let material = this.ColoredMaterial.clone()
material.color = new THREE.Color( color )
return material
@@ -142,5 +147,9 @@ export default class FilteringManager {
// Can also filter by specific value
return objValue === valueFilter
}
initFilterOperation() {
this.colorLegend = {}
}
}
@@ -169,6 +169,7 @@ export default class SceneObjects {
this.objectsInScene = this.allObjects
} else {
// A filter is to be applied
this.filteringManager.initFilterOperation()
let newFilteredObjects = new THREE.Group()
newFilteredObjects.name = 'FilteredObjects'
@@ -204,6 +205,8 @@ export default class SceneObjects {
this.appliedFilter = filter
this.viewer.needsRender = true
return { colorLegend: this.filteringManager.colorLegend }
}
async groupSolidObjects( threejsGroup ) {
+2 -2
View File
@@ -236,8 +236,8 @@ export default class Viewer extends EventEmitter {
return await this.sceneManager.sceneObjects.applyFilter( filter )
}
async getObjectsProperties() {
return await this.sceneManager.sceneObjects.getObjectsProperties()
getObjectsProperties() {
return this.sceneManager.sceneObjects.getObjectsProperties()
}
dispose() {
@@ -8,7 +8,7 @@ import Converter from './converter/Converter'
export default class ViewerObjectLoader {
constructor( parent, objectUrl, authToken, enableCahcing ) {
constructor( parent, objectUrl, authToken, enableCaching ) {
this.objectUrl = objectUrl
this.viewer = parent
this.token = null
@@ -39,7 +39,7 @@ export default class ViewerObjectLoader {
token: this.token,
streamId: this.streamId,
objectId: this.objectId,
options: { enableCahcing: enableCahcing }
options: { enableCaching: enableCaching }
} )
this.converter = new Converter( this.loader )