The 54 editor engine tests move to packages/core/tests/editor with their helpers, importing Core's public subpaths or source modules relatively. The package gains test and typecheck scripts; the first type check fixed nullable lookups, stale imports, and renderer doubles, and graph events now declare the GraphEventRenderer surface they invalidate. The engine baseline drops to 534 files.
32 lines
647 B
TypeScript
32 lines
647 B
TypeScript
import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'
|
|
|
|
export function autoFrame(
|
|
graph: SceneGraph,
|
|
parentId: string,
|
|
overrides: Partial<SceneNode> = {}
|
|
): SceneNode {
|
|
return graph.createNode('FRAME', parentId, {
|
|
layoutMode: 'HORIZONTAL',
|
|
primaryAxisSizing: 'FIXED',
|
|
counterAxisSizing: 'FIXED',
|
|
width: 400,
|
|
height: 200,
|
|
...overrides
|
|
})
|
|
}
|
|
|
|
export function rect(
|
|
graph: SceneGraph,
|
|
parentId: string,
|
|
w = 50,
|
|
h = 50,
|
|
overrides: Partial<SceneNode> = {}
|
|
): SceneNode {
|
|
return graph.createNode('RECTANGLE', parentId, {
|
|
name: 'Rect',
|
|
width: w,
|
|
height: h,
|
|
...overrides
|
|
})
|
|
}
|