• 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

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

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

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

15
export class PlanarLayout extends SimpleLayoutEngine {
1✔
16
    static type = "planar";
1✔
17
    static maxDimensions = 2;
1✔
18
    scalingFactor = 70;
1✔
19
    config: PlanarLayoutConfigType;
20

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

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

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