openpencil/tests/helpers/scene.ts
Danila Poyarkov c3f5189f8f style: tighten import grouping
- Configure oxfmt custom import groups for workspace, app, package, and test aliases
- Keep type imports grouped with their matching source category instead of one global tail group
- Expand the format script to cover formatter config, Vite files, and scripts
2026-05-06 02:22:08 +03:00

27 lines
698 B
TypeScript

import { SceneGraph } from '@open-pencil/core'
import type { SceneNode } from '@open-pencil/core'
export function makeSceneGraph(pageName = 'Test'): SceneGraph {
const graph = new SceneGraph()
graph.addPage(pageName)
return graph
}
export function firstPageId(graph: SceneGraph): string {
return graph.getPages()[0].id
}
export function createRect(
graph: SceneGraph,
parentId: string,
props: { name?: string; x?: number; y?: number; width?: number; height?: number } = {}
): SceneNode {
return graph.createNode('RECTANGLE', parentId, {
name: props.name ?? 'Rect',
x: props.x ?? 0,
y: props.y ?? 0,
width: props.width ?? 50,
height: props.height ?? 50
})
}