fix(hp): Make the updated hanging protocol compatible with modes (#2971)

There had been a change made to make the hanging protocols
auto initialize, but that caused problems on mode init
because the couldn't specify the hanging protocols any longer.
THis change restores that, and also improves the API a little
bit by allowing the display set selectors to be specified by id
instead of positionally.

fix(hp):PR Review Comments

fix(hp):Unit test and docs
This commit is contained in:
Bill Wallace authored and GitHub committed 2022-10-05 08:32:54 -04:00
1 parent 1bcc9ccd89
commit e401358887
16 files changed
+228 -209

No files matched your search

+9 -1
View File
@@ -114,7 +114,10 @@ export default function ModeRoute({
locationRef.current = location;
}
const { DisplaySetService } = servicesManager.services;
const {
DisplaySetService,
HangingProtocolService: hangingProtocolService,
} = servicesManager.services;
const { extensions, sopClassHandlers, hotkeys, hangingProtocol } = mode;
@@ -241,8 +244,13 @@ export default function ModeRoute({
extensionManager,
commandsManager,
});
// Sets the active hanging protocols - if hangingProtocol is undefined,
// resets to default. Done before the onModeEnter to allow the onModeEnter
// to perform custom hanging protocol actions
hangingProtocolService.setActiveProtocols(hangingProtocol);
mode?.onModeEnter({ servicesManager, extensionManager, commandsManager });
const setupRouteInit = async () => {
if (route.init) {
return await route.init(