@cornerstonejs/core 1.70.10 → 1.70.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.70.10",
3
+ "version": "1.70.11",
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": "65604450273a4e7eee6203a83863e2b9674c4263"
50
+ "gitHead": "134a4a19a878fc7d0615403046bc74ed8564ada0"
51
51
  }
package/src/init.ts CHANGED
@@ -95,15 +95,16 @@ function _hasNorm16TextureSupport() {
95
95
  return false;
96
96
  }
97
97
 
98
- function isMobile() {
99
- const ua = navigator.userAgent;
100
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
101
- ua
102
- );
103
- }
104
-
105
- function isMobileIOS() {
106
- return /iPhone|iPod/.test(navigator.platform);
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
- config.isMobile = isMobile();
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
- if (isMobileIOS()) {
132
- config.rendering.useNorm16Texture = _hasNorm16TextureSupport();
133
-
134
- if (!config.rendering.useNorm16Texture) {
135
- if (configuration.rendering?.preferSizeOverAccuracy) {
136
- config.rendering.preferSizeOverAccuracy = true;
137
- } else {
138
- console.log(
139
- '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'
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
- const isMobile = config.isMobile;
205
- if (!isMobile) {
201
+ if (!isIOS()) {
206
202
  return true;
207
203
  }
208
204
 
209
- if (isMobileIOS()) {
210
- return false;
211
- }
212
-
213
- return true;
205
+ return false;
214
206
  }
215
207
 
216
208
  /**