Skip to content

Commit

Permalink
fix(OrientationMarkerWidget): Update viewport on modified
Browse files Browse the repository at this point in the history
Previously, the viewport was not being re-computed when min/max sizes
were set.
  • Loading branch information
floryst committed Sep 25, 2020
1 parent 8f7a463 commit 873ec8a
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 873ec8a

Please sign in to comment.