@thatopen/components 2.3.11 → 2.4.0-alpha.10
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/core/Components/index.d.ts +1 -1
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +3 -1
- package/dist/core/Types/src/async-event.d.ts +4 -0
- package/dist/core/Types/src/event-manager.d.ts +30 -0
- package/dist/core/Types/src/event.d.ts +4 -0
- package/dist/core/Types/src/index.d.ts +1 -0
- package/dist/core/Types/src/interfaces.d.ts +10 -0
- package/dist/fragments/Classifier/index.d.ts +20 -0
- package/dist/index.cjs +27607 -251
- package/dist/index.min.cjs +19 -0
- package/dist/index.min.mjs +18 -0
- package/dist/index.mjs +17206 -10270
- package/dist/namespace.d.ts +4064 -3994
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
|
|
|
6
6
|
/**
|
|
7
7
|
* The version of the @thatopen/components library.
|
|
8
8
|
*/
|
|
9
|
-
static readonly release = "2.
|
|
9
|
+
static readonly release = "2.4.0-alpha.1";
|
|
10
10
|
/** {@link Disposable.onDisposed} */
|
|
11
11
|
readonly onDisposed: Event<void>;
|
|
12
12
|
/**
|
|
@@ -35,8 +35,10 @@ export declare class SimpleRaycaster implements Disposable {
|
|
|
35
35
|
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
36
36
|
* to query. If not provided, it will query all the meshes stored in
|
|
37
37
|
* {@link Components.meshes}.
|
|
38
|
+
* @param position - the screen position to use for raycasting. If not provided,
|
|
39
|
+
* the last pointer (mouse/touch) position will be used.
|
|
38
40
|
*/
|
|
39
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
41
|
+
castRay(items?: THREE.Object3D[], position?: THREE.Vector2): THREE.Intersection | null;
|
|
40
42
|
/**
|
|
41
43
|
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
42
44
|
* This method also takes into account the clipping planes used by the renderer.
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function.
|
|
3
3
|
*/
|
|
4
4
|
export declare class AsyncEvent<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether this event is active or not. If not, it won't trigger.
|
|
7
|
+
*/
|
|
8
|
+
enabled: boolean;
|
|
5
9
|
/**
|
|
6
10
|
* Add a callback to this event instance.
|
|
7
11
|
* @param handler - the callback to be added to this event.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Event } from "./event";
|
|
2
|
+
import { AsyncEvent } from "./async-event";
|
|
3
|
+
/**
|
|
4
|
+
* Simple class to easily toggle and reset event lists.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EventManager {
|
|
7
|
+
/**
|
|
8
|
+
* The list of events managed by this instance.
|
|
9
|
+
*/
|
|
10
|
+
list: Set<Event<any> | AsyncEvent<any>>;
|
|
11
|
+
/**
|
|
12
|
+
* Adds events to this manager.
|
|
13
|
+
* @param events the events to add.
|
|
14
|
+
*/
|
|
15
|
+
add(events: Iterable<Event<any> | AsyncEvent<any>>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Removes events from this manager.
|
|
18
|
+
* @param events the events to remove.
|
|
19
|
+
*/
|
|
20
|
+
remove(events: Iterable<Event<any> | AsyncEvent<any>>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sets all the events managed by this instance as enabled or disabled.
|
|
23
|
+
* @param active whether to turn on or off the events.
|
|
24
|
+
*/
|
|
25
|
+
set(active: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Resets all the events managed by this instance.
|
|
28
|
+
*/
|
|
29
|
+
reset(): void;
|
|
30
|
+
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function.
|
|
3
3
|
*/
|
|
4
4
|
export declare class Event<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether this event is active or not. If not, it won't trigger.
|
|
7
|
+
*/
|
|
8
|
+
enabled: boolean;
|
|
5
9
|
/**
|
|
6
10
|
* Add a callback to this event instance.
|
|
7
11
|
* @param handler - the callback to be added to this event.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import CameraControls from "camera-controls";
|
|
3
3
|
import { Event } from "./event";
|
|
4
|
+
import { EventManager } from "./event-manager";
|
|
4
5
|
/**
|
|
5
6
|
* Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
|
|
6
7
|
*/
|
|
@@ -105,3 +106,12 @@ export interface CameraControllable {
|
|
|
105
106
|
*/
|
|
106
107
|
controls: CameraControls;
|
|
107
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Whether it has events or not.
|
|
111
|
+
*/
|
|
112
|
+
export interface Eventable {
|
|
113
|
+
/**
|
|
114
|
+
* The object in charge of managing all the events.
|
|
115
|
+
*/
|
|
116
|
+
eventManager: EventManager;
|
|
117
|
+
}
|
|
@@ -21,6 +21,15 @@ export interface Classification {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
interface ExportedClassification {
|
|
25
|
+
[system: string]: {
|
|
26
|
+
[groupName: string]: {
|
|
27
|
+
map: string;
|
|
28
|
+
name: string;
|
|
29
|
+
id: number | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
24
33
|
/**
|
|
25
34
|
* The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
|
|
26
35
|
*/
|
|
@@ -170,5 +179,16 @@ export declare class Classifier extends Component implements Disposable {
|
|
|
170
179
|
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
171
180
|
*/
|
|
172
181
|
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
182
|
+
/**
|
|
183
|
+
* Exports the computed classification to persists them and import them back
|
|
184
|
+
* later for faster loading.
|
|
185
|
+
*/
|
|
186
|
+
export(): ExportedClassification;
|
|
187
|
+
/**
|
|
188
|
+
* Imports a classification previously exported with .export().
|
|
189
|
+
* @param data the serialized classification to import.
|
|
190
|
+
*/
|
|
191
|
+
import(data: ExportedClassification): void;
|
|
173
192
|
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
174
193
|
}
|
|
194
|
+
export {};
|