@opsydyn/effect-three-foldkit 0.2.0 → 0.4.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 +18 -1
- package/README.md +2 -1
- package/dist/boxSelect.d.ts +150 -0
- package/dist/boxSelect.d.ts.map +1 -0
- package/dist/dom/webgl.d.ts.map +1 -1
- package/dist/dom/webgpu.d.ts.map +1 -1
- package/dist/element.d.ts +104 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +535 -32
- package/dist/index.js.map +13 -7
- package/dist/inspector.d.ts +24 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/measuringTape.d.ts +76 -0
- package/dist/measuringTape.d.ts.map +1 -0
- package/dist/pivotControls.d.ts +106 -0
- package/dist/pivotControls.d.ts.map +1 -0
- package/dist/transformGizmo.d.ts +158 -0
- package/dist/transformGizmo.d.ts.map +1 -0
- package/dist/view.d.ts +7 -0
- package/dist/view.d.ts.map +1 -1
- package/dist/viewportGizmo.d.ts +146 -0
- package/dist/viewportGizmo.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/boxSelect.ts +158 -0
- package/src/dom/webgl.ts +15 -0
- package/src/dom/webgpu.ts +15 -0
- package/src/element.ts +2 -0
- package/src/index.ts +7 -0
- package/src/inspector.ts +112 -0
- package/src/measuringTape.ts +124 -0
- package/src/pivotControls.ts +118 -0
- package/src/transformGizmo.ts +131 -0
- package/src/view.ts +9 -0
- package/src/viewportGizmo.ts +119 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An inspector panel for Foldkit views (roadmap, "Beyond parity" 4): the fields the
|
|
3
|
+
* core's `Inspector.fields` reads from a schema, drawn as a form. Each control reports
|
|
4
|
+
* an edit as the app's own Message, with the field's path and the new value; the app
|
|
5
|
+
* applies it with `Inspector.edit`, which the schema checks, and keeps the result (or
|
|
6
|
+
* shows why it was refused).
|
|
7
|
+
*
|
|
8
|
+
* Numbers, text and choices report when they change (on Enter or leaving the field),
|
|
9
|
+
* colours as they are picked, switches when clicked, and each of a vector's three
|
|
10
|
+
* numbers on its own. Kinds, absent parts and lists are shown, not edited.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import type { FieldPath, FieldValue, InspectedField } from '@opsydyn/effect-three';
|
|
15
|
+
import type { Html, HtmlBuilder } from 'foldkit/html';
|
|
16
|
+
/** Turns an edit (where, and the new value) into the app's Message. */
|
|
17
|
+
export type OnEdit<Message> = (path: FieldPath, value: FieldValue) => Message;
|
|
18
|
+
/**
|
|
19
|
+
* The fields as a form: a row each, its name and its control, keyed by path. Style it
|
|
20
|
+
* with the classes `e3-inspector`, `e3-inspector-row`, `e3-inspector-name`,
|
|
21
|
+
* `e3-inspector-vector` and `e3-inspector-fixed`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const inspectorView: <Message>(h: HtmlBuilder<Message>, fields: ReadonlyArray<InspectedField>, onEdit: OnEdit<Message>) => Html;
|
|
24
|
+
//# sourceMappingURL=inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,uEAAuE;AACvE,MAAM,MAAM,MAAM,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;AA2E9E;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,KAChC,WAAW,CAAC,OAAO,CAAC,UACf,aAAa,CAAC,cAAc,CAAC,UAC7B,MAAM,CAAC,OAAO,CAAC,KACtB,IAUA,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A measuring tape as a Foldkit submodel (roadmap, "Beyond parity" 5): the core's pure
|
|
3
|
+
* `tape` with Messages for clicks and pointer moves on the scene, an OutMessage when a
|
|
4
|
+
* length is measured, and its length as HTML at the tape's middle. The parent decides
|
|
5
|
+
* when the tape is in use and which clicks are on the scene:
|
|
6
|
+
*
|
|
7
|
+
* - `Placed` (a click on the scene, with the point it hit) places an end, or starts a
|
|
8
|
+
* new tape; placing the second reports `Measured { from, to, length }`;
|
|
9
|
+
* - `Pointed` (the pointer moving over the scene, or `null` off it) runs the tape to
|
|
10
|
+
* the pointer while the second end is placed;
|
|
11
|
+
* - `Cleared` empties it; `ChoseSnap` rounds new ends to a step, or not.
|
|
12
|
+
*
|
|
13
|
+
* `nodes(model)` draws it for the scene and `label(model, h)` is the length for the
|
|
14
|
+
* view's `overlays`.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { type SceneNode, type TapeLook } from '@opsydyn/effect-three';
|
|
19
|
+
import { Option, Schema } from 'effect';
|
|
20
|
+
import type { HtmlBuilder } from 'foldkit/html';
|
|
21
|
+
import type { ReturnWithOutMessage } from 'foldkit/update';
|
|
22
|
+
import type { OverlayView } from './overlayView.ts';
|
|
23
|
+
export declare const Model: Schema.Struct<{
|
|
24
|
+
/** The key its nodes and label are drawn under. */
|
|
25
|
+
readonly key: Schema.String;
|
|
26
|
+
readonly tape: Schema.Struct<{
|
|
27
|
+
readonly from: Schema.NullOr<Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>>;
|
|
28
|
+
readonly to: Schema.NullOr<Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>>;
|
|
29
|
+
readonly pointer: Schema.NullOr<Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>>;
|
|
30
|
+
readonly snap: Schema.NullOr<Schema.Finite>;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export type Model = typeof Model.Type;
|
|
34
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
35
|
+
readonly Placed: {
|
|
36
|
+
point: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
37
|
+
};
|
|
38
|
+
readonly Pointed: {
|
|
39
|
+
point: Schema.NullOr<Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>>;
|
|
40
|
+
};
|
|
41
|
+
readonly Cleared: {};
|
|
42
|
+
readonly ChoseSnap: {
|
|
43
|
+
snap: Schema.NullOr<Schema.Finite>;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
export type Message = typeof Message.Type;
|
|
47
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
48
|
+
/** Both ends are placed: where, and how far apart. */
|
|
49
|
+
readonly Measured: {
|
|
50
|
+
from: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
51
|
+
to: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
52
|
+
length: Schema.Finite;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
56
|
+
/** An empty tape drawn under `key`, snapping to `snap` when given. */
|
|
57
|
+
export declare const init: (key: string, options?: {
|
|
58
|
+
readonly snap?: number | null;
|
|
59
|
+
}) => Model;
|
|
60
|
+
type Return = ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
61
|
+
export declare const update: (model: Model, message: Message) => Return;
|
|
62
|
+
/** The tape's length, while it has one (to the pointer while the second end is placed). */
|
|
63
|
+
export declare const length: (model: Model) => Option.Option<number>;
|
|
64
|
+
/** The tape, for the parent's scene. */
|
|
65
|
+
export declare const nodes: (model: Model, look?: Partial<TapeLook>) => SceneNode;
|
|
66
|
+
/**
|
|
67
|
+
* The length at the tape's middle, for the view's `overlays`: two decimals and `unit`
|
|
68
|
+
* (`m` unless given), in an element with the class `className` (unstyled unless given).
|
|
69
|
+
* Pointer events pass through it to the scene.
|
|
70
|
+
*/
|
|
71
|
+
export declare const label: <Message>(model: Model, h: HtmlBuilder<Message>, options?: {
|
|
72
|
+
readonly unit?: string;
|
|
73
|
+
readonly className?: string;
|
|
74
|
+
}) => ReadonlyArray<OverlayView>;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=measuringTape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measuringTape.d.ts","sourceRoot":"","sources":["../src/measuringTape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAML,KAAK,SAAS,EAGd,KAAK,QAAQ,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,KAAK;IAChB,mDAAmD;;;;;;;;EAGnD,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,eAAO,MAAM,OAAO;;QACR,KAAK;;;QACJ,KAAK;;;;QAEH,IAAI;;EACjB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,eAAO,MAAM,UAAU;IACrB,sDAAsD;;QAC1C,IAAI;QAAoB,EAAE;QAAoB,MAAM;;EAChE,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,sEAAsE;AACtE,eAAO,MAAM,IAAI,QAAS,MAAM,YAAW;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KAAQ,KAGlF,CAAC;AAEH,KAAK,MAAM,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAe/D,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO,KAAG,MAMpD,CAAC;AAEL,2FAA2F;AAC3F,eAAO,MAAM,MAAM,UAAW,KAAK,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CACZ,CAAC;AAE/C,wCAAwC;AACxC,eAAO,MAAM,KAAK,UAAW,KAAK,SAAQ,OAAO,CAAC,QAAQ,CAAC,KAAQ,SAC3B,CAAC;AASzC;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,SACpB,KAAK,KACT,WAAW,CAAC,OAAO,CAAC,YACd;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KAC/D,aAAa,CAAC,WAAW,CAYxB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pivot controls as a Foldkit submodel (roadmap, "Beyond parity" 5): the core's pure
|
|
3
|
+
* `pivotNodes`, `pressPivot` and `dragPivot` (after Drei's `PivotControls`) with
|
|
4
|
+
* Messages for the scene's pointer events and OutMessages for what the parent does with
|
|
5
|
+
* them, as `TransformGizmo` is for three's controls. The parent owns where its objects
|
|
6
|
+
* are; the submodel owns only the handles:
|
|
7
|
+
*
|
|
8
|
+
* - `Pressed` (a pointer down on one of its handles, with the point it hit and the
|
|
9
|
+
* object's placement) takes hold;
|
|
10
|
+
* - `Dragged` reports `Moved { placement }` for the parent to apply (`snap` rounds turns
|
|
11
|
+
* to ten degrees and scales to tenths, as Drei's shift does);
|
|
12
|
+
* - `Released` lets go and reports `Finished { placement }`, a step for history;
|
|
13
|
+
* - `Hovered` highlights a handle.
|
|
14
|
+
*
|
|
15
|
+
* `handleOf(model, key)` says whether a hit is on a handle, and `nodes(model, placement)`
|
|
16
|
+
* draws them.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { pivot, type PivotHandle, type Placement, type SceneNode } from '@opsydyn/effect-three';
|
|
21
|
+
import { Option, Schema } from 'effect';
|
|
22
|
+
import type { ReturnWithOutMessage } from 'foldkit/update';
|
|
23
|
+
export declare const Model: Schema.Struct<{
|
|
24
|
+
/** The key its handles are drawn under: `${key}:arrow-x`, `${key}:slider-z` and so on. */
|
|
25
|
+
readonly key: Schema.String;
|
|
26
|
+
readonly pivot: Schema.Struct<{
|
|
27
|
+
readonly scale: Schema.Finite;
|
|
28
|
+
readonly depthTest: Schema.Boolean;
|
|
29
|
+
readonly disableAxes: Schema.Boolean;
|
|
30
|
+
readonly disableSliders: Schema.Boolean;
|
|
31
|
+
readonly disableRotations: Schema.Boolean;
|
|
32
|
+
readonly disableScaling: Schema.Boolean;
|
|
33
|
+
readonly hovered: Schema.NullOr<Schema.Literals<("arrow-x" | "arrow-y" | "arrow-z" | "rotator-x" | "rotator-y" | "rotator-z" | "slider-x" | "slider-y" | "slider-z" | "sphere-x" | "sphere-y" | "sphere-z")[]>>;
|
|
34
|
+
readonly grab: Schema.NullOr<Schema.Struct<{
|
|
35
|
+
readonly handle: Schema.Literals<("arrow-x" | "arrow-y" | "arrow-z" | "rotator-x" | "rotator-y" | "rotator-z" | "slider-x" | "slider-y" | "slider-z" | "sphere-x" | "sphere-y" | "sphere-z")[]>;
|
|
36
|
+
readonly start: Schema.Struct<{
|
|
37
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
38
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
39
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
40
|
+
}>;
|
|
41
|
+
readonly point: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
42
|
+
readonly e1: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
43
|
+
readonly e2: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
44
|
+
readonly normal: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
45
|
+
}>>;
|
|
46
|
+
}>;
|
|
47
|
+
/** The placement the drag last reported, so `Released` can report where it ended. */
|
|
48
|
+
readonly last: Schema.Option<Schema.Struct<{
|
|
49
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
50
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
51
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
52
|
+
}>>;
|
|
53
|
+
}>;
|
|
54
|
+
export type Model = typeof Model.Type;
|
|
55
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
56
|
+
readonly Pressed: {
|
|
57
|
+
handle: Schema.Literals<("arrow-x" | "arrow-y" | "arrow-z" | "rotator-x" | "rotator-y" | "rotator-z" | "slider-x" | "slider-y" | "slider-z" | "sphere-x" | "sphere-y" | "sphere-z")[]>;
|
|
58
|
+
point: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
59
|
+
placement: Schema.Struct<{
|
|
60
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
61
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
62
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
readonly Dragged: {
|
|
66
|
+
origin: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
67
|
+
direction: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
68
|
+
snap: Schema.Boolean;
|
|
69
|
+
};
|
|
70
|
+
readonly Released: {};
|
|
71
|
+
readonly Hovered: {
|
|
72
|
+
handle: Schema.NullOr<Schema.Literals<("arrow-x" | "arrow-y" | "arrow-z" | "rotator-x" | "rotator-y" | "rotator-z" | "slider-x" | "slider-y" | "slider-z" | "sphere-x" | "sphere-y" | "sphere-z")[]>>;
|
|
73
|
+
};
|
|
74
|
+
}>;
|
|
75
|
+
export type Message = typeof Message.Type;
|
|
76
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
77
|
+
/** The object's placement now, during a drag. */
|
|
78
|
+
readonly Moved: {
|
|
79
|
+
placement: Schema.Struct<{
|
|
80
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
81
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
82
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
/** The drag is over, the object here: a step for history. */
|
|
86
|
+
readonly Finished: {
|
|
87
|
+
placement: Schema.Struct<{
|
|
88
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
89
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
90
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
94
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
95
|
+
/** Pivot controls drawn under `key`, with Drei's defaults or the options given. */
|
|
96
|
+
export declare const init: (key: string, options?: Parameters<typeof pivot>[0]) => Model;
|
|
97
|
+
type Return = ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
98
|
+
export declare const update: (model: Model, message: Message) => Return;
|
|
99
|
+
/** Whether a hit `key` is one of these controls' handles, and which. */
|
|
100
|
+
export declare const handleOf: (model: Model, key: string) => Option.Option<PivotHandle>;
|
|
101
|
+
/** Whether a handle is held: the parent leaves the camera alone while it is. */
|
|
102
|
+
export declare const held: (model: Model) => boolean;
|
|
103
|
+
/** The handles for `placement`, for the parent's scene. */
|
|
104
|
+
export declare const nodes: (model: Model, placement: Placement) => SceneNode;
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=pivotControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pivotControls.d.ts","sourceRoot":"","sources":["../src/pivotControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAIL,KAAK,EACL,KAAK,WAAW,EAGhB,KAAK,SAAS,EAId,KAAK,SAAS,EAEf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,KAAK;IAChB,0FAA0F;;;;;;;;;;;;;;;;;;;;;;;IAG1F,qFAAqF;;;;;;EAErF,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,eAAO,MAAM,OAAO;;QACP,MAAM;QAAU,KAAK;QAAoB,SAAS;;;;;;;QAClD,MAAM;QAAoB,SAAS;QAAoB,IAAI;;;;QAE3D,MAAM;;EACjB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,eAAO,MAAM,UAAU;IACrB,iDAAiD;;QACxC,SAAS;;;;;;IAClB,6DAA6D;;QACjD,SAAS;;;;;;EACrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,mFAAmF;AACnF,eAAO,MAAM,IAAI,QAAS,MAAM,YAAW,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAQ,KAI5E,CAAC;AAEH,KAAK,MAAM,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAuB/D,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO,KAAG,MAWpD,CAAC;AAEL,wEAAwE;AACxE,eAAO,MAAM,QAAQ,UAAW,KAAK,OAAO,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CACzB,CAAC;AAEtD,gFAAgF;AAChF,eAAO,MAAM,IAAI,UAAW,KAAK,KAAG,OAAoC,CAAC;AAEzE,2DAA2D;AAC3D,eAAO,MAAM,KAAK,UAAW,KAAK,aAAa,SAAS,KAAG,SACZ,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A transform gizmo as a Foldkit submodel (roadmap, "Beyond parity" 5): the core's pure
|
|
3
|
+
* gizmo (`gizmoNodes`, `pressGizmo`, `dragGizmo`, after three's `TransformControls`)
|
|
4
|
+
* with Messages for the scene's pointer events and OutMessages for what the parent does
|
|
5
|
+
* with them. The parent owns where its objects are; the submodel owns only the gizmo:
|
|
6
|
+
*
|
|
7
|
+
* - `Pressed` (a press on one of its handles, with the object's placement and the
|
|
8
|
+
* camera) takes hold;
|
|
9
|
+
* - `Dragged` reports `Moved { placement }` for the parent to apply;
|
|
10
|
+
* - `Released` lets go and reports `Finished { placement }`, the moment to record a step
|
|
11
|
+
* of history;
|
|
12
|
+
* - `Hovered` highlights a handle; `ChoseMode` and `ChoseSpace` switch them.
|
|
13
|
+
*
|
|
14
|
+
* `handleOf(model, key)` says whether a hit is on a handle, and `nodes(model, placement,
|
|
15
|
+
* camera)` draws them, for the parent's scene and view.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { type Camera, gizmo, type GizmoHandle, type Placement, type SceneNode } from '@opsydyn/effect-three';
|
|
20
|
+
import { Option, Schema } from 'effect';
|
|
21
|
+
import type { ReturnWithOutMessage } from 'foldkit/update';
|
|
22
|
+
export declare const Model: Schema.Struct<{
|
|
23
|
+
/** The key its handles are drawn under: `${key}:x`, `${key}:xy` and so on. */
|
|
24
|
+
readonly key: Schema.String;
|
|
25
|
+
readonly gizmo: Schema.Struct<{
|
|
26
|
+
readonly mode: Schema.Literals<readonly ["translate", "rotate", "scale"]>;
|
|
27
|
+
readonly space: Schema.Literals<readonly ["world", "local"]>;
|
|
28
|
+
readonly size: Schema.Finite;
|
|
29
|
+
readonly translationSnap: Schema.NullOr<Schema.Finite>;
|
|
30
|
+
readonly rotationSnap: Schema.NullOr<Schema.Finite>;
|
|
31
|
+
readonly scaleSnap: Schema.NullOr<Schema.Finite>;
|
|
32
|
+
readonly showX: Schema.Boolean;
|
|
33
|
+
readonly showY: Schema.Boolean;
|
|
34
|
+
readonly showZ: Schema.Boolean;
|
|
35
|
+
readonly hovered: Schema.NullOr<Schema.Literals<readonly ["x", "y", "z", "xy", "yz", "xz", "xyz"]>>;
|
|
36
|
+
readonly grab: Schema.NullOr<Schema.Struct<{
|
|
37
|
+
readonly handle: Schema.Literals<readonly ["x", "y", "z", "xy", "yz", "xz", "xyz"]>;
|
|
38
|
+
readonly start: Schema.Struct<{
|
|
39
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
40
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
41
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
42
|
+
}>;
|
|
43
|
+
readonly from: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
44
|
+
readonly plane: Schema.Struct<{
|
|
45
|
+
readonly normal: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
46
|
+
readonly constant: Schema.Finite;
|
|
47
|
+
}>;
|
|
48
|
+
readonly eye: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
49
|
+
readonly distance: Schema.Finite;
|
|
50
|
+
}>>;
|
|
51
|
+
}>;
|
|
52
|
+
/** The placement the drag last reported, so `Released` can report where it ended. */
|
|
53
|
+
readonly last: Schema.Option<Schema.Struct<{
|
|
54
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
55
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
56
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
57
|
+
}>>;
|
|
58
|
+
}>;
|
|
59
|
+
export type Model = typeof Model.Type;
|
|
60
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
61
|
+
readonly Pressed: {
|
|
62
|
+
handle: Schema.Literals<readonly ["x", "y", "z", "xy", "yz", "xz", "xyz"]>;
|
|
63
|
+
origin: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
64
|
+
direction: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
65
|
+
placement: Schema.Struct<{
|
|
66
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
67
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
68
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
69
|
+
}>;
|
|
70
|
+
camera: Schema.Union<readonly [Schema.TaggedStruct<"Perspective", {
|
|
71
|
+
readonly fov: Schema.Finite;
|
|
72
|
+
readonly near: Schema.Finite;
|
|
73
|
+
readonly far: Schema.Finite;
|
|
74
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
75
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
76
|
+
readonly damping: Schema.Finite;
|
|
77
|
+
readonly autoRotate: Schema.Finite;
|
|
78
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
79
|
+
readonly intensity: Schema.Finite;
|
|
80
|
+
readonly decay: Schema.Boolean;
|
|
81
|
+
readonly decayRate: Schema.Finite;
|
|
82
|
+
readonly maxYaw: Schema.Finite;
|
|
83
|
+
readonly maxPitch: Schema.Finite;
|
|
84
|
+
readonly maxRoll: Schema.Finite;
|
|
85
|
+
readonly yawFrequency: Schema.Finite;
|
|
86
|
+
readonly pitchFrequency: Schema.Finite;
|
|
87
|
+
readonly rollFrequency: Schema.Finite;
|
|
88
|
+
readonly trigger: Schema.Finite;
|
|
89
|
+
}>>, never>;
|
|
90
|
+
}>, Schema.TaggedStruct<"Orthographic", {
|
|
91
|
+
readonly zoom: Schema.Finite;
|
|
92
|
+
readonly near: Schema.Finite;
|
|
93
|
+
readonly far: Schema.Finite;
|
|
94
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
95
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
96
|
+
readonly damping: Schema.Finite;
|
|
97
|
+
readonly autoRotate: Schema.Finite;
|
|
98
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
99
|
+
readonly intensity: Schema.Finite;
|
|
100
|
+
readonly decay: Schema.Boolean;
|
|
101
|
+
readonly decayRate: Schema.Finite;
|
|
102
|
+
readonly maxYaw: Schema.Finite;
|
|
103
|
+
readonly maxPitch: Schema.Finite;
|
|
104
|
+
readonly maxRoll: Schema.Finite;
|
|
105
|
+
readonly yawFrequency: Schema.Finite;
|
|
106
|
+
readonly pitchFrequency: Schema.Finite;
|
|
107
|
+
readonly rollFrequency: Schema.Finite;
|
|
108
|
+
readonly trigger: Schema.Finite;
|
|
109
|
+
}>>, never>;
|
|
110
|
+
}>]>;
|
|
111
|
+
};
|
|
112
|
+
readonly Dragged: {
|
|
113
|
+
origin: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
114
|
+
direction: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
115
|
+
};
|
|
116
|
+
readonly Released: {};
|
|
117
|
+
readonly Hovered: {
|
|
118
|
+
handle: Schema.NullOr<Schema.Literals<readonly ["x", "y", "z", "xy", "yz", "xz", "xyz"]>>;
|
|
119
|
+
};
|
|
120
|
+
readonly ChoseMode: {
|
|
121
|
+
mode: Schema.Literals<readonly ["translate", "rotate", "scale"]>;
|
|
122
|
+
};
|
|
123
|
+
readonly ChoseSpace: {
|
|
124
|
+
space: Schema.Literals<readonly ["world", "local"]>;
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
export type Message = typeof Message.Type;
|
|
128
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
129
|
+
/** The object's placement now, during a drag. */
|
|
130
|
+
readonly Moved: {
|
|
131
|
+
placement: Schema.Struct<{
|
|
132
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
133
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
134
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
137
|
+
/** The drag is over, the object here: a step for history. */
|
|
138
|
+
readonly Finished: {
|
|
139
|
+
placement: Schema.Struct<{
|
|
140
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
141
|
+
readonly rotation: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
142
|
+
readonly scale: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
143
|
+
}>;
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
146
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
147
|
+
/** A gizmo drawn under `key`, with the core's defaults or the options given. */
|
|
148
|
+
export declare const init: (key: string, options?: Parameters<typeof gizmo>[0]) => Model;
|
|
149
|
+
type Return = ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
150
|
+
export declare const update: (model: Model, message: Message) => Return;
|
|
151
|
+
/** Whether a hit `key` is one of this gizmo's handles, and which. */
|
|
152
|
+
export declare const handleOf: (model: Model, key: string) => Option.Option<GizmoHandle>;
|
|
153
|
+
/** Whether the gizmo is held: the parent leaves the camera alone while it is. */
|
|
154
|
+
export declare const held: (model: Model) => boolean;
|
|
155
|
+
/** The handles for `placement`, seen from `camera`, for the parent's scene. */
|
|
156
|
+
export declare const nodes: (model: Model, placement: Placement, camera: Camera) => SceneNode;
|
|
157
|
+
export {};
|
|
158
|
+
//# sourceMappingURL=transformGizmo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformGizmo.d.ts","sourceRoot":"","sources":["../src/transformGizmo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,KAAK,MAAM,EAGX,KAAK,EACL,KAAK,WAAW,EAIhB,KAAK,SAAS,EAId,KAAK,SAAS,EAEf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,KAAK;IAChB,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG9E,qFAAqF;;;;;;EAErF,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,eAAO,MAAM,OAAO;;QAEhB,MAAM;QACN,MAAM;QACN,SAAS;QACT,SAAS;;;;;QACT,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAEG,MAAM;QAAoB,SAAS;;;;QAEnC,MAAM;;;QACJ,IAAI;;;QACH,KAAK;;EACnB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,eAAO,MAAM,UAAU;IACrB,iDAAiD;;QACxC,SAAS;;;;;;IAClB,6DAA6D;;QACjD,SAAS;;;;;;EACrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,gFAAgF;AAChF,eAAO,MAAM,IAAI,QAAS,MAAM,YAAW,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAQ,KAI5E,CAAC;AAEH,KAAK,MAAM,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAuB/D,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO,KAAG,MAgBpD,CAAC;AAEL,qEAAqE;AACrE,eAAO,MAAM,QAAQ,UAAW,KAAK,OAAO,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CACzB,CAAC;AAEtD,iFAAiF;AACjF,eAAO,MAAM,IAAI,UAAW,KAAK,KAAG,OAAoC,CAAC;AAEzE,+EAA+E;AAC/E,eAAO,MAAM,KAAK,UAAW,KAAK,aAAa,SAAS,UAAU,MAAM,KAAG,SACpB,CAAC"}
|
package/dist/view.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export type DragDetail = typeof SceneSchema.DragDetail.Type;
|
|
|
27
27
|
* `orbit` to move a camera kept in the Model.
|
|
28
28
|
*/
|
|
29
29
|
export type Gesture = typeof SceneSchema.Gesture.Type;
|
|
30
|
+
/** Detail of the end of a gesture that moved: the press's button, modifiers, mesh and view. */
|
|
31
|
+
export type GestureEndDetail = typeof SceneSchema.GestureEndDetail.Type;
|
|
30
32
|
/** Detail of collision events: the two bodies' keys, and whether they began touching. */
|
|
31
33
|
export type CollisionDetail = typeof SceneSchema.CollisionDetail.Type;
|
|
32
34
|
/** Detail of contact force events: the two bodies, and how hard they pushed. */
|
|
@@ -89,6 +91,11 @@ export type ViewConfig<Message> = {
|
|
|
89
91
|
* the camera stays in the Model.
|
|
90
92
|
*/
|
|
91
93
|
readonly onGesture?: (gesture: Gesture) => Message;
|
|
94
|
+
/**
|
|
95
|
+
* A gesture that moved has ended (released, or the pointer left): finish what it drew,
|
|
96
|
+
* such as a `BoxSelect` box. Not after a press that never moved.
|
|
97
|
+
*/
|
|
98
|
+
readonly onGestureEnd?: (detail: GestureEndDetail) => Message;
|
|
92
99
|
/**
|
|
93
100
|
* A gesture is about to begin on a camera turning by itself (`autoRotate`): keep where
|
|
94
101
|
* it got to with `autoRotated(model.camera, detail)` (a view's camera when `view` names
|
package/dist/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG3E,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEf,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAgB,KAAK,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC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AAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,OAAO,CAAC;IACvE;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC;IAC9D;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAIF,2EAA2E;AAC3E,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KACjC,WAAW,CAAC,OAAO,CAAC,KACtB,IA2CF,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A viewport gizmo as a Foldkit submodel (roadmap, "Beyond parity" 5), after Drei's
|
|
3
|
+
* `GizmoHelper` with `GizmoViewport`: the core's `viewportGizmoNodes` in a scene's
|
|
4
|
+
* `hud`, its heads highlighted under the pointer, and a press on one turning the camera
|
|
5
|
+
* to look from that axis. The parent owns the camera; the submodel owns the highlight:
|
|
6
|
+
*
|
|
7
|
+
* - `Entered` and `Left` (the scene's pointer enter and leave, with the hit key)
|
|
8
|
+
* highlight a head, and clear it;
|
|
9
|
+
* - `Pressed` (a pointer down, with the hit key and the camera) reports
|
|
10
|
+
* `Turned { camera }`, the camera looking from that head's axis, for the parent to
|
|
11
|
+
* keep. A camera with `damping` eases round to it, as Drei's tween does.
|
|
12
|
+
*
|
|
13
|
+
* `hud(model, camera)` is the scene's HUD with the gizmo in it; `nodes` the gizmo alone,
|
|
14
|
+
* for a HUD with more in it.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { type Camera, type Hud, type HudAlignment, type SceneNode, type ViewAxis } from '@opsydyn/effect-three';
|
|
19
|
+
import { Option, Schema } from 'effect';
|
|
20
|
+
import type { ReturnWithOutMessage } from 'foldkit/update';
|
|
21
|
+
export declare const Model: Schema.Struct<{
|
|
22
|
+
/** The key its nodes are drawn under: `${key}:x`, `${key}:-y` and so on. */
|
|
23
|
+
readonly key: Schema.String;
|
|
24
|
+
/** The head under the pointer. */
|
|
25
|
+
readonly hovered: Schema.NullOr<Schema.Literals<readonly ["x", "y", "z", "-x", "-y", "-z"]>>;
|
|
26
|
+
/** Leaves out the negative heads. */
|
|
27
|
+
readonly hideNegativeAxes: Schema.Boolean;
|
|
28
|
+
}>;
|
|
29
|
+
export type Model = typeof Model.Type;
|
|
30
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
31
|
+
readonly Entered: {
|
|
32
|
+
key: Schema.String;
|
|
33
|
+
};
|
|
34
|
+
readonly Left: {
|
|
35
|
+
key: Schema.String;
|
|
36
|
+
};
|
|
37
|
+
readonly Pressed: {
|
|
38
|
+
key: Schema.String;
|
|
39
|
+
camera: Schema.Union<readonly [Schema.TaggedStruct<"Perspective", {
|
|
40
|
+
readonly fov: Schema.Finite;
|
|
41
|
+
readonly near: Schema.Finite;
|
|
42
|
+
readonly far: Schema.Finite;
|
|
43
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
44
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
45
|
+
readonly damping: Schema.Finite;
|
|
46
|
+
readonly autoRotate: Schema.Finite;
|
|
47
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
48
|
+
readonly intensity: Schema.Finite;
|
|
49
|
+
readonly decay: Schema.Boolean;
|
|
50
|
+
readonly decayRate: Schema.Finite;
|
|
51
|
+
readonly maxYaw: Schema.Finite;
|
|
52
|
+
readonly maxPitch: Schema.Finite;
|
|
53
|
+
readonly maxRoll: Schema.Finite;
|
|
54
|
+
readonly yawFrequency: Schema.Finite;
|
|
55
|
+
readonly pitchFrequency: Schema.Finite;
|
|
56
|
+
readonly rollFrequency: Schema.Finite;
|
|
57
|
+
readonly trigger: Schema.Finite;
|
|
58
|
+
}>>, never>;
|
|
59
|
+
}>, Schema.TaggedStruct<"Orthographic", {
|
|
60
|
+
readonly zoom: Schema.Finite;
|
|
61
|
+
readonly near: Schema.Finite;
|
|
62
|
+
readonly far: Schema.Finite;
|
|
63
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
64
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
65
|
+
readonly damping: Schema.Finite;
|
|
66
|
+
readonly autoRotate: Schema.Finite;
|
|
67
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
68
|
+
readonly intensity: Schema.Finite;
|
|
69
|
+
readonly decay: Schema.Boolean;
|
|
70
|
+
readonly decayRate: Schema.Finite;
|
|
71
|
+
readonly maxYaw: Schema.Finite;
|
|
72
|
+
readonly maxPitch: Schema.Finite;
|
|
73
|
+
readonly maxRoll: Schema.Finite;
|
|
74
|
+
readonly yawFrequency: Schema.Finite;
|
|
75
|
+
readonly pitchFrequency: Schema.Finite;
|
|
76
|
+
readonly rollFrequency: Schema.Finite;
|
|
77
|
+
readonly trigger: Schema.Finite;
|
|
78
|
+
}>>, never>;
|
|
79
|
+
}>]>;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
export type Message = typeof Message.Type;
|
|
83
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
84
|
+
/** The camera, looking from the axis of the head pressed. */
|
|
85
|
+
readonly Turned: {
|
|
86
|
+
camera: Schema.Union<readonly [Schema.TaggedStruct<"Perspective", {
|
|
87
|
+
readonly fov: Schema.Finite;
|
|
88
|
+
readonly near: Schema.Finite;
|
|
89
|
+
readonly far: Schema.Finite;
|
|
90
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
91
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
92
|
+
readonly damping: Schema.Finite;
|
|
93
|
+
readonly autoRotate: Schema.Finite;
|
|
94
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
95
|
+
readonly intensity: Schema.Finite;
|
|
96
|
+
readonly decay: Schema.Boolean;
|
|
97
|
+
readonly decayRate: Schema.Finite;
|
|
98
|
+
readonly maxYaw: Schema.Finite;
|
|
99
|
+
readonly maxPitch: Schema.Finite;
|
|
100
|
+
readonly maxRoll: Schema.Finite;
|
|
101
|
+
readonly yawFrequency: Schema.Finite;
|
|
102
|
+
readonly pitchFrequency: Schema.Finite;
|
|
103
|
+
readonly rollFrequency: Schema.Finite;
|
|
104
|
+
readonly trigger: Schema.Finite;
|
|
105
|
+
}>>, never>;
|
|
106
|
+
}>, Schema.TaggedStruct<"Orthographic", {
|
|
107
|
+
readonly zoom: Schema.Finite;
|
|
108
|
+
readonly near: Schema.Finite;
|
|
109
|
+
readonly far: Schema.Finite;
|
|
110
|
+
readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
111
|
+
readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
|
|
112
|
+
readonly damping: Schema.Finite;
|
|
113
|
+
readonly autoRotate: Schema.Finite;
|
|
114
|
+
readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
115
|
+
readonly intensity: Schema.Finite;
|
|
116
|
+
readonly decay: Schema.Boolean;
|
|
117
|
+
readonly decayRate: Schema.Finite;
|
|
118
|
+
readonly maxYaw: Schema.Finite;
|
|
119
|
+
readonly maxPitch: Schema.Finite;
|
|
120
|
+
readonly maxRoll: Schema.Finite;
|
|
121
|
+
readonly yawFrequency: Schema.Finite;
|
|
122
|
+
readonly pitchFrequency: Schema.Finite;
|
|
123
|
+
readonly rollFrequency: Schema.Finite;
|
|
124
|
+
readonly trigger: Schema.Finite;
|
|
125
|
+
}>>, never>;
|
|
126
|
+
}>]>;
|
|
127
|
+
};
|
|
128
|
+
}>;
|
|
129
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
130
|
+
/** A gizmo drawn under `key`, every head shown unless `hideNegativeAxes`. */
|
|
131
|
+
export declare const init: (key: string, options?: {
|
|
132
|
+
readonly hideNegativeAxes?: boolean;
|
|
133
|
+
}) => Model;
|
|
134
|
+
type Return = ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
135
|
+
/** Which head a hit `key` is on, if it is one of this gizmo's. */
|
|
136
|
+
export declare const axisOf: (model: Model, key: string) => Option.Option<ViewAxis>;
|
|
137
|
+
export declare const update: (model: Model, message: Message) => Return;
|
|
138
|
+
/** The gizmo for `camera`, for a HUD. */
|
|
139
|
+
export declare const nodes: (model: Model, camera: Camera) => SceneNode;
|
|
140
|
+
/** A HUD holding only the gizmo, 80 pixels in from the bottom right unless placed. */
|
|
141
|
+
export declare const hud: (model: Model, camera: Camera, placement?: {
|
|
142
|
+
readonly alignment?: HudAlignment;
|
|
143
|
+
readonly margin?: readonly [number, number];
|
|
144
|
+
}) => Hud;
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=viewportGizmo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewportGizmo.d.ts","sourceRoot":"","sources":["../src/viewportGizmo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,KAAK,MAAM,EAGX,KAAK,GAAG,EACR,KAAK,YAAY,EAEjB,KAAK,SAAS,EACd,KAAK,QAAQ,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAI3D,eAAO,MAAM,KAAK;IAChB,4EAA4E;;I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2
2
|
"name": "@opsydyn/effect-three-foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Thin Foldkit adapter for @opsydyn/effect-three.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"typescript": "7.0.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@opsydyn/effect-three": "0.
|
|
69
|
+
"@opsydyn/effect-three": "0.4.0",
|
|
70
70
|
"effect": "^4.0.0",
|
|
71
71
|
"foldkit": "0.167.0",
|
|
72
72
|
"three": ">=0.186.0 <0.187.0"
|