Skip to content

Commit

Permalink
fix(CanvasView): allow setting canvas element
Browse files Browse the repository at this point in the history
  • Loading branch information
daker committed Dec 25, 2024
1 parent 89758ed commit f87c27f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Sources/Rendering/Misc/CanvasView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Create internal instances
model.canvas = document.createElement('canvas');
model.canvas.style.width = '100%';
if (!model.canvas) {
model.canvas = document.createElement('canvas');
model.canvas.style.width = '100%';
}

// Create internal bgImage
model.bgImage = new Image();
Expand Down
4 changes: 3 additions & 1 deletion Sources/Rendering/Misc/RemoteView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function vtkRemoteView(publicAPI, model) {
model.classHierarchy.push('vtkRemoteView');

// Constructor
model.canvasView = vtkCanvasView.newInstance();
model.canvasView = vtkCanvasView.newInstance({
canvas: model.canvasElement,
});
model.interactorStyle = vtkInteractorStyleRemoteMouse.newInstance();

model.interactor = vtkRenderWindowInteractor.newInstance();
Expand Down

0 comments on commit f87c27f

Please sign in to comment.