@@ -57,6 +57,7 @@ import {
57
57
import { flatToNestedMatrix } from "viewer/model/accessors/dataset_layer_transformation_accessor" ;
58
58
import {
59
59
getActiveMagIndexForLayer ,
60
+ getAdditionalCoordinatesAsString ,
60
61
getPosition ,
61
62
getRotationInRadian ,
62
63
} from "viewer/model/accessors/flycam_accessor" ;
@@ -149,6 +150,7 @@ import type { Bucket, DataBucket } from "viewer/model/bucket_data_handling/bucke
149
150
import type DataLayer from "viewer/model/data_layer" ;
150
151
import Dimensions from "viewer/model/dimensions" ;
151
152
import dimensions from "viewer/model/dimensions" ;
153
+ import { eventBus } from "viewer/model/helpers/event_bus" ;
152
154
import { MagInfo } from "viewer/model/helpers/mag_info" ;
153
155
import { parseNml } from "viewer/model/helpers/nml_helpers" ;
154
156
import { overwriteAction } from "viewer/model/helpers/overwrite_action_middleware" ;
@@ -2575,12 +2577,18 @@ class DataApi {
2575
2577
* api.data.setMeshVisibility(segmentId, false);
2576
2578
*/
2577
2579
setMeshVisibility ( segmentId : number , isVisible : boolean , layerName ?: string ) {
2580
+ const state = Store . getState ( ) ;
2578
2581
const effectiveLayerName = getRequestedOrVisibleSegmentationLayerEnforced (
2579
- Store . getState ( ) ,
2582
+ state ,
2580
2583
layerName ,
2581
2584
) . name ;
2585
+ const additionalCoordinates = state . flycam . additionalCoordinates ;
2586
+ const additionalCoordKey = getAdditionalCoordinatesAsString ( additionalCoordinates ) ;
2582
2587
2583
- if ( Store . getState ( ) . localSegmentationData [ effectiveLayerName ] . meshes ?. [ segmentId ] != null ) {
2588
+ if (
2589
+ state . localSegmentationData [ effectiveLayerName ] . meshes ?. [ additionalCoordKey ] ?. [ segmentId ] !=
2590
+ null
2591
+ ) {
2584
2592
Store . dispatch ( updateMeshVisibilityAction ( effectiveLayerName , segmentId , isVisible ) ) ;
2585
2593
} else {
2586
2594
throw new Error (
@@ -2945,6 +2953,15 @@ class UtilsApi {
2945
2953
unregister : keyboard . destroy . bind ( keyboard ) ,
2946
2954
} ;
2947
2955
}
2956
+
2957
+ waitForAction ( actionType : string ) : Promise < any > {
2958
+ return new Promise ( ( resolve ) => {
2959
+ const unsubscribe = eventBus . on ( actionType , ( payload ) => {
2960
+ unsubscribe ( ) ;
2961
+ resolve ( payload ) ;
2962
+ } ) ;
2963
+ } ) ;
2964
+ }
2948
2965
}
2949
2966
2950
2967
export type ApiInterface = {
0 commit comments