File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
packages/front/src/fragments/Highlighter Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export class Highlighter
6363 autoHighlightOnClick : true ,
6464 world : null ,
6565 selectEnabled : true ,
66+ autoUpdateFragments : true ,
6667 selectMaterialDefinition : {
6768 color : new THREE . Color ( "#BCF124" ) ,
6869 renderedFaces : FRAGS . RenderedFaces . ONE ,
@@ -297,6 +298,12 @@ export class Highlighter
297298 OBC . ModelIdMapUtils . add ( map , { [ model . parentModelId ] : ids } ) ;
298299 }
299300
301+ const selectables = this . selectable ?. [ name ] ;
302+ if ( selectables ) {
303+ const selectable = OBC . ModelIdMapUtils . clone ( selectables ) ;
304+ map = OBC . ModelIdMapUtils . intersect ( [ map , selectable ] ) ;
305+ }
306+
300307 if ( exclude ) {
301308 // Include the parent modelIds in the exclusion modelIdMap from exclude
302309 const exclusion = OBC . ModelIdMapUtils . clone ( exclude ) ;
@@ -380,7 +387,9 @@ export class Highlighter
380387 fragments . highlight ( { ...definition , customId : style } , map ) ,
381388 ) ;
382389 }
383- promises . push ( fragments . core . update ( true ) ) ;
390+ if ( this . config . autoUpdateFragments ) {
391+ promises . push ( fragments . core . update ( true ) ) ;
392+ }
384393 await Promise . allSettled ( promises ) ;
385394 }
386395
Original file line number Diff line number Diff line change @@ -34,4 +34,6 @@ export interface HighlighterConfig {
3434 /** The world in which the highlighter operates. */
3535 world : OBC . World | null ;
3636 selectMaterialDefinition : Omit < FRAGS . MaterialDefinition , "customId" > | null ;
37+ /** Whether to automatically update fragments when highlighting. */
38+ autoUpdateFragments : boolean ;
3739}
You can’t perform that action at this time.
0 commit comments