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() { private performResize() {
const isImmediate = false; const isImmediate = false;
const viewports = this.getRenderingEngine().getViewports(); try {
const viewports = this.getRenderingEngine().getViewports();
// Store the current position presentations for each viewport. // Store the current position presentations for each viewport.
viewports.forEach(({ id }) => { viewports.forEach(({ id }) => {
const presentation = this.getPositionPresentation(id); const presentation = this.getPositionPresentation(id);
this.beforeResizePositionPresentations.set(id, presentation); this.beforeResizePositionPresentations.set(id, presentation);
}); });
// Resize the rendering engine and render. // Resize the rendering engine and render.
const renderingEngine = this.renderingEngine; const renderingEngine = this.renderingEngine;
renderingEngine.resize(isImmediate); renderingEngine.resize(isImmediate);
renderingEngine.render(); renderingEngine.render();
// Reset the camera for viewports that should reset their camera on resize, // Reset the camera for viewports that should reset their camera on resize,
// which means only those viewports that have a zoom level of 1. // which means only those viewports that have a zoom level of 1.
this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => { this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => {
this.setPresentations(viewportId, { positionPresentation }); this.setPresentations(viewportId, { positionPresentation });
}); });
// Resize and render the rendering engine again. // Resize and render the rendering engine again.
renderingEngine.resize(isImmediate); renderingEngine.resize(isImmediate);
renderingEngine.render(); 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() { private resetGridResizeTimeout() {

View File

@ -1107,6 +1107,7 @@ export default class HangingProtocolService extends PubSubService {
if (this.protocol.id !== protocolId) { if (this.protocol.id !== protocolId) {
console.warn('setting protocol'); console.warn('setting protocol');
this.protocol = this.getProtocolById(protocolId); this.protocol = this.getProtocolById(protocolId);
this.stageIndex = 0;
} }
const protocol = this.protocol; const protocol = this.protocol;
const stage = protocol.stages[stageIdx]; const stage = protocol.stages[stageIdx];