Skip to content

Commit

Permalink
fix(hp): Fails to display any layouts in the layout selector if first…
Browse files Browse the repository at this point in the history
… layout has multiple stages (#4058)
  • Loading branch information
wayfarer3130 authored Apr 22, 2024
1 parent 65d419d commit f0ed3fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1034,28 +1034,33 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
private performResize() {
const isImmediate = false;

const viewports = this.getRenderingEngine().getViewports();
try {
const viewports = this.getRenderingEngine().getViewports();

// Store the current position presentations for each viewport.
viewports.forEach(({ id }) => {
const presentation = this.getPositionPresentation(id);
this.beforeResizePositionPresentations.set(id, presentation);
});
// Store the current position presentations for each viewport.
viewports.forEach(({ id }) => {
const presentation = this.getPositionPresentation(id);
this.beforeResizePositionPresentations.set(id, presentation);
});

// Resize the rendering engine and render.
const renderingEngine = this.renderingEngine;
renderingEngine.resize(isImmediate);
renderingEngine.render();
// Resize the rendering engine and render.
const renderingEngine = this.renderingEngine;
renderingEngine.resize(isImmediate);
renderingEngine.render();

// Reset the camera for viewports that should reset their camera on resize,
// which means only those viewports that have a zoom level of 1.
this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => {
this.setPresentations(viewportId, { positionPresentation });
});
// Reset the camera for viewports that should reset their camera on resize,
// which means only those viewports that have a zoom level of 1.
this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => {
this.setPresentations(viewportId, { positionPresentation });
});

// Resize and render the rendering engine again.
renderingEngine.resize(isImmediate);
renderingEngine.render();
// Resize and render the rendering engine again.
renderingEngine.resize(isImmediate);
renderingEngine.render();
} catch (e) {
// This can happen if the resize is too close to navigation or shutdown
console.warn('Caught resize exception', e);
}
}

private resetGridResizeTimeout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ export default class HangingProtocolService extends PubSubService {
if (this.protocol.id !== protocolId) {
console.warn('setting protocol');
this.protocol = this.getProtocolById(protocolId);
this.stageIndex = 0;
}
const protocol = this.protocol;
const stage = protocol.stages[stageIdx];
Expand Down

0 comments on commit f0ed3fd

Please sign in to comment.