@@ -281,32 +281,9 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
281281
282282 const { rotatableCrosshairsWidget } = thisApi . svgWidgets ;
283283
284- const point = rotatableCrosshairsWidget . getPoint ( ) ;
285-
286- const renderer = callData . pokedRenderer ;
287- const dPos = vtkCoordinate . newInstance ( ) ;
288- dPos . setCoordinateSystemToDisplay ( ) ;
289-
290- dPos . setValue ( point [ 0 ] , point [ 1 ] , 0 ) ;
291- let worldPos = dPos . getComputedWorldValue ( renderer ) ;
292-
293- const camera = renderer . getActiveCamera ( ) ;
294- const directionOfProjection = camera . getDirectionOfProjection ( ) ;
295-
296- const halfSlabThickness = thisApi . getSlabThickness ( ) / 2 ;
297-
298- // Add half of the slab thickness to the world position, such that we select
299- // The center of the slice.
284+ const worldPos = thisApi . get ( 'cachedCrosshairWorldPosition' ) ;
300285
301- for ( let i = 0 ; i < worldPos . length ; i ++ ) {
302- worldPos [ i ] += halfSlabThickness * directionOfProjection [ i ] ;
303- }
304-
305- thisApi . svgWidgets . rotatableCrosshairsWidget . moveCrosshairs (
306- worldPos ,
307- apis ,
308- apiIndex
309- ) ;
286+ rotatableCrosshairsWidget . moveCrosshairs ( worldPos , apis , apiIndex ) ;
310287 }
311288
312289 function snapPosToLine ( position , lineIndex ) {
@@ -364,7 +341,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
364341
365342 function moveCrosshairs ( pos , renderer ) {
366343 const { apis, apiIndex } = model ;
367- const api = apis [ apiIndex ] ;
344+ const thisApi = apis [ apiIndex ] ;
368345
369346 const dPos = vtkCoordinate . newInstance ( ) ;
370347 dPos . setCoordinateSystemToDisplay ( ) ;
@@ -375,7 +352,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
375352 const camera = renderer . getActiveCamera ( ) ;
376353 const directionOfProjection = camera . getDirectionOfProjection ( ) ;
377354
378- const halfSlabThickness = api . getSlabThickness ( ) / 2 ;
355+ const halfSlabThickness = thisApi . getSlabThickness ( ) / 2 ;
379356
380357 // Add half of the slab thickness to the world position, such that we select
381358 // The center of the slice.
@@ -384,7 +361,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
384361 worldPos [ i ] += halfSlabThickness * directionOfProjection [ i ] ;
385362 }
386363
387- api . svgWidgets . rotatableCrosshairsWidget . moveCrosshairs (
364+ thisApi . svgWidgets . rotatableCrosshairsWidget . moveCrosshairs (
388365 worldPos ,
389366 apis ,
390367 apiIndex
@@ -467,11 +444,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
467444 } ;
468445
469446 // Move point.
470- moveCrosshairs (
471- displayCoordinate ,
472- //{ x: newCenterPointSVG[0], y: newCenterPointSVG[1] },
473- renderer
474- ) ;
447+ moveCrosshairs ( displayCoordinate , renderer ) ;
475448 }
476449
477450 function getDisplayCoordinateScrollIncrement ( point ) {
0 commit comments