• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 16190621176

10 Jul 2025 08:52AM UTC coverage: 66.274% (-2.7%) from 68.949%
16190621176

push

github

apowers313
style: delint

441 of 681 branches covered (64.76%)

Branch coverage included in aggregate %.

3499 of 5264 relevant lines covered (66.47%)

1070.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/MeshCache.ts
1
import {InstancedMesh, Mesh} from "@babylonjs/core";
2

3
import type {NodeStyleId} from "./Styles";
4

5
type MeshCreatorFn = () => Mesh;
6

7
export class MeshCache {
1✔
8
    meshCacheMap = new Map<string | NodeStyleId, Mesh>();
59✔
9
    hits = 0;
59✔
10
    misses = 0;
59✔
11

12
    get(name: string | NodeStyleId, creator: MeshCreatorFn): InstancedMesh {
1✔
13
        let mesh = this.meshCacheMap.get(name);
24,898✔
14
        if (mesh) {
24,898✔
15
            this.hits++;
24,721✔
16
            return mesh.createInstance(`${name}`);
24,721✔
17
        }
24,721✔
18

19
        this.misses++;
177✔
20
        mesh = creator();
177✔
21
        // Must keep mesh visible for instances to be visible
22
        // Position it far away so it's not rendered
23
        mesh.position.set(0, -10000, 0);
177✔
24
        mesh.freezeWorldMatrix();
177✔
25
        this.meshCacheMap.set(name, mesh);
177✔
26
        return mesh.createInstance(`${name}`);
177✔
27
    }
24,898✔
28

29
    reset(): void {
1✔
30
        this.hits = 0;
1✔
31
        this.misses = 0;
1✔
32
    }
1✔
33

34
    clear(): void {
1✔
35
        for (const mesh of this.meshCacheMap.values()) {
1!
36
            mesh.dispose();
×
37
        }
×
38
        this.meshCacheMap.clear();
1✔
39
        this.reset();
1✔
40
    }
1✔
41
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc