@@ -37,6 +37,12 @@ export const MultiViewRootContext = createContext<boolean>(false);
37
37
38
38
export const ViewContext = createContext < IView | null > ( null ) ;
39
39
40
+ export function useViewContext ( ) {
41
+ const view = useContext ( ViewContext ) ;
42
+ if ( ! view ) throw new Error ( 'No View context!' ) ;
43
+ return view ;
44
+ }
45
+
40
46
export function useRenderWindowContext ( ) {
41
47
const rw = useContext ( RenderWindowContext ) ;
42
48
if ( ! rw ) throw new Error ( 'No RenderWindow context!' ) ;
@@ -49,31 +55,31 @@ export function useRendererContext() {
49
55
return r ;
50
56
}
51
57
52
- export function useFieldData < T = vtkFieldData > ( ) {
58
+ export function useFieldDataContext < T = vtkFieldData > ( ) {
53
59
const fd = useContext ( FieldDataContext ) ;
54
60
if ( ! fd ) throw new Error ( 'No FieldData context!' ) ;
55
61
return fd as ( ) => T ;
56
62
}
57
63
58
- export function useDataset < T = vtkDataSet > ( ) {
64
+ export function useDatasetContext < T = vtkDataSet > ( ) {
59
65
const ds = useContext ( DatasetContext ) ;
60
66
if ( ! ds ) throw new Error ( 'No Dataset context!' ) ;
61
67
return ds as IDataset < T > ;
62
68
}
63
69
64
- export function useRepresentation ( ) {
70
+ export function useRepresentationContext ( ) {
65
71
const rep = useContext ( RepresentationContext ) ;
66
72
if ( ! rep ) throw new Error ( 'No Representation context!' ) ;
67
73
return rep ;
68
74
}
69
75
70
- export function useDownstream ( ) {
76
+ export function useDownstreamContext ( ) {
71
77
const ds = useContext ( DownstreamContext ) ;
72
78
if ( ! ds ) throw new Error ( 'No Downstream context!' ) ;
73
79
return ds ;
74
80
}
75
81
76
- export function useShareDataSet ( ) {
82
+ export function useShareDataSetContext ( ) {
77
83
const share = useContext ( ShareDataSetContext ) ;
78
84
if ( ! share ) throw new Error ( 'No ShareDataSet context!' ) ;
79
85
return share ;
0 commit comments