File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Sources/Rendering/Core/Viewport Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,20 @@ function vtkViewport(publicAPI, model) {
47
47
}
48
48
49
49
publicAPI . getViewPropsWithNestedProps = ( ) => {
50
- const allPropsArray = [ ] ;
51
- for ( let i = 0 ; i < model . props . length ; i ++ ) {
52
- gatherProps ( model . props [ i ] , allPropsArray ) ;
50
+ let allPropsArray = [ ] ;
51
+ // Handle actor2D instances separately so that they can be overlayed and layered
52
+ const actors2D = publicAPI . getActors2D ( ) ;
53
+ // Sort the actor2D list using its layer number
54
+ actors2D . sort ( ( a , b ) => a . getLayerNumber ( ) - b . getLayerNumber ( ) ) ;
55
+ // Filter out all the actor2D instances
56
+ const newPropList = model . props . filter ( ( item ) => ! actors2D . includes ( item ) ) ;
57
+ for ( let i = 0 ; i < newPropList . length ; i ++ ) {
58
+ gatherProps ( newPropList [ i ] , allPropsArray ) ;
53
59
}
60
+ // Finally, add the actor2D props at the end of the list
61
+ // This works because, when traversing the render pass in vtkOpenGLRenderer, the children are
62
+ // traversed in the order that they are added to the list
63
+ allPropsArray = allPropsArray . concat ( actors2D ) ;
54
64
return allPropsArray ;
55
65
} ;
56
66
You can’t perform that action at this time.
0 commit comments