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

graphty-org / graphty-element / 16285911621

15 Jul 2025 06:30AM UTC coverage: 70.213% (-0.08%) from 70.296%
16285911621

push

github

apowers313
fix: rename graphty canvas element

732 of 931 branches covered (78.63%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

10 existing lines in 1 file now uncovered.

4732 of 6851 relevant lines covered (69.07%)

252.25 hits per line

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

66.67
/src/layout/CircularLayoutEngine.ts
1
import {circularLayout, Edge as LayoutEdge, Node as LayoutNode} from "@graphty/layout";
2✔
2
import {z} from "zod/v4";
2✔
3

4
import {SimpleLayoutConfig, SimpleLayoutEngine} from "./LayoutEngine";
2✔
5

6
export const CircularLayoutConfig = z.strictObject({
2✔
7
    ... SimpleLayoutConfig.shape,
2✔
8
    scale: z.number().positive().default(1),
2✔
9
    center: z.array(z.number()).length(2).or(z.null()).default(null),
2✔
10
    dim: z.number().default(2),
2✔
11
});
2✔
12
export type CircularLayoutConfigType = z.infer<typeof CircularLayoutConfig>;
13
export type CircularLayoutOpts = Partial<CircularLayoutConfigType>;
14

15
export class CircularLayout extends SimpleLayoutEngine {
2✔
16
    static type = "circular";
2✔
17
    static maxDimensions = 2;
2✔
18
    scalingFactor = 80;
2✔
19
    config: CircularLayoutConfigType;
20

21
    constructor(opts: CircularLayoutOpts) {
2✔
22
        super(opts);
1✔
23
        this.config = CircularLayoutConfig.parse(opts);
1✔
24
    }
1✔
25

26
    doLayout(): void {
2✔
UNCOV
27
        this.stale = false;
×
UNCOV
28
        const nodes = (): LayoutNode[] => this._nodes.map((n) => n.id as LayoutNode);
×
UNCOV
29
        const edges = (): LayoutEdge[] => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
×
30

UNCOV
31
        this.positions = circularLayout(
×
UNCOV
32
            {nodes, edges},
×
UNCOV
33
            this.config.scale,
×
UNCOV
34
            this.config.center,
×
UNCOV
35
            this.config.dim,
×
UNCOV
36
        );
×
UNCOV
37
    }
×
38
}
2✔
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