@cornerstonejs/core 5.6.7 → 5.6.9

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.
@@ -30,6 +30,7 @@ export declare class HistoryMemo {
30
30
  endGroupRecording(): void;
31
31
  private pushGrouped;
32
32
  push(item: Memo | Memoable): Memo;
33
+ replaceCurrentMemo(item: Memo | Memoable, condition: (memo: Memo) => boolean): boolean;
33
34
  }
34
35
  declare const DefaultHistoryMemo: HistoryMemo;
35
36
  export { DefaultHistoryMemo };
@@ -130,6 +130,30 @@ export class HistoryMemo {
130
130
  this.ring[this.position] = memo;
131
131
  return memo;
132
132
  }
133
+ replaceCurrentMemo(item, condition) {
134
+ if (!item || this.undoAvailable === 0) {
135
+ return false;
136
+ }
137
+ const currentItem = this.ring[this.position];
138
+ const currentMemos = asArray(currentItem);
139
+ const memoIndex = currentMemos.findIndex(condition);
140
+ if (memoIndex === -1) {
141
+ return false;
142
+ }
143
+ const memo = item.restoreMemo
144
+ ? item
145
+ : item.createMemo?.();
146
+ if (!memo) {
147
+ return false;
148
+ }
149
+ if (Array.isArray(currentItem)) {
150
+ currentItem[memoIndex] = memo;
151
+ }
152
+ else {
153
+ this.ring[this.position] = memo;
154
+ }
155
+ return true;
156
+ }
133
157
  }
134
158
  const DefaultHistoryMemo = new HistoryMemo();
135
159
  export { DefaultHistoryMemo };
@@ -1 +1 @@
1
- export declare const version = "5.6.7";
1
+ export declare const version = "5.6.9";
@@ -1 +1 @@
1
- export const version = '5.6.7';
1
+ export const version = '5.6.9';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "5.6.7",
3
+ "version": "5.6.9",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -85,18 +85,18 @@
85
85
  "prepublishOnly": "pnpm run build"
86
86
  },
87
87
  "dependencies": {
88
- "@cornerstonejs/utils": "5.6.7",
88
+ "@cornerstonejs/utils": "5.6.9",
89
89
  "@kitware/vtk.js": "36.4.1",
90
90
  "comlink": "4.4.2",
91
91
  "gl-matrix": "3.4.3",
92
92
  "loglevel": "1.9.2"
93
93
  },
94
94
  "devDependencies": {
95
- "@cornerstonejs/metadata": "5.6.7"
95
+ "@cornerstonejs/metadata": "5.6.9"
96
96
  },
97
97
  "peerDependencies": {
98
- "@cornerstonejs/metadata": "5.6.7",
99
- "@cornerstonejs/utils": "5.6.7"
98
+ "@cornerstonejs/metadata": "5.6.9",
99
+ "@cornerstonejs/utils": "5.6.9"
100
100
  },
101
101
  "contributors": [
102
102
  {
@@ -109,5 +109,5 @@
109
109
  "type": "individual",
110
110
  "url": "https://ohif.org/donate"
111
111
  },
112
- "gitHead": "bee51c33d95c44284da74cd5cb1444d7a5d45e25"
112
+ "gitHead": "0b601d857e49de1a329d99f2ebdd7d7bf91cc312"
113
113
  }