@@ -281,32 +281,9 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
281
281
282
282
const { rotatableCrosshairsWidget } = thisApi . svgWidgets ;
283
283
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' ) ;
300
285
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 ) ;
310
287
}
311
288
312
289
function snapPosToLine ( position , lineIndex ) {
@@ -364,7 +341,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
364
341
365
342
function moveCrosshairs ( pos , renderer ) {
366
343
const { apis, apiIndex } = model ;
367
- const api = apis [ apiIndex ] ;
344
+ const thisApi = apis [ apiIndex ] ;
368
345
369
346
const dPos = vtkCoordinate . newInstance ( ) ;
370
347
dPos . setCoordinateSystemToDisplay ( ) ;
@@ -375,7 +352,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
375
352
const camera = renderer . getActiveCamera ( ) ;
376
353
const directionOfProjection = camera . getDirectionOfProjection ( ) ;
377
354
378
- const halfSlabThickness = api . getSlabThickness ( ) / 2 ;
355
+ const halfSlabThickness = thisApi . getSlabThickness ( ) / 2 ;
379
356
380
357
// Add half of the slab thickness to the world position, such that we select
381
358
// The center of the slice.
@@ -384,7 +361,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
384
361
worldPos [ i ] += halfSlabThickness * directionOfProjection [ i ] ;
385
362
}
386
363
387
- api . svgWidgets . rotatableCrosshairsWidget . moveCrosshairs (
364
+ thisApi . svgWidgets . rotatableCrosshairsWidget . moveCrosshairs (
388
365
worldPos ,
389
366
apis ,
390
367
apiIndex
@@ -467,11 +444,7 @@ function vtkInteractorStyleRotatableMPRCrosshairs(publicAPI, model) {
467
444
} ;
468
445
469
446
// Move point.
470
- moveCrosshairs (
471
- displayCoordinate ,
472
- //{ x: newCenterPointSVG[0], y: newCenterPointSVG[1] },
473
- renderer
474
- ) ;
447
+ moveCrosshairs ( displayCoordinate , renderer ) ;
475
448
}
476
449
477
450
function getDisplayCoordinateScrollIncrement ( point ) {
0 commit comments