diff --git a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts index 52cb1e0ed..fd85749ac 100644 --- a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts +++ b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts @@ -1064,6 +1064,11 @@ export default class HangingProtocolService extends PubSubService { throw new Error(`Can't find applicable stage ${protocol.id} ${options?.stageIndex}`); } this.stageIndex = stage as number; + + if (this.protocol?.callbacks?.onStageChange) { + this._commandsManager.run(this.protocol.callbacks.onStageChange); + } + this._updateViewports(options); } catch (error) { console.log(error); diff --git a/platform/core/src/types/HangingProtocol.ts b/platform/core/src/types/HangingProtocol.ts index b20ecfad3..189fe0dcc 100644 --- a/platform/core/src/types/HangingProtocol.ts +++ b/platform/core/src/types/HangingProtocol.ts @@ -293,6 +293,8 @@ export type ProtocolNotifications = { // and all viewport data includes a designated display set. This command // will run on every stage's initial layout. onViewportDataInitialized?: Command[]; + // This set of commands is executed before the stage change is applied + onStageChange?: Command[]; }; /**