fix(hp): Fails to display any layouts in the layout selector if first layout has multiple stages (#4058)

This commit is contained in:
Bill Wallace 2024-04-22 09:53:10 -04:00 committed by GitHub
parent 65d419dd52
commit f0ed3fd7b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 18 deletions

View File

@ -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() {

View File

@ -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];