@cosmos.gl/graph 2.6.2 → 2.7.0-beta.1

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/config.d.ts CHANGED
@@ -447,8 +447,8 @@ export interface GraphConfigInterface {
447
447
  */
448
448
  showFPSMonitor?: boolean;
449
449
  /**
450
- * Canvas pixel ratio.
451
- * Default value: `2`
450
+ * Pixel ratio for the canvas. Higher values use more GPU memory but provide better quality on high-DPI displays.
451
+ * Default value: `window.devicePixelRatio || 2`
452
452
  */
453
453
  pixelRatio?: number;
454
454
  /**
@@ -3,4 +3,4 @@
3
3
  * @param container The HTML element to append the error message to
4
4
  * @returns The created error div element
5
5
  */
6
- export declare function createWebGLErrorMessage(container: HTMLElement): HTMLDivElement;
6
+ export declare function createWebGLErrorMessage(container: HTMLElement, error: string): HTMLDivElement;
package/dist/helper.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { default as regl } from 'regl';
1
+ import { Device, Framebuffer } from '@luma.gl/core';
2
2
  import { default as DOMPurify } from 'dompurify';
3
3
  export declare const isFunction: <T>(a: T) => boolean;
4
4
  export declare const isArray: <T>(a: unknown | T[]) => a is T[];
@@ -7,7 +7,44 @@ export declare const isAClassInstance: <T>(a: T) => boolean;
7
7
  export declare const isPlainObject: <T>(a: T) => boolean;
8
8
  export declare function getRgbaColor(value: string | [number, number, number, number]): [number, number, number, number];
9
9
  export declare function rgbToBrightness(r: number, g: number, b: number): number;
10
- export declare function readPixels(reglInstance: regl.Regl, fbo: regl.Framebuffer2D): Float32Array;
10
+ /**
11
+ * TODO: Migrate from deprecated `readPixelsToArrayWebGL` to CommandEncoder API
12
+ *
13
+ * `readPixelsToArrayWebGL` is deprecated in luma.gl v9. The recommended modern approach is:
14
+ *
15
+ * 1. Create a buffer to hold the pixel data:
16
+ * const buffer = device.createBuffer({
17
+ * byteLength: width * height * 4 * 4, // RGBA, 4 bytes per float
18
+ * usage: Buffer.COPY_DST | Buffer.MAP_READ
19
+ * });
20
+ *
21
+ * 2. Copy texture/framebuffer to buffer using command encoder:
22
+ * const commandEncoder = device.createCommandEncoder();
23
+ * commandEncoder.copyTextureToBuffer({
24
+ * sourceTexture: fbo, // Can be Texture or Framebuffer
25
+ * width: sourceWidth ?? fbo.width,
26
+ * height: sourceHeight ?? fbo.height,
27
+ * origin: [sourceX, sourceY],
28
+ * destinationBuffer: buffer
29
+ * });
30
+ * const commandBuffer = commandEncoder.finish();
31
+ * device.submit(commandBuffer);
32
+ *
33
+ * 3. Read the data from the buffer (async):
34
+ * const pixelData = await buffer.readAsync(); // Returns ArrayBuffer
35
+ * return new Float32Array(pixelData);
36
+ *
37
+ * Note: The modern approach is asynchronous, so this function signature would need to change
38
+ * to return Promise<Float32Array> or we'd need to handle async at all call sites (18 locations).
39
+ *
40
+ * Migration impact:
41
+ * - This function is used in 18 places across the codebase
42
+ * - All call sites would need to be updated to handle async
43
+ * - Consider batching the migration to avoid inconsistencies
44
+ *
45
+ * Current status: Deprecated but still functional. Keeping for now until full migration can be planned.
46
+ */
47
+ export declare function readPixels(device: Device, fbo: Framebuffer, sourceX?: number, sourceY?: number, sourceWidth?: number, sourceHeight?: number): Float32Array;
11
48
  export declare function clamp(num: number, min: number, max: number): number;
12
49
  export declare function isNumber(value: number | undefined | null | typeof NaN): boolean;
13
50
  /**