Skip to content

Commit

Permalink
Merge pull request #1590 from floryst/fix-1381
Browse files Browse the repository at this point in the history
fix(OrientationMarkerWidget): Update viewport on modified
  • Loading branch information
floryst committed Sep 25, 2020
2 parents 8f7a463 + 873ec8a commit 44e75d9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Sources/Interaction/Widgets/OrientationMarkerWidget/index.js
Expand Up @@ -13,12 +13,15 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkOrientationMarkerWidget');

const superClass = { ...publicAPI };

// Private variables

const previousCameraInput = [];
const selfRenderer = vtkRenderer.newInstance();
let interactorUnsubscribe = null;
let viewUnsubscribe = null;
let selfSubscription = null;

publicAPI.computeViewport = () => {
const [viewXSize, viewYSize] = model.interactor.getView().getSize();
Expand Down Expand Up @@ -202,6 +205,27 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
};

publicAPI.getRenderer = () => selfRenderer;

publicAPI.delete = () => {
superClass.delete();
if (selfSubscription) {
selfSubscription.unsubscribe();
selfSubscription = null;
}
if (interactorUnsubscribe) {
interactorUnsubscribe();
interactorUnsubscribe = null;
}
if (viewUnsubscribe) {
viewUnsubscribe();
viewUnsubscribe = null;
}
};

// --------------------------------------------------------------------------

// update viewport whenever we are updated
selfSubscription = publicAPI.onModified(publicAPI.updateViewport);
}

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit 44e75d9

Please sign in to comment.