@ohif/app 3.13.0-beta.66 → 3.13.0-beta.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2851.bundle.8757dd07775645121b52.js → 2851.bundle.daa0f5f8bca6492d7033.js} +83 -7
- package/dist/{5485.bundle.adc11bc68e91358ea7bf.js → 5485.bundle.2149d00e98cfcecb114b.js} +10 -4
- package/dist/{7166.bundle.12ada8e535973df9c8fd.js → 7166.bundle.04b935471132c7d203f2.js} +160 -25
- package/dist/{9927.bundle.c2acd65fc6ae5ee07148.js → 9927.bundle.e4186f993674729cef10.js} +4 -0
- package/dist/app.bundle.css +1 -1
- package/dist/{app.bundle.7dbea386d6c9c10848ea.js → app.bundle.f03d71919b8eff3b1f22.js} +57 -4
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +20 -20
- /package/dist/{1459.bundle.97fb6947a59096bd69ba.js → 1459.bundle.a159e0dd401123bf9e48.js} +0 -0
- /package/dist/{1933.bundle.d265a398d717d9a65980.js → 1933.bundle.110d30b6901499a2103d.js} +0 -0
- /package/dist/{2018.bundle.75d45a73f6d29f4502eb.js → 2018.bundle.55568a2358323282a1d8.js} +0 -0
- /package/dist/{213.bundle.ec5f15baa925dfbfa439.js → 213.bundle.364a8317839173e8ea12.js} +0 -0
- /package/dist/{2424.bundle.b79e5c986efb65d01a14.js → 2424.bundle.ad9d0bbeb7723bf434dd.js} +0 -0
- /package/dist/{3138.bundle.45d9fe9f3ec46eabf6e6.js → 3138.bundle.1b2ed03742a5cf16d22b.js} +0 -0
- /package/dist/{3461.bundle.2524724cb7e8b1a20592.js → 3461.bundle.f499a235aa460895003e.js} +0 -0
- /package/dist/{4507.bundle.8ffd9859aca01712144c.js → 4507.bundle.2534b564fe3f0ce90801.js} +0 -0
- /package/dist/{4819.bundle.276d17abd4bb0504612a.js → 4819.bundle.11a2ec62c5d49262edf1.js} +0 -0
- /package/dist/{5015.bundle.23373b09d96bd5fccf83.js → 5015.bundle.6dc4e690443e7d5215f6.js} +0 -0
- /package/dist/{5028.bundle.00c40ff6fea856c6f090.js → 5028.bundle.723ddddb2203c1c0d2e7.js} +0 -0
- /package/dist/{5457.bundle.1bebe4c433dd5945aa2b.js → 5457.bundle.180ec36f95f7dfbdb63c.js} +0 -0
- /package/dist/{6027.bundle.01b5aca8656c7120845c.js → 6027.bundle.ad09ef0a6ab5ab0100ad.js} +0 -0
- /package/dist/{7639.bundle.b3db519e0e73c1efc492.js → 7639.bundle.29a1a0e1df7929296a3e.js} +0 -0
- /package/dist/{8305.bundle.76beb137050442689584.js → 8305.bundle.63b6a800160f4da7c372.js} +0 -0
- /package/dist/{8499.bundle.00368cb353ec9096ba82.js → 8499.bundle.b9cee1e292a04237794a.js} +0 -0
- /package/dist/{85.bundle.bb782db282876c8b886d.js → 85.bundle.856bfa0f56bba25ff5fb.js} +0 -0
- /package/dist/{8558.bundle.20a44fd8d2aa42371d80.js → 8558.bundle.685196a726b715d41ff0.js} +0 -0
- /package/dist/{8583.bundle.4d01961aa80e4ca39ea9.js → 8583.bundle.a7afd7affafa244e55e7.js} +0 -0
|
@@ -10612,8 +10612,8 @@ function AboutModalDefault() {
|
|
|
10612
10612
|
name
|
|
10613
10613
|
} = (0,browser_detect_es5/* default */.A)();
|
|
10614
10614
|
const browser = `${name[0].toUpperCase()}${name.substr(1)} ${version}`;
|
|
10615
|
-
const versionNumber = "3.13.0-beta.
|
|
10616
|
-
const commitHash = "
|
|
10615
|
+
const versionNumber = "3.13.0-beta.67";
|
|
10616
|
+
const commitHash = "691e26731f4f3b3957fe81fc051b09c972696cf6";
|
|
10617
10617
|
const [main, beta] = versionNumber.split('-');
|
|
10618
10618
|
return /*#__PURE__*/react.createElement(ui_next_src/* AboutModal */.VTU, {
|
|
10619
10619
|
className: "w-[400px]"
|
|
@@ -10644,16 +10644,49 @@ const {
|
|
|
10644
10644
|
defaultLanguage,
|
|
10645
10645
|
currentLanguage: currentLanguageFn
|
|
10646
10646
|
} = i18n_src/* default */.A;
|
|
10647
|
+
const MODIFIER_OPTIONS = [{
|
|
10648
|
+
value: '16',
|
|
10649
|
+
label: 'Shift'
|
|
10650
|
+
}, {
|
|
10651
|
+
value: '17',
|
|
10652
|
+
label: 'Ctrl'
|
|
10653
|
+
}, {
|
|
10654
|
+
value: '18',
|
|
10655
|
+
label: 'Alt'
|
|
10656
|
+
}, {
|
|
10657
|
+
value: '91',
|
|
10658
|
+
label: 'Meta'
|
|
10659
|
+
}];
|
|
10660
|
+
const DEFAULT_TOOL_BINDINGS_STORAGE_KEY = 'user-preferred-tool-bindings';
|
|
10661
|
+
function getToolBindingsStorageKey(customizationService) {
|
|
10662
|
+
const customizationValue = customizationService?.getCustomization('ohif.userPreferences.toolBindingsStorageKey');
|
|
10663
|
+
return typeof customizationValue === 'string' && customizationValue.length > 0 ? customizationValue : DEFAULT_TOOL_BINDINGS_STORAGE_KEY;
|
|
10664
|
+
}
|
|
10665
|
+
function getToolModifier(toolGroupService, toolGroupId, toolName) {
|
|
10666
|
+
if (!toolGroupService) {
|
|
10667
|
+
return null;
|
|
10668
|
+
}
|
|
10669
|
+
const bindings = toolGroupService.getToolBindings(toolGroupId, toolName);
|
|
10670
|
+
if (!bindings?.length) {
|
|
10671
|
+
return null;
|
|
10672
|
+
}
|
|
10673
|
+
const modifierBinding = bindings.find(binding => binding.modifierKey != null && binding.numTouchPoints == null);
|
|
10674
|
+
return modifierBinding?.modifierKey != null ? String(modifierBinding.modifierKey) : null;
|
|
10675
|
+
}
|
|
10647
10676
|
function UserPreferencesModalDefault({
|
|
10648
10677
|
hide
|
|
10649
10678
|
}) {
|
|
10650
10679
|
const {
|
|
10651
|
-
hotkeysManager
|
|
10680
|
+
hotkeysManager,
|
|
10681
|
+
servicesManager
|
|
10652
10682
|
} = (0,src/* useSystem */.Jg)();
|
|
10653
10683
|
const {
|
|
10654
10684
|
t,
|
|
10655
10685
|
i18n: i18nextInstance
|
|
10656
10686
|
} = (0,es/* useTranslation */.Bd)('UserPreferencesModal');
|
|
10687
|
+
const toolGroupService = servicesManager?.services?.toolGroupService;
|
|
10688
|
+
const customizationService = servicesManager?.services?.customizationService;
|
|
10689
|
+
const toolBindingsStorageKey = getToolBindingsStorageKey(customizationService);
|
|
10657
10690
|
const {
|
|
10658
10691
|
hotkeyDefinitions = {},
|
|
10659
10692
|
hotkeyDefaults = {}
|
|
@@ -10670,9 +10703,11 @@ function UserPreferencesModalDefault({
|
|
|
10670
10703
|
const resolvedHotkeyDefaults = Object.keys(hotkeyDefaults).length ? hotkeyDefaults : fallbackHotkeyDefinitions;
|
|
10671
10704
|
const initialHotkeyDefinitions = Object.keys(hotkeyDefinitions).length ? hotkeyDefinitions : resolvedHotkeyDefaults;
|
|
10672
10705
|
const currentLanguage = currentLanguageFn();
|
|
10706
|
+
const initialCrosshairModifier = (0,react.useMemo)(() => getToolModifier(toolGroupService, 'mpr', 'Crosshairs'), [toolGroupService]);
|
|
10673
10707
|
const [state, setState] = (0,react.useState)({
|
|
10674
10708
|
hotkeyDefinitions: initialHotkeyDefinitions,
|
|
10675
|
-
languageValue: currentLanguage.value
|
|
10709
|
+
languageValue: currentLanguage.value,
|
|
10710
|
+
crosshairModifier: initialCrosshairModifier
|
|
10676
10711
|
});
|
|
10677
10712
|
const onLanguageChangeHandler = value => {
|
|
10678
10713
|
setState(state => ({
|
|
@@ -10696,9 +10731,11 @@ function UserPreferencesModalDefault({
|
|
|
10696
10731
|
setState(state => ({
|
|
10697
10732
|
...state,
|
|
10698
10733
|
languageValue: defaultLanguage.value,
|
|
10699
|
-
hotkeyDefinitions: resolvedHotkeyDefaults
|
|
10734
|
+
hotkeyDefinitions: resolvedHotkeyDefaults,
|
|
10735
|
+
crosshairModifier: initialCrosshairModifier
|
|
10700
10736
|
}));
|
|
10701
10737
|
hotkeysManager.restoreDefaultBindings();
|
|
10738
|
+
localStorage.removeItem(toolBindingsStorageKey);
|
|
10702
10739
|
};
|
|
10703
10740
|
const displayNames = react.useMemo(() => {
|
|
10704
10741
|
if (typeof Intl === 'undefined' || typeof Intl.DisplayNames !== 'function') {
|
|
@@ -10755,7 +10792,32 @@ function UserPreferencesModalDefault({
|
|
|
10755
10792
|
onChange: newKeys => onHotkeyChangeHandler(id, newKeys),
|
|
10756
10793
|
placeholder: definition.keys,
|
|
10757
10794
|
hotkeys: src/* hotkeys */.ot
|
|
10758
|
-
})))
|
|
10795
|
+
}))), state.crosshairModifier != null && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(ui_next_src/* UserPreferencesModal */.xMy.SubHeading, null, t('ModifierKeys', {
|
|
10796
|
+
defaultValue: 'Modifier Keys'
|
|
10797
|
+
})), /*#__PURE__*/react.createElement(ui_next_src/* UserPreferencesModal */.xMy.HotkeysGrid, null, /*#__PURE__*/react.createElement("div", {
|
|
10798
|
+
className: "flex items-center justify-between gap-2"
|
|
10799
|
+
}, /*#__PURE__*/react.createElement("span", {
|
|
10800
|
+
className: "text-foreground text-base"
|
|
10801
|
+
}, t('CrosshairsModifier', {
|
|
10802
|
+
defaultValue: 'Crosshairs'
|
|
10803
|
+
})), /*#__PURE__*/react.createElement("div", {
|
|
10804
|
+
className: "flex items-center gap-1.5"
|
|
10805
|
+
}, /*#__PURE__*/react.createElement("span", {
|
|
10806
|
+
className: "text-muted-foreground text-sm"
|
|
10807
|
+
}, t('PlusLeftClick', {
|
|
10808
|
+
defaultValue: 'Left Click +'
|
|
10809
|
+
})), /*#__PURE__*/react.createElement(ui_next_src/* Select */.l6P, {
|
|
10810
|
+
value: state.crosshairModifier,
|
|
10811
|
+
onValueChange: val => setState(s => ({
|
|
10812
|
+
...s,
|
|
10813
|
+
crosshairModifier: val
|
|
10814
|
+
}))
|
|
10815
|
+
}, /*#__PURE__*/react.createElement(ui_next_src/* SelectTrigger */.bqE, {
|
|
10816
|
+
className: "w-16"
|
|
10817
|
+
}, /*#__PURE__*/react.createElement(ui_next_src/* SelectValue */.yvm, null)), /*#__PURE__*/react.createElement(ui_next_src/* SelectContent */.gCo, null, MODIFIER_OPTIONS.map(opt => /*#__PURE__*/react.createElement(ui_next_src/* SelectItem */.ebT, {
|
|
10818
|
+
key: opt.value,
|
|
10819
|
+
value: opt.value
|
|
10820
|
+
}, opt.label))))))))), /*#__PURE__*/react.createElement(ui_next_src/* FooterAction */.esu, null, /*#__PURE__*/react.createElement(ui_next_src/* FooterAction */.esu.Left, null, /*#__PURE__*/react.createElement(ui_next_src/* FooterAction */.esu.Auxiliary, {
|
|
10759
10821
|
onClick: onResetHandler
|
|
10760
10822
|
}, t('Reset to defaults'))), /*#__PURE__*/react.createElement(ui_next_src/* FooterAction */.esu.Right, null, /*#__PURE__*/react.createElement(ui_next_src/* FooterAction */.esu.Secondary, {
|
|
10761
10823
|
onClick: () => {
|
|
@@ -10772,6 +10834,19 @@ function UserPreferencesModalDefault({
|
|
|
10772
10834
|
return; // Exit early since we're reloading
|
|
10773
10835
|
}
|
|
10774
10836
|
hotkeysManager.setHotkeys(state.hotkeyDefinitions);
|
|
10837
|
+
if (toolGroupService && state.crosshairModifier != null) {
|
|
10838
|
+
const bindings = [{
|
|
10839
|
+
mouseButton: 1,
|
|
10840
|
+
modifierKey: Number(state.crosshairModifier)
|
|
10841
|
+
}];
|
|
10842
|
+
toolGroupService.setToolBindings('mpr', 'Crosshairs', bindings);
|
|
10843
|
+
toolGroupService.applyToolBindings('mpr', 'Crosshairs');
|
|
10844
|
+
localStorage.setItem(toolBindingsStorageKey, JSON.stringify({
|
|
10845
|
+
mpr: {
|
|
10846
|
+
Crosshairs: bindings
|
|
10847
|
+
}
|
|
10848
|
+
}));
|
|
10849
|
+
}
|
|
10775
10850
|
src/* hotkeys */.ot.stopRecord();
|
|
10776
10851
|
src/* hotkeys */.ot.unpause();
|
|
10777
10852
|
hide();
|
|
@@ -10779,7 +10854,8 @@ function UserPreferencesModalDefault({
|
|
|
10779
10854
|
}, t('Save')))));
|
|
10780
10855
|
}
|
|
10781
10856
|
/* harmony default export */ const userPreferencesCustomization = ({
|
|
10782
|
-
'ohif.userPreferencesModal': UserPreferencesModalDefault
|
|
10857
|
+
'ohif.userPreferencesModal': UserPreferencesModalDefault,
|
|
10858
|
+
'ohif.userPreferences.toolBindingsStorageKey': DEFAULT_TOOL_BINDINGS_STORAGE_KEY
|
|
10783
10859
|
});
|
|
10784
10860
|
;// ../../../extensions/default/src/customizations/reportDialogCustomization.tsx
|
|
10785
10861
|
|
|
@@ -295,6 +295,10 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
|
|
295
295
|
}],
|
|
296
296
|
disabled: [{
|
|
297
297
|
toolName: toolNames.Crosshairs,
|
|
298
|
+
bindings: [{
|
|
299
|
+
mouseButton: Enums.MouseBindings.Primary,
|
|
300
|
+
modifierKey: Enums.KeyboardBindings.Shift
|
|
301
|
+
}],
|
|
298
302
|
configuration: {
|
|
299
303
|
viewportIndicators: true,
|
|
300
304
|
viewportIndicatorsConfig: {
|
|
@@ -302,7 +306,6 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
|
|
302
306
|
xOffset: 0.95,
|
|
303
307
|
yOffset: 0.05
|
|
304
308
|
},
|
|
305
|
-
disableOnPassive: true,
|
|
306
309
|
autoPan: {
|
|
307
310
|
enabled: false,
|
|
308
311
|
panSize: 10
|
|
@@ -921,15 +924,18 @@ const toolbarButtons = [
|
|
|
921
924
|
type: 'tool',
|
|
922
925
|
icon: 'tool-crosshair',
|
|
923
926
|
label: i18next/* default */.A.t('Buttons:Crosshairs'),
|
|
927
|
+
tooltip: i18next/* default */.A.t('Buttons:Click to toggle on or off'),
|
|
924
928
|
commands: {
|
|
925
|
-
commandName: '
|
|
929
|
+
commandName: 'toggleActiveDisabledToolbar',
|
|
926
930
|
commandOptions: {
|
|
927
931
|
toolGroupIds: ['mpr']
|
|
928
932
|
}
|
|
929
933
|
},
|
|
930
934
|
evaluate: {
|
|
931
|
-
name: 'evaluate.cornerstoneTool',
|
|
932
|
-
disabledText: i18next/* default */.A.t('Buttons:Select an MPR viewport to enable this tool')
|
|
935
|
+
name: 'evaluate.cornerstoneTool.toggleWithModifier',
|
|
936
|
+
disabledText: i18next/* default */.A.t('Buttons:Select an MPR viewport to enable this tool'),
|
|
937
|
+
toggledOnIcon: 'tool-crosshair-checked',
|
|
938
|
+
defaultIcon: 'tool-crosshair'
|
|
933
939
|
}
|
|
934
940
|
}
|
|
935
941
|
}, {
|
|
@@ -10577,7 +10577,14 @@ function commandsModule({
|
|
|
10577
10577
|
}
|
|
10578
10578
|
function _getActiveViewportToolGroupId() {
|
|
10579
10579
|
const viewport = _getActiveViewportEnabledElement();
|
|
10580
|
-
|
|
10580
|
+
const toolGroup = viewport && toolGroupService.getToolGroupForViewport(viewport.id);
|
|
10581
|
+
return toolGroup?.id;
|
|
10582
|
+
}
|
|
10583
|
+
function _usesPrimaryActivation(bindings) {
|
|
10584
|
+
if (!bindings?.length) {
|
|
10585
|
+
return true;
|
|
10586
|
+
}
|
|
10587
|
+
return bindings.some(binding => binding.mouseButton === dist_esm.Enums.MouseBindings.Primary && binding.modifierKey == null && binding.numTouchPoints == null);
|
|
10581
10588
|
}
|
|
10582
10589
|
function _getActiveSegmentationInfo() {
|
|
10583
10590
|
const viewportId = viewportGridService.getActiveViewportId();
|
|
@@ -11444,31 +11451,46 @@ function commandsModule({
|
|
|
11444
11451
|
toggleActiveDisabledToolbar({
|
|
11445
11452
|
value,
|
|
11446
11453
|
itemId,
|
|
11447
|
-
toolGroupId
|
|
11454
|
+
toolGroupId,
|
|
11455
|
+
toolGroupIds
|
|
11448
11456
|
}) {
|
|
11449
11457
|
const toolName = itemId || value;
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11458
|
+
const resolvedToolGroupIds = toolGroupIds?.length ? toolGroupIds : [toolGroupId ?? _getActiveViewportToolGroupId()];
|
|
11459
|
+
resolvedToolGroupIds.forEach(toolGroupId => {
|
|
11460
|
+
const toolGroup = toolGroupService.getToolGroup(toolGroupId);
|
|
11461
|
+
if (!toolGroup || !toolGroup.hasTool(toolName)) {
|
|
11462
|
+
return;
|
|
11463
|
+
}
|
|
11464
|
+
const toolIsActive = [dist_esm.Enums.ToolModes.Active, dist_esm.Enums.ToolModes.Enabled, dist_esm.Enums.ToolModes.Passive].includes(toolGroup.getToolOptions(toolName).mode);
|
|
11465
|
+
if (toolIsActive) {
|
|
11466
|
+
toolGroup.setToolDisabled(toolName);
|
|
11467
|
+
const bindings = toolGroupService.getToolBindings(toolGroupId, toolName);
|
|
11468
|
+
if (_usesPrimaryActivation(bindings)) {
|
|
11469
|
+
// we should set the previously active tool to active after we set the
|
|
11470
|
+
// current tool disabled
|
|
11471
|
+
const prevToolName = toolGroup.getPrevActivePrimaryToolName();
|
|
11472
|
+
if (prevToolName !== toolName) {
|
|
11473
|
+
actions.setToolActive({
|
|
11474
|
+
toolName: prevToolName,
|
|
11475
|
+
toolGroupId
|
|
11476
|
+
});
|
|
11477
|
+
}
|
|
11478
|
+
}
|
|
11479
|
+
return;
|
|
11480
|
+
}
|
|
11481
|
+
const bindings = toolGroupService.getToolBindings(toolGroupId, toolName);
|
|
11482
|
+
if (_usesPrimaryActivation(bindings)) {
|
|
11466
11483
|
actions.setToolActive({
|
|
11467
|
-
toolName
|
|
11468
|
-
toolGroupId
|
|
11484
|
+
toolName,
|
|
11485
|
+
toolGroupId,
|
|
11486
|
+
bindings
|
|
11487
|
+
});
|
|
11488
|
+
} else {
|
|
11489
|
+
toolGroup.setToolActive(toolName, {
|
|
11490
|
+
bindings
|
|
11469
11491
|
});
|
|
11470
11492
|
}
|
|
11471
|
-
}
|
|
11493
|
+
});
|
|
11472
11494
|
},
|
|
11473
11495
|
setToolActiveToolbar: ({
|
|
11474
11496
|
value,
|
|
@@ -18475,6 +18497,36 @@ function getToolbarModule({
|
|
|
18475
18497
|
isActive: isPrimaryActive
|
|
18476
18498
|
};
|
|
18477
18499
|
}
|
|
18500
|
+
}, {
|
|
18501
|
+
name: 'evaluate.cornerstoneTool.toggleWithModifier',
|
|
18502
|
+
evaluate: ({
|
|
18503
|
+
viewportId,
|
|
18504
|
+
button,
|
|
18505
|
+
disabledText,
|
|
18506
|
+
toggledOnIcon,
|
|
18507
|
+
defaultIcon
|
|
18508
|
+
}) => {
|
|
18509
|
+
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
|
18510
|
+
if (!toolGroup) {
|
|
18511
|
+
return;
|
|
18512
|
+
}
|
|
18513
|
+
const toolName = toolbarService.getToolNameForButton(button);
|
|
18514
|
+
if (!toolGroup.hasTool(toolName)) {
|
|
18515
|
+
return getDisabledState(disabledText);
|
|
18516
|
+
}
|
|
18517
|
+
const {
|
|
18518
|
+
mode
|
|
18519
|
+
} = toolGroup.getToolOptions(toolName) ?? {};
|
|
18520
|
+
const isToggled = mode === dist_esm.Enums.ToolModes.Passive || mode === dist_esm.Enums.ToolModes.Active || mode === dist_esm.Enums.ToolModes.Enabled;
|
|
18521
|
+
const toolBindings = toolGroupService.getToolBindings(toolGroup.id, toolName);
|
|
18522
|
+
const hasModifierKey = toolBindings?.some(binding => binding.modifierKey != null) ?? false;
|
|
18523
|
+
return {
|
|
18524
|
+
disabled: false,
|
|
18525
|
+
isActive: false,
|
|
18526
|
+
isToggled,
|
|
18527
|
+
icon: isToggled && hasModifierKey && toggledOnIcon ? toggledOnIcon : defaultIcon ?? button.props.icon
|
|
18528
|
+
};
|
|
18529
|
+
}
|
|
18478
18530
|
}, {
|
|
18479
18531
|
name: 'evaluate.action',
|
|
18480
18532
|
evaluate: () => {
|
|
@@ -18627,7 +18679,9 @@ class ToolGroupService {
|
|
|
18627
18679
|
this.cornerstoneViewportService = void 0;
|
|
18628
18680
|
this.viewportGridService = void 0;
|
|
18629
18681
|
this.uiNotificationService = void 0;
|
|
18682
|
+
this.customizationService = void 0;
|
|
18630
18683
|
this.toolGroupIds = new Set();
|
|
18684
|
+
this.toolBindingsMap = new Map();
|
|
18631
18685
|
/**
|
|
18632
18686
|
* Service-specific
|
|
18633
18687
|
*/
|
|
@@ -18653,11 +18707,13 @@ class ToolGroupService {
|
|
|
18653
18707
|
const {
|
|
18654
18708
|
cornerstoneViewportService,
|
|
18655
18709
|
viewportGridService,
|
|
18656
|
-
uiNotificationService
|
|
18710
|
+
uiNotificationService,
|
|
18711
|
+
customizationService
|
|
18657
18712
|
} = servicesManager.services;
|
|
18658
18713
|
this.cornerstoneViewportService = cornerstoneViewportService;
|
|
18659
18714
|
this.viewportGridService = viewportGridService;
|
|
18660
18715
|
this.uiNotificationService = uiNotificationService;
|
|
18716
|
+
this.customizationService = customizationService;
|
|
18661
18717
|
this.listeners = {};
|
|
18662
18718
|
this.EVENTS = ToolGroupService_EVENTS;
|
|
18663
18719
|
Object.assign(this, src/* pubSubServiceInterface */.Ml);
|
|
@@ -18715,6 +18771,7 @@ class ToolGroupService {
|
|
|
18715
18771
|
destroy() {
|
|
18716
18772
|
dist_esm.ToolGroupManager.destroy();
|
|
18717
18773
|
this.toolGroupIds = new Set();
|
|
18774
|
+
this.toolBindingsMap.clear();
|
|
18718
18775
|
esm.eventTarget.removeEventListener(dist_esm.Enums.Events.TOOL_ACTIVATED, this._onToolActivated);
|
|
18719
18776
|
}
|
|
18720
18777
|
destroyToolGroup(toolGroupId) {
|
|
@@ -18769,6 +18826,7 @@ class ToolGroupService {
|
|
|
18769
18826
|
// this.changeConfigurationIfNecessary(toolGroup, volumeId);
|
|
18770
18827
|
this._addTools(toolGroup, tools, configs);
|
|
18771
18828
|
this._setToolsMode(toolGroup, tools);
|
|
18829
|
+
this._loadPersistedBindings(toolGroupId);
|
|
18772
18830
|
}
|
|
18773
18831
|
createToolGroupAndAddTools(toolGroupId, tools) {
|
|
18774
18832
|
const toolGroup = this.createToolGroup(toolGroupId);
|
|
@@ -18808,6 +18866,46 @@ class ToolGroupService {
|
|
|
18808
18866
|
getActivePrimaryMouseButtonTool(toolGroupId) {
|
|
18809
18867
|
return this.getToolGroup(toolGroupId)?.getActivePrimaryMouseButtonTool();
|
|
18810
18868
|
}
|
|
18869
|
+
getToolBindings(toolGroupId, toolName) {
|
|
18870
|
+
return this.toolBindingsMap.get(toolGroupId)?.get(toolName);
|
|
18871
|
+
}
|
|
18872
|
+
setToolBindings(toolGroupId, toolName, bindings) {
|
|
18873
|
+
if (!this.toolBindingsMap.has(toolGroupId)) {
|
|
18874
|
+
this.toolBindingsMap.set(toolGroupId, new Map());
|
|
18875
|
+
}
|
|
18876
|
+
this.toolBindingsMap.get(toolGroupId).set(toolName, bindings);
|
|
18877
|
+
}
|
|
18878
|
+
applyToolBindings(toolGroupId, toolName) {
|
|
18879
|
+
const toolGroup = dist_esm.ToolGroupManager.getToolGroup(toolGroupId);
|
|
18880
|
+
if (!toolGroup || !toolGroup.hasTool(toolName)) {
|
|
18881
|
+
return;
|
|
18882
|
+
}
|
|
18883
|
+
const bindings = this.getToolBindings(toolGroupId, toolName);
|
|
18884
|
+
if (!bindings) {
|
|
18885
|
+
return;
|
|
18886
|
+
}
|
|
18887
|
+
const {
|
|
18888
|
+
mode
|
|
18889
|
+
} = toolGroup.getToolOptions(toolName);
|
|
18890
|
+
if (mode === dist_esm.Enums.ToolModes.Active || mode === dist_esm.Enums.ToolModes.Passive || mode === dist_esm.Enums.ToolModes.Enabled) {
|
|
18891
|
+
toolGroup.setToolActive(toolName, {
|
|
18892
|
+
bindings
|
|
18893
|
+
});
|
|
18894
|
+
}
|
|
18895
|
+
}
|
|
18896
|
+
getAllToolBindings() {
|
|
18897
|
+
const result = [];
|
|
18898
|
+
for (const [toolGroupId, toolMap] of this.toolBindingsMap) {
|
|
18899
|
+
for (const [toolName, bindings] of toolMap) {
|
|
18900
|
+
result.push({
|
|
18901
|
+
toolGroupId,
|
|
18902
|
+
toolName,
|
|
18903
|
+
bindings
|
|
18904
|
+
});
|
|
18905
|
+
}
|
|
18906
|
+
}
|
|
18907
|
+
return result;
|
|
18908
|
+
}
|
|
18811
18909
|
_setToolsMode(toolGroup, tools) {
|
|
18812
18910
|
const {
|
|
18813
18911
|
active,
|
|
@@ -18820,6 +18918,9 @@ class ToolGroupService {
|
|
|
18820
18918
|
toolName,
|
|
18821
18919
|
bindings
|
|
18822
18920
|
}) => {
|
|
18921
|
+
if (bindings) {
|
|
18922
|
+
this.setToolBindings(toolGroup.id, toolName, bindings);
|
|
18923
|
+
}
|
|
18823
18924
|
toolGroup.setToolActive(toolName, {
|
|
18824
18925
|
bindings
|
|
18825
18926
|
});
|
|
@@ -18827,22 +18928,34 @@ class ToolGroupService {
|
|
|
18827
18928
|
}
|
|
18828
18929
|
if (passive) {
|
|
18829
18930
|
passive.forEach(({
|
|
18830
|
-
toolName
|
|
18931
|
+
toolName,
|
|
18932
|
+
bindings
|
|
18831
18933
|
}) => {
|
|
18934
|
+
if (bindings) {
|
|
18935
|
+
this.setToolBindings(toolGroup.id, toolName, bindings);
|
|
18936
|
+
}
|
|
18832
18937
|
toolGroup.setToolPassive(toolName);
|
|
18833
18938
|
});
|
|
18834
18939
|
}
|
|
18835
18940
|
if (enabled) {
|
|
18836
18941
|
enabled.forEach(({
|
|
18837
|
-
toolName
|
|
18942
|
+
toolName,
|
|
18943
|
+
bindings
|
|
18838
18944
|
}) => {
|
|
18945
|
+
if (bindings) {
|
|
18946
|
+
this.setToolBindings(toolGroup.id, toolName, bindings);
|
|
18947
|
+
}
|
|
18839
18948
|
toolGroup.setToolEnabled(toolName);
|
|
18840
18949
|
});
|
|
18841
18950
|
}
|
|
18842
18951
|
if (disabled) {
|
|
18843
18952
|
disabled.forEach(({
|
|
18844
|
-
toolName
|
|
18953
|
+
toolName,
|
|
18954
|
+
bindings
|
|
18845
18955
|
}) => {
|
|
18956
|
+
if (bindings) {
|
|
18957
|
+
this.setToolBindings(toolGroup.id, toolName, bindings);
|
|
18958
|
+
}
|
|
18846
18959
|
toolGroup.setToolDisabled(toolName);
|
|
18847
18960
|
});
|
|
18848
18961
|
}
|
|
@@ -18878,6 +18991,28 @@ class ToolGroupService {
|
|
|
18878
18991
|
addTools(tools.disabled);
|
|
18879
18992
|
}
|
|
18880
18993
|
}
|
|
18994
|
+
_loadPersistedBindings(toolGroupId) {
|
|
18995
|
+
try {
|
|
18996
|
+
const stored = localStorage.getItem(this._getToolBindingsStorageKey());
|
|
18997
|
+
if (!stored) {
|
|
18998
|
+
return;
|
|
18999
|
+
}
|
|
19000
|
+
const parsed = JSON.parse(stored);
|
|
19001
|
+
const toolGroupBindings = parsed[toolGroupId];
|
|
19002
|
+
if (!toolGroupBindings) {
|
|
19003
|
+
return;
|
|
19004
|
+
}
|
|
19005
|
+
for (const [toolName, bindings] of Object.entries(toolGroupBindings)) {
|
|
19006
|
+
this.setToolBindings(toolGroupId, toolName, bindings);
|
|
19007
|
+
}
|
|
19008
|
+
} catch {
|
|
19009
|
+
// ignore corrupt localStorage
|
|
19010
|
+
}
|
|
19011
|
+
}
|
|
19012
|
+
_getToolBindingsStorageKey() {
|
|
19013
|
+
const customizationValue = this.customizationService?.getCustomization('ohif.userPreferences.toolBindingsStorageKey');
|
|
19014
|
+
return typeof customizationValue === 'string' && customizationValue.length > 0 ? customizationValue : 'user-preferred-tool-bindings';
|
|
19015
|
+
}
|
|
18881
19016
|
}
|
|
18882
19017
|
_ToolGroupService = ToolGroupService;
|
|
18883
19018
|
ToolGroupService.REGISTRATION = {
|
|
@@ -157,6 +157,10 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
|
|
157
157
|
enabled: [],
|
|
158
158
|
disabled: [{
|
|
159
159
|
toolName: toolNames.Crosshairs,
|
|
160
|
+
bindings: [{
|
|
161
|
+
mouseButton: Enums.MouseBindings.Primary,
|
|
162
|
+
modifierKey: Enums.KeyboardBindings.Shift
|
|
163
|
+
}],
|
|
160
164
|
configuration: {
|
|
161
165
|
disableOnPassive: true,
|
|
162
166
|
autoPan: {
|