Skip to content

Commit ca02f1f

Browse files
committed
refactor: move method definitions into vtk.js convention function bodies
Address review feedback: move registerOverride from extend() into the main function body for both ViewNodeFactory and SharedRenderWindow.
1 parent de4a7fa commit ca02f1f

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

Sources/Rendering/OpenGL/SharedRenderWindow/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ function resetGLState(gl, shaderCache) {
100100

101101
function vtkSharedRenderWindow(publicAPI, model) {
102102
model.classHierarchy.push('vtkSharedRenderWindow');
103+
104+
publicAPI
105+
.getViewNodeFactory()
106+
.registerOverride('vtkRenderer', vtkSharedRenderer.newInstance);
107+
103108
let renderEventSubscription = null;
104109
let renderCallback = null;
105110
let suppressRenderEvent = false;
@@ -237,9 +242,6 @@ export function extend(publicAPI, model, initialValues = {}) {
237242
'autoClearDepth',
238243
]);
239244
vtkSharedRenderWindow(publicAPI, model);
240-
publicAPI
241-
.getViewNodeFactory()
242-
.registerOverride('vtkRenderer', vtkSharedRenderer.newInstance);
243245
}
244246

245247
export const newInstance = macro.newInstance(extend, 'vtkSharedRenderWindow');

Sources/Rendering/OpenGL/ViewNodeFactory/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export function registerOverride(className, fn) {
1414
function vtkOpenGLViewNodeFactory(publicAPI, model) {
1515
// Set our className
1616
model.classHierarchy.push('vtkOpenGLViewNodeFactory');
17+
18+
publicAPI.registerOverride = (className, fn) => {
19+
model.overrides[className] = fn;
20+
};
1721
}
1822

1923
// ----------------------------------------------------------------------------
@@ -34,10 +38,6 @@ export function extend(publicAPI, model, initialValues = {}) {
3438
// Inheritance
3539
vtkViewNodeFactory.extend(publicAPI, model, initialValues);
3640

37-
publicAPI.registerOverride = (className, fn) => {
38-
model.overrides[className] = fn;
39-
};
40-
4141
// Object methods
4242
vtkOpenGLViewNodeFactory(publicAPI, model);
4343
}

0 commit comments

Comments
 (0)