Inicia integrar Anzograph
This commit is contained in:
@@ -83,6 +83,7 @@ export class Renderer {
|
||||
private nodeCount = 0;
|
||||
private edgeCount = 0;
|
||||
private neighborMap: Map<number, number[]> = new Map();
|
||||
private sortedToVertexId: Uint32Array = new Uint32Array(0);
|
||||
private leafEdgeStarts: Uint32Array = new Uint32Array(0);
|
||||
private leafEdgeCounts: Uint32Array = new Uint32Array(0);
|
||||
private maxPtSize = 256;
|
||||
@@ -213,6 +214,12 @@ export class Renderer {
|
||||
gl.bufferData(gl.ARRAY_BUFFER, sorted, gl.STATIC_DRAW);
|
||||
gl.bindVertexArray(null);
|
||||
|
||||
// Build sorted index → vertex ID mapping for hover lookups
|
||||
this.sortedToVertexId = new Uint32Array(count);
|
||||
for (let i = 0; i < count; i++) {
|
||||
this.sortedToVertexId[i] = vertexIds[order[i]];
|
||||
}
|
||||
|
||||
// Build vertex ID → original input index mapping
|
||||
const vertexIdToOriginal = new Map<number, number>();
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -331,6 +338,15 @@ export class Renderer {
|
||||
return this.nodeCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original vertex ID for a given sorted index.
|
||||
* Useful for looking up URI labels from the URI map.
|
||||
*/
|
||||
getVertexId(sortedIndex: number): number | undefined {
|
||||
if (sortedIndex < 0 || sortedIndex >= this.sortedToVertexId.length) return undefined;
|
||||
return this.sortedToVertexId[sortedIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert screen coordinates (CSS pixels) to world coordinates.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user