@cornerstonejs/core 1.70.10 → 1.70.12
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/cjs/init.js +19 -23
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/webWorkerManager/webWorkerManager.js +5 -0
- package/dist/cjs/webWorkerManager/webWorkerManager.js.map +1 -1
- package/dist/esm/init.js +19 -23
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/webWorkerManager/webWorkerManager.js +5 -0
- package/dist/esm/webWorkerManager/webWorkerManager.js.map +1 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/webWorkerManager/webWorkerManager.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/init.ts +22 -30
- package/src/webWorkerManager/webWorkerManager.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.70.
|
|
3
|
+
"version": "1.70.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "bc9005d6ce0c473de4fc4189c7aa2813658421a3"
|
|
51
51
|
}
|
package/src/init.ts
CHANGED
|
@@ -95,15 +95,16 @@ function _hasNorm16TextureSupport() {
|
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
function isIOS() {
|
|
99
|
+
if (/iPad|iPhone|iPod/.test(navigator.platform)) {
|
|
100
|
+
return true;
|
|
101
|
+
} else {
|
|
102
|
+
return (
|
|
103
|
+
navigator.maxTouchPoints &&
|
|
104
|
+
navigator.maxTouchPoints > 2 &&
|
|
105
|
+
/MacIntel/.test(navigator.platform)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
/**
|
|
@@ -123,22 +124,18 @@ async function init(configuration = config): Promise<boolean> {
|
|
|
123
124
|
// merge configs
|
|
124
125
|
config = deepMerge(defaultConfig, configuration);
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (config.isMobile) {
|
|
127
|
+
if (isIOS()) {
|
|
129
128
|
// iOS devices don't have support for OES_texture_float_linear
|
|
130
129
|
// and thus we should use native data type if we are on iOS
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
141
|
-
}
|
|
130
|
+
config.rendering.useNorm16Texture = _hasNorm16TextureSupport();
|
|
131
|
+
|
|
132
|
+
if (!config.rendering.useNorm16Texture) {
|
|
133
|
+
if (configuration.rendering?.preferSizeOverAccuracy) {
|
|
134
|
+
config.rendering.preferSizeOverAccuracy = true;
|
|
135
|
+
} else {
|
|
136
|
+
console.log(
|
|
137
|
+
'norm16 texture not supported, you can turn on the preferSizeOverAccuracy flag to use native data type, but be aware of the inaccuracy of the rendering in high bits'
|
|
138
|
+
);
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
}
|
|
@@ -201,16 +198,11 @@ function setPreferSizeOverAccuracy(status: boolean): void {
|
|
|
201
198
|
* So we should not use float textures on IOS devices.
|
|
202
199
|
*/
|
|
203
200
|
function canRenderFloatTextures(): boolean {
|
|
204
|
-
|
|
205
|
-
if (!isMobile) {
|
|
201
|
+
if (!isIOS()) {
|
|
206
202
|
return true;
|
|
207
203
|
}
|
|
208
204
|
|
|
209
|
-
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return true;
|
|
205
|
+
return false;
|
|
214
206
|
}
|
|
215
207
|
|
|
216
208
|
/**
|
|
@@ -155,8 +155,11 @@ class CentralizedWorkerManager {
|
|
|
155
155
|
}
|
|
156
156
|
const workerProperties = this.workerRegistry[workerName];
|
|
157
157
|
|
|
158
|
+
workerProperties.processing = true;
|
|
159
|
+
|
|
158
160
|
const results = await api[methodName](args, ...finalCallbacks);
|
|
159
161
|
|
|
162
|
+
workerProperties.processing = false;
|
|
160
163
|
workerProperties.lastActiveTime[index] = Date.now();
|
|
161
164
|
|
|
162
165
|
// If auto termination is enabled and the interval is not set, set it.
|
|
@@ -201,6 +204,11 @@ class CentralizedWorkerManager {
|
|
|
201
204
|
|
|
202
205
|
terminateIdleWorkers(workerName, idleTimeThreshold) {
|
|
203
206
|
const workerProperties = this.workerRegistry[workerName];
|
|
207
|
+
|
|
208
|
+
if (workerProperties.processing) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
204
212
|
const now = Date.now();
|
|
205
213
|
|
|
206
214
|
workerProperties.instances.forEach((_, index) => {
|