@opsydyn/effect-three-foldkit 0.4.0 → 1.0.0-next.0
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/CHANGELOG.md +39 -0
- package/README.md +29 -23
- package/dist/boxSelect.d.ts +91 -117
- package/dist/boxSelect.d.ts.map +1 -1
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +32 -0
- package/dist/browser.js.map +10 -0
- package/dist/element.d.ts +13 -869
- package/dist/element.d.ts.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -2383
- package/dist/index.js.map +14 -38
- package/dist/inspector.d.ts +4 -21
- package/dist/inspector.d.ts.map +1 -1
- package/dist/measuringTape.d.ts +39 -46
- package/dist/measuringTape.d.ts.map +1 -1
- package/dist/mount.d.ts +17 -11
- package/dist/mount.d.ts.map +1 -1
- package/dist/overlayView.d.ts +7 -18
- package/dist/overlayView.d.ts.map +1 -1
- package/dist/pivotControls.d.ts +64 -76
- package/dist/pivotControls.d.ts.map +1 -1
- package/dist/transformGizmo.d.ts +113 -125
- package/dist/transformGizmo.d.ts.map +1 -1
- package/dist/view.d.ts +37 -4
- package/dist/view.d.ts.map +1 -1
- package/dist/viewportGizmo.d.ts +107 -119
- package/dist/viewportGizmo.d.ts.map +1 -1
- package/package.json +15 -10
- package/src/boxSelect.ts +12 -133
- package/src/browser.ts +16 -0
- package/src/element.ts +19 -106
- package/src/index.ts +35 -16
- package/src/inspector.ts +70 -93
- package/src/measuringTape.ts +28 -92
- package/src/mount.ts +53 -286
- package/src/overlayView.ts +36 -57
- package/src/pivotControls.ts +8 -94
- package/src/transformGizmo.ts +8 -108
- package/src/view.ts +89 -51
- package/src/viewportGizmo.ts +8 -97
- package/dist/assets.d.ts +0 -53
- package/dist/assets.d.ts.map +0 -1
- package/dist/dom/animationFrames.d.ts +0 -12
- package/dist/dom/animationFrames.d.ts.map +0 -1
- package/dist/dom/canvas.d.ts +0 -26
- package/dist/dom/canvas.d.ts.map +0 -1
- package/dist/dom/latch.d.ts +0 -15
- package/dist/dom/latch.d.ts.map +0 -1
- package/dist/dom/models.d.ts +0 -10
- package/dist/dom/models.d.ts.map +0 -1
- package/dist/dom/overlays.d.ts +0 -24
- package/dist/dom/overlays.d.ts.map +0 -1
- package/dist/dom/pointer.d.ts +0 -49
- package/dist/dom/pointer.d.ts.map +0 -1
- package/dist/dom/postprocessing.d.ts +0 -22
- package/dist/dom/postprocessing.d.ts.map +0 -1
- package/dist/dom/property.d.ts +0 -15
- package/dist/dom/property.d.ts.map +0 -1
- package/dist/dom/reconciled.d.ts +0 -10
- package/dist/dom/reconciled.d.ts.map +0 -1
- package/dist/dom/renderSettings.d.ts +0 -58
- package/dist/dom/renderSettings.d.ts.map +0 -1
- package/dist/dom/typedScenes.d.ts +0 -14
- package/dist/dom/typedScenes.d.ts.map +0 -1
- package/dist/dom/updates.d.ts +0 -8
- package/dist/dom/updates.d.ts.map +0 -1
- package/dist/dom/viewport.d.ts +0 -40
- package/dist/dom/viewport.d.ts.map +0 -1
- package/dist/dom/webgl.d.ts +0 -12
- package/dist/dom/webgl.d.ts.map +0 -1
- package/dist/dom/webgpu.d.ts +0 -24
- package/dist/dom/webgpu.d.ts.map +0 -1
- package/dist/dom/webgpuPostprocessing.d.ts +0 -4
- package/dist/dom/webgpuPostprocessing.d.ts.map +0 -1
- package/dist/dom/xr.d.ts +0 -53
- package/dist/dom/xr.d.ts.map +0 -1
- package/dist/dom/xrGlide.d.ts +0 -49
- package/dist/dom/xrGlide.d.ts.map +0 -1
- package/dist/dom/xrHub.d.ts +0 -45
- package/dist/dom/xrHub.d.ts.map +0 -1
- package/dist/dom/xrInputs.d.ts +0 -40
- package/dist/dom/xrInputs.d.ts.map +0 -1
- package/dist/dom/xrSpaces.d.ts +0 -33
- package/dist/dom/xrSpaces.d.ts.map +0 -1
- package/dist/dom/xrTarget.d.ts +0 -36
- package/dist/dom/xrTarget.d.ts.map +0 -1
- package/dist/environment.d.ts +0 -64
- package/dist/environment.d.ts.map +0 -1
- package/dist/xr.d.ts +0 -34
- package/dist/xr.d.ts.map +0 -1
- package/src/assets.ts +0 -151
- package/src/dom/animationFrames.ts +0 -32
- package/src/dom/canvas.ts +0 -54
- package/src/dom/latch.ts +0 -36
- package/src/dom/models.ts +0 -37
- package/src/dom/overlays.ts +0 -63
- package/src/dom/pointer.ts +0 -163
- package/src/dom/postprocessing.ts +0 -116
- package/src/dom/property.ts +0 -43
- package/src/dom/reconciled.ts +0 -51
- package/src/dom/renderSettings.ts +0 -117
- package/src/dom/typedScenes.ts +0 -21
- package/src/dom/updates.ts +0 -14
- package/src/dom/viewport.ts +0 -97
- package/src/dom/webgl.ts +0 -231
- package/src/dom/webgpu.ts +0 -220
- package/src/dom/webgpuPostprocessing.ts +0 -102
- package/src/dom/xr.ts +0 -211
- package/src/dom/xrGlide.ts +0 -114
- package/src/dom/xrHub.ts +0 -118
- package/src/dom/xrInputs.ts +0 -309
- package/src/dom/xrSpaces.ts +0 -287
- package/src/dom/xrTarget.ts +0 -71
- package/src/environment.ts +0 -78
- package/src/xr.ts +0 -36
package/dist/environment.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* App-wide state shared by every scene element: one GPU resource store and one
|
|
3
|
-
* animation-frame scheduler. Create it once at the application entry point.
|
|
4
|
-
*
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
import { type Behaviour, type LabelEngine, type PhysicsEngine, type RendererFactory, type ResourceStore } from '@opsydyn/effect-three';
|
|
8
|
-
import { type AnimationFrameHost } from './dom/animationFrames.ts';
|
|
9
|
-
import { type PixelRatio } from './dom/viewport.ts';
|
|
10
|
-
/** The browser APIs the adapter uses; normally `window`. */
|
|
11
|
-
export type EnvironmentHost = AnimationFrameHost & Pick<Window, 'matchMedia' | 'devicePixelRatio'> & Partial<Pick<Window, 'navigator'>>;
|
|
12
|
-
export type EnvironmentOptions = {
|
|
13
|
-
/** Creates each scene's renderer from its canvas. Defaults to WebGL2. */
|
|
14
|
-
readonly renderer?: (canvas: HTMLCanvasElement) => RendererFactory;
|
|
15
|
-
/** Drawing-buffer pixel ratio: fixed, or `[min, max]` around the device's. Default `[1, 2]`. */
|
|
16
|
-
readonly pixelRatio?: PixelRatio;
|
|
17
|
-
/** Behaviours scenes may name with `behave(name)`, beside the built-in `float`. */
|
|
18
|
-
readonly behaviours?: Readonly<Record<string, Behaviour>>;
|
|
19
|
-
/**
|
|
20
|
-
* The physics engine for scenes with `physics`, or the promise of one: pass
|
|
21
|
-
* `loadRapier()` from `@opsydyn/effect-three-rapier` as it is, and scenes start once it
|
|
22
|
-
* has loaded. Without one, bodies stay where they are described.
|
|
23
|
-
*/
|
|
24
|
-
readonly physics?: PhysicsEngine | Promise<PhysicsEngine>;
|
|
25
|
-
/**
|
|
26
|
-
* Draws `label` nodes: pass `troikaLabels()` from `@opsydyn/effect-three-troika`.
|
|
27
|
-
* Without one, labels are empty.
|
|
28
|
-
*/
|
|
29
|
-
readonly labels?: LabelEngine;
|
|
30
|
-
};
|
|
31
|
-
/** Creates the shared environment for `host`. Call `dispose` when the app shuts down. */
|
|
32
|
-
export declare const makeEnvironment: (host: EnvironmentHost, options?: EnvironmentOptions) => {
|
|
33
|
-
host: EnvironmentHost;
|
|
34
|
-
store: ResourceStore;
|
|
35
|
-
frames: import("@opsydyn/effect-three").FrameScheduler;
|
|
36
|
-
renderer: (canvas: HTMLCanvasElement) => RendererFactory;
|
|
37
|
-
pixelRatio: PixelRatio;
|
|
38
|
-
behaviours: Readonly<Record<string, Behaviour>>;
|
|
39
|
-
/** The physics engine, once loaded; `undefined` when there is none. */
|
|
40
|
-
physics: Promise<PhysicsEngine | undefined>;
|
|
41
|
-
/** The label engine; `undefined` when there is none. */
|
|
42
|
-
labels: LabelEngine | undefined;
|
|
43
|
-
/** Loads textures and glTF models by URL and lends them to the store. */
|
|
44
|
-
assets: {
|
|
45
|
-
loadTexture: (id: string, url: string) => import("effect/Effect").Effect<string, import("./assets.ts").AssetLoadError, never>;
|
|
46
|
-
loadModel: (id: string, url: string) => import("effect/Effect").Effect<import("./assets.ts").ModelInfo, import("./assets.ts").AssetLoadError, never>;
|
|
47
|
-
loadEnvironment: (id: string, url: string) => import("effect/Effect").Effect<string, import("./assets.ts").AssetLoadError, never>;
|
|
48
|
-
loadFont: (id: string, url: string) => import("effect/Effect").Effect<string, import("./assets.ts").AssetLoadError, never>;
|
|
49
|
-
unload: (id: string) => import("effect/Effect").Effect<void, never, never>;
|
|
50
|
-
dispose: () => void;
|
|
51
|
-
};
|
|
52
|
-
/** Enters and leaves immersive (WebXR) sessions, from Commands. */
|
|
53
|
-
xr: {
|
|
54
|
-
supported: (mode: import("./index.ts").XrMode) => import("effect/Effect").Effect<boolean, never, never>;
|
|
55
|
-
enter: (mode: import("./index.ts").XrMode) => import("effect/Effect").Effect<void, import("./xr.ts").XrUnavailable, never>;
|
|
56
|
-
exit: import("effect/Effect").Effect<void, never, never>;
|
|
57
|
-
};
|
|
58
|
-
/** The page's presentable scenes and its session; scene mounts register here. */
|
|
59
|
-
xrHub: import("./dom/xrHub.ts").XrHub;
|
|
60
|
-
/** Disposes every loaded asset and every GPU resource still held. */
|
|
61
|
-
dispose: () => void;
|
|
62
|
-
};
|
|
63
|
-
export type Environment = ReturnType<typeof makeEnvironment>;
|
|
64
|
-
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKvE,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAC9C,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,kBAAkB,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAErC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,eAAe,CAAC;IACnE,gGAAgG;IAChG,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1D;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,eAAe,SAAU,eAAe,YAAW,kBAAkB;;;;uBAnBnD,iBAAiB,KAAK,eAAe;;;IA8BhE,uEAAuE;;IAEvE,wDAAwD;;IAExD,yEAAyE;;;;;;;;;IAEzE,mEAAmE;;;;;;IAEnE,iFAAiF;;IAEjF,qEAAqE;;CAMxE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/xr.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Immersive sessions as Effects an application runs from Foldkit Commands: whether a mode
|
|
3
|
-
* is supported, entering it from a user gesture, and leaving it. The scene presented is
|
|
4
|
-
* the mounted one whose description has `xr`; while presenting, the session drives its
|
|
5
|
-
* frames and the view's `onXRSession` reports the session starting and ending.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import { Effect } from 'effect';
|
|
10
|
-
import type { XrHub, XrMode } from './dom/xrHub.ts';
|
|
11
|
-
declare const XrUnavailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
12
|
-
readonly _tag: "XrUnavailable";
|
|
13
|
-
} & Readonly<A>;
|
|
14
|
-
/** A session could not start: no WebXR, no scene describing `xr`, or the request refused. */
|
|
15
|
-
export declare class XrUnavailable extends XrUnavailable_base<{
|
|
16
|
-
readonly mode: XrMode;
|
|
17
|
-
readonly cause: unknown;
|
|
18
|
-
}> {
|
|
19
|
-
}
|
|
20
|
-
/** The immersive session controls for an environment's hub. */
|
|
21
|
-
export declare const makeXr: (hub: XrHub) => {
|
|
22
|
-
/** Whether the browser can present `mode` (false without WebXR). */
|
|
23
|
-
supported: (mode: XrMode) => Effect.Effect<boolean, never, never>;
|
|
24
|
-
/**
|
|
25
|
-
* Enters `mode`, presenting the mounted scene that describes `xr`. Run it from the
|
|
26
|
-
* Command a click (or other user gesture) produces: browsers require one.
|
|
27
|
-
*/
|
|
28
|
-
enter: (mode: XrMode) => Effect.Effect<void, XrUnavailable, never>;
|
|
29
|
-
/** Ends the session, if there is one. */
|
|
30
|
-
exit: Effect.Effect<void, never, never>;
|
|
31
|
-
};
|
|
32
|
-
export type XrControls = ReturnType<typeof makeXr>;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=xr.d.ts.map
|
package/dist/xr.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xr.d.ts","sourceRoot":"","sources":["../src/xr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;;;;AAEpD,6FAA6F;AAC7F,qBAAa,aAAc,SAAQ,mBAAkC;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;AAEL,+DAA+D;AAC/D,eAAO,MAAM,MAAM,QAAS,KAAK;IAC/B,oEAAoE;IACpE,SAAS,SAAS,MAAM;IACxB;;;OAGG;IACH,KAAK,SAAS,MAAM;IAKpB,yCAAyC;IACzC,IAAI;CACJ,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/src/assets.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loading textures, glTF models and typeface fonts by URL, as Effects an application runs
|
|
3
|
-
* from a Foldkit Command and settles into `AsyncData`. Each asset is lent to the shared
|
|
4
|
-
* resource store under an id: materials use a texture with `map: id`, a `borrowed({ id })`
|
|
5
|
-
* node shows a model, and `text({ font: id })` geometry draws with a font. The environment owns what it loads: loading an id again replaces and disposes
|
|
6
|
-
* the earlier asset, and `unload` or the environment's `dispose` frees it.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import type { ResourceStore } from '@opsydyn/effect-three';
|
|
11
|
-
import { Data, Effect } from 'effect';
|
|
12
|
-
import {
|
|
13
|
-
EquirectangularReflectionMapping,
|
|
14
|
-
type Object3D,
|
|
15
|
-
SRGBColorSpace,
|
|
16
|
-
type Texture,
|
|
17
|
-
TextureLoader,
|
|
18
|
-
} from 'three';
|
|
19
|
-
import { type Font, FontLoader } from 'three/addons/loaders/FontLoader.js';
|
|
20
|
-
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
21
|
-
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
22
|
-
|
|
23
|
-
import { disposeModel, namesIn } from './dom/models.ts';
|
|
24
|
-
|
|
25
|
-
/** An asset could not be fetched or decoded. */
|
|
26
|
-
export class AssetLoadError extends Data.TaggedError('AssetLoadError')<{
|
|
27
|
-
readonly url: string;
|
|
28
|
-
readonly cause: unknown;
|
|
29
|
-
}> {}
|
|
30
|
-
|
|
31
|
-
/** What a loaded model offers: named parts to match hits against, and animation clips. */
|
|
32
|
-
export type ModelInfo = {
|
|
33
|
-
readonly id: string;
|
|
34
|
-
/** Names of the objects inside the model, as hits report them in `part`. */
|
|
35
|
-
readonly parts: ReadonlyArray<string>;
|
|
36
|
-
/** Names of the model's animation clips. */
|
|
37
|
-
readonly clips: ReadonlyArray<string>;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/** Creates the asset loader for a store. One per environment. */
|
|
41
|
-
export const makeAssets = (store: ResourceStore) => {
|
|
42
|
-
const releases = new Map<string, () => void>();
|
|
43
|
-
|
|
44
|
-
/** Takes ownership of an asset under `id`, first releasing whatever was there. */
|
|
45
|
-
const own = (id: string, release: () => void): void => {
|
|
46
|
-
releases.get(id)?.();
|
|
47
|
-
releases.set(id, release);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const lendTexture = (id: string) => (texture: Texture) => {
|
|
51
|
-
texture.colorSpace = SRGBColorSpace;
|
|
52
|
-
const withdraw = store.lendTexture(id, texture);
|
|
53
|
-
own(id, () => {
|
|
54
|
-
withdraw();
|
|
55
|
-
texture.dispose();
|
|
56
|
-
});
|
|
57
|
-
return id;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const lendModel =
|
|
61
|
-
(id: string) =>
|
|
62
|
-
(gltf: { readonly scene: Object3D; readonly animations: Object3D['animations'] }) => {
|
|
63
|
-
// Keep the clips with the object, so a borrowed node can play them by name.
|
|
64
|
-
gltf.scene.animations = gltf.animations;
|
|
65
|
-
const withdraw = store.lend(id, gltf.scene);
|
|
66
|
-
own(id, () => {
|
|
67
|
-
withdraw();
|
|
68
|
-
disposeModel(gltf.scene);
|
|
69
|
-
});
|
|
70
|
-
const info: ModelInfo = {
|
|
71
|
-
id,
|
|
72
|
-
parts: namesIn(gltf.scene),
|
|
73
|
-
clips: gltf.animations.map((clip) => clip.name),
|
|
74
|
-
};
|
|
75
|
-
return info;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/** Lends an HDR panorama for `environment({ map })`: linear, mapped for reflection. */
|
|
79
|
-
const lendEnvironment = (id: string) => (texture: Texture) => {
|
|
80
|
-
texture.mapping = EquirectangularReflectionMapping;
|
|
81
|
-
const withdraw = store.lendTexture(id, texture);
|
|
82
|
-
own(id, () => {
|
|
83
|
-
withdraw();
|
|
84
|
-
texture.dispose();
|
|
85
|
-
});
|
|
86
|
-
return id;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const lendFont = (id: string) => (font: Font) => {
|
|
90
|
-
// Fonts hold no GPU resources: withdrawing the loan frees them.
|
|
91
|
-
own(id, store.lendFont(id, font));
|
|
92
|
-
return id;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const releaseAll = (): void => {
|
|
96
|
-
for (const release of releases.values()) release();
|
|
97
|
-
releases.clear();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
/** Loads a colour texture (sRGB) and lends it under `id`. Succeeds with the id. */
|
|
102
|
-
loadTexture: (id: string, url: string) => {
|
|
103
|
-
const load = Effect.tryPromise({
|
|
104
|
-
try: () => new TextureLoader().loadAsync(url),
|
|
105
|
-
catch: (cause) => new AssetLoadError({ url, cause }),
|
|
106
|
-
});
|
|
107
|
-
return Effect.map(load, lendTexture(id));
|
|
108
|
-
},
|
|
109
|
-
/** Loads a glTF or GLB model and lends its scene under `id`, with its clips. */
|
|
110
|
-
loadModel: (id: string, url: string) => {
|
|
111
|
-
const load = Effect.tryPromise({
|
|
112
|
-
try: () => new GLTFLoader().loadAsync(url),
|
|
113
|
-
catch: (cause) => new AssetLoadError({ url, cause }),
|
|
114
|
-
});
|
|
115
|
-
return Effect.map(load, lendModel(id));
|
|
116
|
-
},
|
|
117
|
-
/**
|
|
118
|
-
* Loads an equirectangular HDR panorama (`.hdr`, three.js's `HDRLoader`) and lends it
|
|
119
|
-
* under `id` for `environment({ map: id })`. Succeeds with the id. Image panoramas
|
|
120
|
-
* load with `loadTexture`; the scene maps them for reflection.
|
|
121
|
-
*/
|
|
122
|
-
loadEnvironment: (id: string, url: string) => {
|
|
123
|
-
const load = Effect.tryPromise({
|
|
124
|
-
try: () => new HDRLoader().loadAsync(url),
|
|
125
|
-
catch: (cause) => new AssetLoadError({ url, cause }),
|
|
126
|
-
});
|
|
127
|
-
return Effect.map(load, lendEnvironment(id));
|
|
128
|
-
},
|
|
129
|
-
/**
|
|
130
|
-
* Loads a typeface JSON font (three.js's `FontLoader` format, as Drei's `Text3D` takes)
|
|
131
|
-
* and lends it under `id`. Succeeds with the id.
|
|
132
|
-
*/
|
|
133
|
-
loadFont: (id: string, url: string) => {
|
|
134
|
-
const load = Effect.tryPromise({
|
|
135
|
-
try: () => new FontLoader().loadAsync(url),
|
|
136
|
-
catch: (cause) => new AssetLoadError({ url, cause }),
|
|
137
|
-
});
|
|
138
|
-
return Effect.map(load, lendFont(id));
|
|
139
|
-
},
|
|
140
|
-
/** Withdraws and disposes the asset loaded under `id`, if any. */
|
|
141
|
-
unload: (id: string) =>
|
|
142
|
-
Effect.sync(() => {
|
|
143
|
-
releases.get(id)?.();
|
|
144
|
-
releases.delete(id);
|
|
145
|
-
}),
|
|
146
|
-
/** Withdraws and disposes every loaded asset. */
|
|
147
|
-
dispose: releaseAll,
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export type Assets = ReturnType<typeof makeAssets>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A `requestAnimationFrame` scheduler shared by every scene on the page: one browser
|
|
3
|
-
* callback per frame, running only while at least one scene is subscribed.
|
|
4
|
-
*
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameScheduler } from '@opsydyn/effect-three';
|
|
8
|
-
|
|
9
|
-
/** The part of `Window` the scheduler needs. */
|
|
10
|
-
export type AnimationFrameHost = Pick<Window, 'requestAnimationFrame' | 'cancelAnimationFrame'>;
|
|
11
|
-
|
|
12
|
-
/** Creates a shared animation-frame scheduler for `host` (normally `window`). */
|
|
13
|
-
export const animationFrameScheduler = (host: AnimationFrameHost): FrameScheduler => {
|
|
14
|
-
const callbacks = new Set<() => void>();
|
|
15
|
-
let handle: number | undefined;
|
|
16
|
-
const tick = (): void => {
|
|
17
|
-
handle = host.requestAnimationFrame(tick);
|
|
18
|
-
for (const onFrame of Array.from(callbacks)) onFrame();
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
subscribe: (onFrame) => {
|
|
22
|
-
callbacks.add(onFrame);
|
|
23
|
-
handle ??= host.requestAnimationFrame(tick);
|
|
24
|
-
return () => {
|
|
25
|
-
callbacks.delete(onFrame);
|
|
26
|
-
if (callbacks.size > 0 || handle === undefined) return;
|
|
27
|
-
host.cancelAnimationFrame(handle);
|
|
28
|
-
handle = undefined;
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
};
|
package/src/dom/canvas.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The canvas a scene draws into, and DOM event dispatch from scene events.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import type { Op, ResourceStore, SceneEvent } from '@opsydyn/effect-three';
|
|
7
|
-
|
|
8
|
-
import { domEventName, type SceneError } from '../element.ts';
|
|
9
|
-
import type { Latch } from './latch.ts';
|
|
10
|
-
import { summarise } from './reconciled.ts';
|
|
11
|
-
|
|
12
|
-
/** Creates a canvas filling `host` and appends it. */
|
|
13
|
-
export const appendCanvas = (host: Element): HTMLCanvasElement => {
|
|
14
|
-
const canvas = host.ownerDocument.createElement('canvas');
|
|
15
|
-
canvas.style.display = 'block';
|
|
16
|
-
canvas.style.width = '100%';
|
|
17
|
-
canvas.style.height = '100%';
|
|
18
|
-
// Pointer gestures go to the scene, not to page scrolling or zooming.
|
|
19
|
-
canvas.style.touchAction = 'none';
|
|
20
|
-
host.append(canvas);
|
|
21
|
-
return canvas;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/** Dispatches a scene event as the element's typed DOM event. */
|
|
25
|
-
export const dispatchSceneEvent = (element: Element, event: SceneEvent): void => {
|
|
26
|
-
element.dispatchEvent(new CustomEvent(domEventName[event._tag], { detail: event }));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** Dispatches a rejected scene update as a `scene-error` event. */
|
|
30
|
-
export const dispatchSceneError = (element: Element, error: SceneError): void => {
|
|
31
|
-
element.dispatchEvent(new CustomEvent('scene-error', { detail: { error } }));
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** Thunk builders, so Effect code can run DOM work with `Effect.sync(thunk)`. */
|
|
35
|
-
export const canvasIn = (host: Element) => () => appendCanvas(host);
|
|
36
|
-
export const removal = (node: ChildNode) => () => node.remove();
|
|
37
|
-
/** Dispatches only while `live` is open: events are dropped during time-travel pause. */
|
|
38
|
-
export const sceneEventDispatch = (element: Element, live: Latch) => (event: SceneEvent) => () => {
|
|
39
|
-
if (live.isOpen()) dispatchSceneEvent(element, event);
|
|
40
|
-
};
|
|
41
|
-
export const sceneErrorDispatch = (element: Element) => (error: SceneError) => () =>
|
|
42
|
-
dispatchSceneError(element, error);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Dispatches a `scene-reconciled` summary when an update changed something. Updates with
|
|
46
|
-
* no operations dispatch nothing, so an app storing the summary in its Model can't loop.
|
|
47
|
-
*/
|
|
48
|
-
export const reconciledDispatch =
|
|
49
|
-
(element: Element, store: ResourceStore) => (ops: ReadonlyArray<Op>) => () => {
|
|
50
|
-
if (ops.length === 0) return;
|
|
51
|
-
element.dispatchEvent(
|
|
52
|
-
new CustomEvent('scene-reconciled', { detail: summarise(ops, store.stats()) }),
|
|
53
|
-
);
|
|
54
|
-
};
|
package/src/dom/latch.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A boolean read synchronously by DOM callbacks and written by Effect code.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type Latch = {
|
|
8
|
-
readonly isOpen: () => boolean;
|
|
9
|
-
readonly set: (open: boolean) => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const createLatch = (open: boolean): Latch => {
|
|
13
|
-
let current = open;
|
|
14
|
-
return {
|
|
15
|
-
isOpen: () => current,
|
|
16
|
-
set: (next) => {
|
|
17
|
-
current = next;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const nothing: ReadonlyArray<never> = [];
|
|
23
|
-
|
|
24
|
-
/** Calls `route` only while `latch` is open, returning what it routed (nothing when shut). */
|
|
25
|
-
export const routedWhileOpen =
|
|
26
|
-
<A, B>(latch: Latch, route: (value: A) => ReadonlyArray<B>) =>
|
|
27
|
-
(value: A): ReadonlyArray<B> => {
|
|
28
|
-
if (!latch.isOpen()) return nothing;
|
|
29
|
-
return route(value);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/** A thunk calling `f(value)`, so Effect code can write `Effect.sync(applying(f, value))`. */
|
|
33
|
-
export const applying =
|
|
34
|
-
<A, B>(f: (value: A) => B, value: A) =>
|
|
35
|
-
(): B =>
|
|
36
|
-
f(value);
|
package/src/dom/models.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plain three.js helpers for loaded models.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { type Material, Mesh, type Object3D, Texture } from 'three';
|
|
7
|
-
|
|
8
|
-
/** Disposes every texture a material holds (maps of any kind). */
|
|
9
|
-
const disposeMaterial = (material: Material): void => {
|
|
10
|
-
for (const value of Object.values(material)) {
|
|
11
|
-
if (value instanceof Texture) value.dispose();
|
|
12
|
-
}
|
|
13
|
-
material.dispose();
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** Disposes a mesh's geometry and materials; other objects hold nothing to free. */
|
|
17
|
-
function disposeMesh(object: Object3D): void {
|
|
18
|
-
if (!(object instanceof Mesh)) return;
|
|
19
|
-
object.geometry.dispose();
|
|
20
|
-
const materials: ReadonlyArray<Material> = Array.isArray(object.material)
|
|
21
|
-
? object.material
|
|
22
|
-
: [object.material];
|
|
23
|
-
for (const material of materials) disposeMaterial(material);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Disposes a loaded model's GPU resources: it was ours, not the application's. */
|
|
27
|
-
export const disposeModel = (root: Object3D): void => {
|
|
28
|
-
root.traverse(disposeMesh);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const namesIn = (root: Object3D): ReadonlyArray<string> => {
|
|
32
|
-
const names: Array<string> = [];
|
|
33
|
-
root.traverse((object) => {
|
|
34
|
-
if (object !== root && object.name !== '') names.push(object.name);
|
|
35
|
-
});
|
|
36
|
-
return names;
|
|
37
|
-
};
|
package/src/dom/overlays.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Moves the application's overlay HTML to where the scene placed each overlay, as Drei's
|
|
3
|
-
* `Html` does every frame (`src/web/Html.tsx` at `bf6f4ad`): a translate to the point,
|
|
4
|
-
* the distance scale, centring, the depth's z-index, and hiding when not visible.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
import type { OverlayPlacement } from '@opsydyn/effect-three';
|
|
9
|
-
|
|
10
|
-
/** The data attribute naming the overlay an element's HTML belongs to. */
|
|
11
|
-
export const overlayData = {
|
|
12
|
-
key: 'effect-three-overlay',
|
|
13
|
-
attribute: 'data-effect-three-overlay',
|
|
14
|
-
} as const;
|
|
15
|
-
|
|
16
|
-
const transformOf = (placement: OverlayPlacement): string =>
|
|
17
|
-
`translate3d(${placement.x}px,${placement.y}px,0) scale(${placement.scale})${
|
|
18
|
-
placement.center ? ' translate(-50%,-50%)' : ''
|
|
19
|
-
}`;
|
|
20
|
-
|
|
21
|
-
/** Writes one placement, touching only the style values that changed. */
|
|
22
|
-
const write = (element: HTMLElement, placement: OverlayPlacement): void => {
|
|
23
|
-
const { style } = element;
|
|
24
|
-
const transform = transformOf(placement);
|
|
25
|
-
if (style.transform !== transform) style.transform = transform;
|
|
26
|
-
const zIndex = String(placement.zIndex);
|
|
27
|
-
if (style.zIndex !== zIndex) style.zIndex = zIndex;
|
|
28
|
-
const visibility = placement.visible ? 'visible' : 'hidden';
|
|
29
|
-
if (style.visibility !== visibility) style.visibility = visibility;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type OverlayWriter = {
|
|
33
|
-
/** Takes the latest placements and writes them. */
|
|
34
|
-
readonly place: (placements: ReadonlyArray<OverlayPlacement>) => void;
|
|
35
|
-
/** Writes the latest placements again, for overlay elements the view has just made. */
|
|
36
|
-
readonly rewrite: () => void;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/** Creates the writer for overlays rendered inside `host`. */
|
|
40
|
-
export const createOverlayWriter = (host: Element): OverlayWriter => {
|
|
41
|
-
let latest: ReadonlyArray<OverlayPlacement> = [];
|
|
42
|
-
const rewrite = (): void => {
|
|
43
|
-
for (const placement of latest) {
|
|
44
|
-
const element = host.querySelector(
|
|
45
|
-
`[${overlayData.attribute}="${CSS.escape(placement.key)}"]`,
|
|
46
|
-
);
|
|
47
|
-
if (element instanceof HTMLElement) write(element, placement);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
place: (placements) => {
|
|
52
|
-
latest = placements;
|
|
53
|
-
rewrite();
|
|
54
|
-
},
|
|
55
|
-
rewrite,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/** Makes the scene element the overlays' containing block, unless it already is one. */
|
|
60
|
-
export const containOverlays = (host: Element) => (): void => {
|
|
61
|
-
if (!(host instanceof HTMLElement)) return;
|
|
62
|
-
if (getComputedStyle(host).position === 'static') host.style.position = 'relative';
|
|
63
|
-
};
|
package/src/dom/pointer.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM pointer events to the kernel's normalised device coordinates.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import type { Gestures, Modifiers, PointerInput, SceneEvent } from '@opsydyn/effect-three';
|
|
7
|
-
|
|
8
|
-
/** The part of `DOMRect` the conversion needs. */
|
|
9
|
-
export type Rect = {
|
|
10
|
-
readonly left: number;
|
|
11
|
-
readonly top: number;
|
|
12
|
-
readonly width: number;
|
|
13
|
-
readonly height: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** Client coordinates to NDC: x and y in [-1, 1], y up. A zero-sized rect maps to the centre. */
|
|
17
|
-
export const toNdc = (
|
|
18
|
-
rect: Rect,
|
|
19
|
-
clientX: number,
|
|
20
|
-
clientY: number,
|
|
21
|
-
): { readonly x: number; readonly y: number } => {
|
|
22
|
-
if (rect.width === 0 || rect.height === 0) return { x: 0, y: 0 };
|
|
23
|
-
return {
|
|
24
|
-
x: ((clientX - rect.left) / rect.width) * 2 - 1,
|
|
25
|
-
y: -(((clientY - rect.top) / rect.height) * 2 - 1),
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const modifiersOf = (event: MouseEvent): Modifiers => ({
|
|
30
|
-
shift: event.shiftKey,
|
|
31
|
-
control: event.ctrlKey,
|
|
32
|
-
meta: event.metaKey,
|
|
33
|
-
alt: event.altKey,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
/** The pointer's id, or 0 for mouse events that are not pointer events. */
|
|
37
|
-
const pointerIdOf = (event: MouseEvent): number =>
|
|
38
|
-
event instanceof PointerEvent ? event.pointerId : 0;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Wheel deltas in CSS pixels: line and page modes scaled as three.js's `OrbitControls`
|
|
42
|
-
* scales them (`_customWheelEvent`: 16 and 100).
|
|
43
|
-
*/
|
|
44
|
-
const wheelScale = [1, 16, 100] as const;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Converts a DOM pointer, mouse or wheel event into kernel input, or `undefined` for
|
|
48
|
-
* other event types. Pointer cancel is treated as leaving the surface.
|
|
49
|
-
*/
|
|
50
|
-
export const toPointerInput = (event: MouseEvent, rect: Rect): PointerInput | undefined => {
|
|
51
|
-
if (event.type === 'pointerleave' || event.type === 'pointercancel') {
|
|
52
|
-
return { _tag: 'PointerLeave' };
|
|
53
|
-
}
|
|
54
|
-
const { x, y } = toNdc(rect, event.clientX, event.clientY);
|
|
55
|
-
const pointer = pointerIdOf(event);
|
|
56
|
-
switch (event.type) {
|
|
57
|
-
case 'pointermove':
|
|
58
|
-
return { _tag: 'PointerMove', x, y, pointer };
|
|
59
|
-
case 'pointerdown':
|
|
60
|
-
return {
|
|
61
|
-
_tag: 'PointerDown',
|
|
62
|
-
x,
|
|
63
|
-
y,
|
|
64
|
-
button: event.button,
|
|
65
|
-
pointer,
|
|
66
|
-
modifiers: modifiersOf(event),
|
|
67
|
-
};
|
|
68
|
-
case 'pointerup':
|
|
69
|
-
return { _tag: 'PointerUp', x, y, button: event.button, pointer };
|
|
70
|
-
case 'dblclick':
|
|
71
|
-
return { _tag: 'DoubleClick', x, y, button: event.button };
|
|
72
|
-
case 'contextmenu':
|
|
73
|
-
return { _tag: 'ContextMenu', x, y };
|
|
74
|
-
case 'wheel':
|
|
75
|
-
return event instanceof WheelEvent
|
|
76
|
-
? {
|
|
77
|
-
_tag: 'Wheel',
|
|
78
|
-
x,
|
|
79
|
-
y,
|
|
80
|
-
deltaX: event.deltaX * (wheelScale[event.deltaMode] ?? 1),
|
|
81
|
-
deltaY: event.deltaY * (wheelScale[event.deltaMode] ?? 1),
|
|
82
|
-
modifiers: modifiersOf(event),
|
|
83
|
-
}
|
|
84
|
-
: undefined;
|
|
85
|
-
default:
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** True when a press landed on an interactive mesh, which then captures the pointer. */
|
|
91
|
-
export const capturesPointer = (events: ReadonlyArray<SceneEvent>): boolean =>
|
|
92
|
-
events.some((event) => event._tag === 'PointerDown');
|
|
93
|
-
|
|
94
|
-
/** True when the scene handled a context-menu input, so the browser menu should not open. */
|
|
95
|
-
export const claimsContextMenu = (events: ReadonlyArray<SceneEvent>): boolean =>
|
|
96
|
-
events.some((event) => event._tag === 'ContextMenu');
|
|
97
|
-
|
|
98
|
-
const eventTypes = [
|
|
99
|
-
'pointermove',
|
|
100
|
-
'pointerdown',
|
|
101
|
-
'pointerup',
|
|
102
|
-
'pointerleave',
|
|
103
|
-
'pointercancel',
|
|
104
|
-
'dblclick',
|
|
105
|
-
'contextmenu',
|
|
106
|
-
'wheel',
|
|
107
|
-
] as const;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Forwards pointer, mouse and wheel input from `element`. `onInput` returns the scene
|
|
111
|
-
* events it produced. By default the page keeps its gestures: wheel and touch scroll it,
|
|
112
|
-
* and the browser's menu opens except over an interactive mesh that handles it. A press
|
|
113
|
-
* on a mesh captures the pointer.
|
|
114
|
-
*
|
|
115
|
-
* While `claimsGestures()` is true the scene owns them, as three.js's `OrbitControls` does
|
|
116
|
-
* when connected: every press captures the pointer, the wheel does not scroll the page,
|
|
117
|
-
* and the context menu stays shut (the right button pans). Returns a function that
|
|
118
|
-
* removes every listener.
|
|
119
|
-
*/
|
|
120
|
-
export const listenForPointer = (
|
|
121
|
-
element: HTMLElement,
|
|
122
|
-
onInput: (input: PointerInput) => ReadonlyArray<SceneEvent>,
|
|
123
|
-
claimsGestures: () => boolean = () => false,
|
|
124
|
-
): (() => void) => {
|
|
125
|
-
const listener = (event: Event): void => {
|
|
126
|
-
if (!(event instanceof MouseEvent)) return;
|
|
127
|
-
const input = toPointerInput(event, element.getBoundingClientRect());
|
|
128
|
-
if (input === undefined) return;
|
|
129
|
-
const events = onInput(input);
|
|
130
|
-
const claimed = claimsGestures();
|
|
131
|
-
if (claimed && (event.type === 'wheel' || event.type === 'contextmenu')) {
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
}
|
|
134
|
-
if (event.type === 'contextmenu' && claimsContextMenu(events)) event.preventDefault();
|
|
135
|
-
// Keep the drag's moves and release coming here even off the canvas, as React Three
|
|
136
|
-
// Fiber's setPointerCapture does. The browser releases capture on pointer up.
|
|
137
|
-
if (
|
|
138
|
-
event instanceof PointerEvent &&
|
|
139
|
-
event.type === 'pointerdown' &&
|
|
140
|
-
(claimed || capturesPointer(events))
|
|
141
|
-
) {
|
|
142
|
-
element.setPointerCapture(event.pointerId);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
// Not passive, so a claimed wheel can stop the page scrolling; unclaimed wheels are
|
|
146
|
-
// left alone.
|
|
147
|
-
for (const type of eventTypes) element.addEventListener(type, listener, { passive: false });
|
|
148
|
-
return () => {
|
|
149
|
-
for (const type of eventTypes) element.removeEventListener(type, listener);
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/** Whatever reports the scene's claim on gestures: its graph. */
|
|
154
|
-
type GestureOwner = { readonly gestures: () => Gestures };
|
|
155
|
-
|
|
156
|
-
/** Whether the scene currently claims the pointer's gestures. */
|
|
157
|
-
export const claimsGestures = (owner: GestureOwner) => (): boolean => owner.gestures() === 'scene';
|
|
158
|
-
|
|
159
|
-
/** Lets the browser pan and zoom on touch, or not while the scene claims gestures. */
|
|
160
|
-
export const touchActionSync = (element: HTMLElement, owner: GestureOwner) => (): void => {
|
|
161
|
-
const touchAction = claimsGestures(owner)() ? 'none' : '';
|
|
162
|
-
if (element.style.touchAction !== touchAction) element.style.touchAction = touchAction;
|
|
163
|
-
};
|