viral-viewer-2 7.2.2 → 7.2.4

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.
@@ -11,6 +11,7 @@ import { ViralInstancedMeshV2 } from "./viral-instanced-mesh-v2";
11
11
  */
12
12
  export declare class ViralBIMWorld extends Mesh {
13
13
  workerPool: WorkerThreadPool | null;
14
+ private _mergePositionsWorker;
14
15
  bimModels: ViralBIMModel[];
15
16
  constructor();
16
17
  private _initializeWorkerPool;
@@ -98,6 +99,11 @@ export declare class ViralBIMWorld extends Mesh {
98
99
  * @returns Float32Array of positions or null if no selection
99
100
  */
100
101
  getSelectedElementsPositions(): Float32Array | null;
102
+ /**
103
+ * Async version — offloads vertex merging to a Web Worker so the main thread stays unblocked.
104
+ * Automatically cancels any in-flight request when called again.
105
+ */
106
+ getSelectedElementsPositionsAsync(): Promise<Float32Array | null>;
101
107
  /**
102
108
  * Changes the color of multiple elements in the merged mesh.
103
109
  * Works with RGBA color buffer (preserves existing alpha values)
@@ -36,6 +36,8 @@ export declare class SelectionOutlinePass extends Pass {
36
36
  private maskScene;
37
37
  private selectionMesh;
38
38
  private selectionGeometry;
39
+ private selectionBuffer;
40
+ private selectionAttribute;
39
41
  private fsQuad;
40
42
  private hasSelection;
41
43
  /**
@@ -5,6 +5,8 @@ export declare class ViralVisibilityManager {
5
5
  private viralViewerApi;
6
6
  /** Whether selection outline is enabled (default: true) */
7
7
  private _selectionOutlineEnabled;
8
+ /** Whether an outline update is already scheduled for the next frame */
9
+ private _outlineUpdateScheduled;
8
10
  constructor(viralViewerApi: ViralViewerApi);
9
11
  /**
10
12
  * show all elements and reset back to normal visualization
@@ -167,6 +169,12 @@ export declare class ViralVisibilityManager {
167
169
  * Uses merged geometry for efficient rendering
168
170
  */
169
171
  updateSelectionOutline(): void;
172
+ /**
173
+ * Schedule outline update for the next animation frame.
174
+ * Batches multiple rapid selection changes into a single update.
175
+ * Uses Web Worker to avoid blocking the main thread.
176
+ */
177
+ private scheduleOutlineUpdate;
170
178
  /**
171
179
  * Enable selection outline effect
172
180
  */
@@ -0,0 +1,19 @@
1
+ export declare class MergePositionsWorker {
2
+ private _worker;
3
+ private _resolve;
4
+ private _requestId;
5
+ constructor();
6
+ /**
7
+ * Merge selected element positions in a background thread.
8
+ * Cancels any in-flight request automatically.
9
+ */
10
+ merge(bufferElements: {
11
+ buffer: Float32Array | null;
12
+ modelId: number;
13
+ instances: {
14
+ elementId: string;
15
+ transform: number[];
16
+ }[];
17
+ }[], selectedKeys: string[]): Promise<Float32Array | null>;
18
+ dispose(): void;
19
+ }
@@ -0,0 +1 @@
1
+ export declare const workerCode: any;