@thatopen/components 2.4.0-alpha.1 → 2.4.0-alpha.3

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.
@@ -19,5 +19,6 @@ export declare class Mouse implements Disposable {
19
19
  private getPositionY;
20
20
  private getPositionX;
21
21
  private updateMouseInfo;
22
+ private getDataObject;
22
23
  private setupEvents;
23
24
  }
@@ -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.
@@ -12,3 +12,4 @@ export * from "./data-set";
12
12
  export * from "./data-map";
13
13
  export * from "./component-with-ui";
14
14
  export * from "./config-types";
15
+ export * from "./event-manager";
@@ -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
+ }
@@ -1,5 +1,5 @@
1
1
  import * as WEBIFC from "web-ifc";
2
- import { Components, Disposable, Event, Component } from "../../core";
2
+ import { Components, Disposable, Event, Component, AsyncEvent } from "../../core";
3
3
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
4
4
  export * from "./src";
5
5
  /**
@@ -15,7 +15,7 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
15
15
  * Event triggered when geometry is streamed.
16
16
  * Contains the streamed geometry data and its buffer.
17
17
  */
18
- readonly onGeometryStreamed: Event<{
18
+ readonly onGeometryStreamed: AsyncEvent<{
19
19
  buffer: Uint8Array;
20
20
  data: StreamedGeometries;
21
21
  }>;
@@ -23,17 +23,17 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
23
23
  * Event triggered when assets are streamed.
24
24
  * Contains the streamed assets.
25
25
  */
26
- readonly onAssetStreamed: Event<StreamedAsset[]>;
26
+ readonly onAssetStreamed: AsyncEvent<StreamedAsset[]>;
27
27
  /**
28
28
  * Event triggered to indicate the progress of the streaming process.
29
29
  * Contains the progress percentage.
30
30
  */
31
- readonly onProgress: Event<number>;
31
+ readonly onProgress: AsyncEvent<number>;
32
32
  /**
33
33
  * Event triggered when the IFC file is loaded.
34
34
  * Contains the loaded IFC file data.
35
35
  */
36
- readonly onIfcLoaded: Event<Uint8Array>;
36
+ readonly onIfcLoaded: AsyncEvent<Uint8Array>;
37
37
  /** {@link Disposable.onDisposed} */
38
38
  readonly onDisposed: Event<unknown>;
39
39
  /**
@@ -8,8 +8,6 @@ export declare class IfcFragmentSettings {
8
8
  * like IFCSPACE.
9
9
  */
10
10
  optionalCategories: number[];
11
- /** Whether to use the coordination data coming from the IFC files. */
12
- coordinate: boolean;
13
11
  /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
14
12
  wasm: {
15
13
  path: string;