@@ -6,6 +6,7 @@ import '@kitware/vtk.js/Rendering/Profiles/All';
6
6
import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow' ;
7
7
import vtkStateBuilder from '@kitware/vtk.js/Widgets/Core/StateBuilder' ;
8
8
9
+ import vtkSphereHandleRepresentation from '@kitware/vtk.js/Widgets/Representations/SphereHandleRepresentation' ;
9
10
import vtkLineGlyphRepresentation from '@kitware/vtk.js/Widgets/Representations/LineGlyphRepresentation' ;
10
11
11
12
// ----------------------------------------------------------------------------
@@ -26,7 +27,7 @@ const compositeState = vtkStateBuilder
26
27
. createBuilder ( )
27
28
. addDynamicMixinState ( {
28
29
labels : [ 'handles' ] ,
29
- mixins : [ 'origin' ] ,
30
+ mixins : [ 'origin' , 'scale1' ] ,
30
31
name : 'handle' ,
31
32
} )
32
33
. build ( ) ;
@@ -41,6 +42,7 @@ const points = [
41
42
points . forEach ( ( point ) => {
42
43
const handle = compositeState . addHandle ( ) ;
43
44
handle . setOrigin ( point ) ;
45
+ handle . setScale1 ( 1 ) ;
44
46
} ) ;
45
47
46
48
// -----------------------------------------------------------
@@ -49,11 +51,18 @@ points.forEach((point) => {
49
51
50
52
const widgetRep = vtkLineGlyphRepresentation . newInstance ( {
51
53
scaleInPixels : false ,
52
- close : true ,
54
+ lineThickness : 0.5 , // radius of the cylinder
53
55
} ) ;
54
56
widgetRep . setInputData ( compositeState ) ;
55
57
widgetRep . setLabels ( [ 'handles' ] ) ;
56
58
widgetRep . getActors ( ) . forEach ( renderer . addActor ) ;
57
59
60
+ const handleRep = vtkSphereHandleRepresentation . newInstance ( {
61
+ scaleInPixels : false ,
62
+ } ) ;
63
+ handleRep . setInputData ( compositeState ) ;
64
+ handleRep . setLabels ( [ 'handles' ] ) ;
65
+ handleRep . getActors ( ) . forEach ( renderer . addActor ) ;
66
+
58
67
renderer . resetCamera ( ) ;
59
68
renderWindow . render ( ) ;
0 commit comments