feat: Add inherit from basic/longitudinal modes (#5435)
Co-authored-by: Ibrahim <ibrahim.mdev@gmail.com>
This commit is contained in:
1 parent
71d21ee184
commit
9ad0d7fc8c
28 files changed
+1153
-743
No files matched your search
@@ -63,6 +63,8 @@ export default class ToolbarService extends PubSubService {
|
||||
},
|
||||
};
|
||||
|
||||
public static TOOLBAR_SECTIONS = TOOLBAR_SECTIONS;
|
||||
|
||||
/**
|
||||
* Access to predefined toolbar sections for autocomplete support
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,7 @@ import * as MeasurementFilters from './measurementFilters';
|
||||
import getClosestOrientationFromIOP from './getClosestOrientationFromIOP';
|
||||
import calculateScanAxisNormal from './calculateScanAxisNormal';
|
||||
import areAllImageOrientationsEqual from './areAllImageOrientationsEqual';
|
||||
import { structuredCloneWithFunctions } from './structuredCloneWithFunctions';
|
||||
// Commented out unused functionality.
|
||||
// Need to implement new mechanism for derived displaySets using the displaySetManager.
|
||||
|
||||
@@ -71,6 +72,7 @@ const utils = {
|
||||
//loadAndCacheDerivedDisplaySets,
|
||||
makeDeferred,
|
||||
makeCancelable,
|
||||
structuredCloneWithFunctions,
|
||||
hotkeys,
|
||||
Queue,
|
||||
isDicomUid,
|
||||
@@ -109,6 +111,7 @@ export {
|
||||
//loadAndCacheDerivedDisplaySets,
|
||||
makeDeferred,
|
||||
makeCancelable,
|
||||
structuredCloneWithFunctions,
|
||||
hotkeys,
|
||||
Queue,
|
||||
isDicomUid,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Clones the object, incorporating functions as functions in the result.
|
||||
*/
|
||||
export function structuredCloneWithFunctions(obj, seen = new WeakMap()) {
|
||||
// Handle null, primitives, and functions
|
||||
if (obj === null || typeof obj !== 'object') {
|
||||
return obj;
|
||||
}
|
||||
if (typeof obj === 'function') {
|
||||
return obj; // copy function by reference
|
||||
}
|
||||
|
||||
// Handle circular references
|
||||
if (seen.has(obj)) {
|
||||
return seen.get(obj);
|
||||
}
|
||||
|
||||
// Handle Date
|
||||
if (obj instanceof Date) {
|
||||
return new Date(obj.getTime());
|
||||
}
|
||||
|
||||
// Handle Array
|
||||
if (Array.isArray(obj)) {
|
||||
const arrCopy = [];
|
||||
seen.set(obj, arrCopy);
|
||||
for (const item of obj) {
|
||||
arrCopy.push(structuredCloneWithFunctions(item, seen));
|
||||
}
|
||||
return arrCopy;
|
||||
}
|
||||
|
||||
// Handle Object
|
||||
const copy = {};
|
||||
seen.set(obj, copy);
|
||||
for (const key of Object.keys(obj)) {
|
||||
copy[key] = structuredCloneWithFunctions(obj[key], seen);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
Reference in new issue
Block a user