File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Sources/Rendering/Core/RenderWindowInteractor Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ declare enum handledEvents {
41
41
'Interaction' ,
42
42
'EndInteraction' ,
43
43
'AnimationFrameRateUpdate' ,
44
+ 'RendererChange' ,
44
45
}
45
46
46
47
/**
@@ -412,6 +413,12 @@ export interface vtkRenderWindowInteractor extends vtkObject {
412
413
*/
413
414
invokeEndInteractionEvent ( callData : IRenderWindowInteractorEvent ) : void ;
414
415
416
+ /**
417
+ *
418
+ * @param {IRenderWindowInteractorEvent } callData
419
+ */
420
+ invokeRendererChangeEvent ( callData : IRenderWindowInteractorEvent ) : void ;
421
+
415
422
/**
416
423
*
417
424
*/
@@ -794,6 +801,16 @@ export interface vtkRenderWindowInteractor extends vtkObject {
794
801
priority ?: number
795
802
) : Readonly < vtkSubscription > ;
796
803
804
+ /**
805
+ *
806
+ * @param {InteractorEventCallback } cb The callback to be called.
807
+ * @param {Number } [priority] The priority of the event.
808
+ */
809
+ onRendererChangeEvent (
810
+ cb : InteractorEventCallback ,
811
+ priority ?: number
812
+ ) : Readonly < vtkSubscription > ;
813
+
797
814
/**
798
815
*
799
816
* @param {Function } cb The callback to be called.
@@ -971,6 +988,12 @@ export interface vtkRenderWindowInteractor extends vtkObject {
971
988
*/
972
989
rotateEvent ( args : any ) : any ;
973
990
991
+ /**
992
+ *
993
+ * @param args
994
+ */
995
+ rendererChangeEvent ( ) : any ;
996
+
974
997
/**
975
998
* Add an HTMLElement as the new container for the interactor.
976
999
* All events will be bound to this new container.
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ const handledEvents = [
68
68
'Interaction' ,
69
69
'EndInteraction' ,
70
70
'AnimationFrameRateUpdate' ,
71
+ 'RendererChange' ,
71
72
] ;
72
73
73
74
function preventDefault ( event ) {
@@ -163,7 +164,11 @@ function vtkRenderWindowInteractor(publicAPI, model) {
163
164
164
165
function updateCurrentRenderer ( x , y ) {
165
166
if ( ! model . _forcedRenderer ) {
167
+ const oldRenderer = model . currentRenderer ;
166
168
model . currentRenderer = publicAPI . findPokedRenderer ( x , y ) ;
169
+ if ( oldRenderer !== model . currentRenderer ) {
170
+ publicAPI . rendererChangeEvent ( ) ;
171
+ }
167
172
}
168
173
}
169
174
@@ -1188,7 +1193,10 @@ function vtkRenderWindowInteractor(publicAPI, model) {
1188
1193
1189
1194
publicAPI . setCurrentRenderer = ( r ) => {
1190
1195
model . _forcedRenderer = ! ! r ;
1191
- model . currentRenderer = r ;
1196
+ if ( r !== model . currentRenderer ) {
1197
+ model . currentRenderer = r ;
1198
+ publicAPI . rendererChangeEvent ( ) ;
1199
+ }
1192
1200
} ;
1193
1201
1194
1202
publicAPI . setContainer = ( container ) => {
You can’t perform that action at this time.
0 commit comments