|
@@ -10,6 +10,7 @@ import { PluginContext } from './context';
|
|
|
import { PdbDownloadProvider } from '../mol-plugin-state/actions/structure';
|
|
|
import { EmdbDownloadProvider } from '../mol-plugin-state/actions/volume';
|
|
|
import { StructureRepresentationPresetProvider } from '../mol-plugin-state/builder/structure/representation-preset';
|
|
|
+import { PluginFeatureDetection } from './features';
|
|
|
|
|
|
export class PluginConfigItem<T = any> {
|
|
|
toString() { return this.key; }
|
|
@@ -19,31 +20,6 @@ export class PluginConfigItem<T = any> {
|
|
|
|
|
|
function item<T>(key: string, defaultValue?: T) { return new PluginConfigItem(key, defaultValue); }
|
|
|
|
|
|
-
|
|
|
-export function preferWebGl1() {
|
|
|
- if (typeof navigator === 'undefined' || typeof window === 'undefined') return false;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- const unpportedSafariVersions = [
|
|
|
- 'Version/15.1 Safari',
|
|
|
- 'Version/15.2 Safari',
|
|
|
- 'Version/15.3 Safari'
|
|
|
- ];
|
|
|
- if (unpportedSafariVersions.some(v => navigator.userAgent.indexOf(v) > 0)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
|
- const isAppleDevice = navigator.userAgent.includes('Macintosh');
|
|
|
- const isTouchScreen = navigator.maxTouchPoints >= 4;
|
|
|
- return !(window as any).MSStream && (isIOS || (isAppleDevice && isTouchScreen));
|
|
|
-}
|
|
|
-
|
|
|
export const PluginConfig = {
|
|
|
item,
|
|
|
General: {
|
|
@@ -53,10 +29,10 @@ export const PluginConfig = {
|
|
|
PixelScale: item('plugin-config.pixel-scale', 1),
|
|
|
PickScale: item('plugin-config.pick-scale', 0.25),
|
|
|
PickPadding: item('plugin-config.pick-padding', 3),
|
|
|
- EnableWboit: item('plugin-config.enable-wboit', true),
|
|
|
+ EnableWboit: item('plugin-config.enable-wboit', PluginFeatureDetection.wboit),
|
|
|
|
|
|
|
|
|
- PreferWebGl1: item('plugin-config.prefer-webgl1', preferWebGl1()),
|
|
|
+ PreferWebGl1: item('plugin-config.prefer-webgl1', PluginFeatureDetection.preferWebGl1),
|
|
|
},
|
|
|
State: {
|
|
|
DefaultServer: item('plugin-state.server', 'https://webchem.ncbr.muni.cz/molstar-state'),
|