AI-native design editor. Open-source Figma alternative.
feat: route connectors as FigJam does when the layers they join change (#1234)
Danila Poyarkove6182d694b81
diff --git a/changes/1234/added.md b/changes/1234/added.mdnew file mode 100644index 000000000..f95957283--- /dev/null+++ b/changes/1234/added.md@@ -0,0 +1 @@+- Connectors route as FigJam does when the layers they join move, resize, or change, including while dragging, and are deleted with those layers (#616).diff --git a/packages/core/src/editor/clipboard.ts b/packages/core/src/editor/clipboard.tsindex 0835182e0..3c09ee231 100644--- a/packages/core/src/editor/clipboard.ts+++ b/packages/core/src/editor/clipboard.ts@@ -1,4 +1,10 @@-import { CommittedGraphEventError, cycleSafeParent } from '@open-pencil/scene-graph'+import { uniq } from 'es-toolkit'++import {+ attachedConnectors,+ CommittedGraphEventError,+ cycleSafeParent+} from '@open-pencil/scene-graph'import type { SceneNode } from '@open-pencil/scene-graph'import { getAxisAlignedBoundsInParent } from '@open-pencil/scene-graph/coordinate'import type { Rect, Vector } from '@open-pencil/scene-graph/primitives'@@ -367,18 +373,27 @@ export function createClipboardActions(ctx: EditorContext) {ctx.undo.runBatch('Delete', () => deleteLayers(nodeIds, nextSelection))}+ /** Whether a delete removes this layer: one that is unlocked and may leave its parent. */+ function deletable(id: string): boolean {+ const node = ctx.graph.getNode(id)+ if (!node || node.locked) return false+ return acceptsChildren(ctx, node.parentId ?? ctx.state.currentPageId)+ }+function deleteLayers(nodeIds: Iterable<string>, nextSelection?: ReadonlySet<string>) {+ const requested = [...nodeIds].filter(deletable)+ // Connectors go with a layer they attach to, as in FigJam; one that stays keeps them.+ const attached = attachedConnectors(ctx.graph, requested).map((node) => node.id)const entries: Array<{id: stringparentId: stringindex: numbersubtree: Map<string, SceneNode>}> = []- for (const id of nodeIds) {+ for (const id of uniq([...requested, ...attached])) {const node = ctx.graph.getNode(id)- if (!node || node.locked) continue+ if (!node || !deletable(id)) continueconst parentId = node.parentId ?? ctx.state.currentPageId- if (!acceptsChildren(ctx, parentId)) continueconst parent = ctx.graph.getNode(parentId)const index = parent?.childIds.indexOf(id) ?? -1entries.push({ id, parentId, index, subtree: snapshotSubtree(ctx.graph, id) })diff --git a/packages/core/src/editor/connectors/routing.ts b/packages/core/src/editor/connectors/routing.tsnew file mode 100644index 000000000..c8f21b8f2--- /dev/null+++ b/packages/core/src/editor/connectors/routing.ts@@ -0,0 +1,252 @@+import { isEqual, pick } from 'es-toolkit'++import {+ connectorRouteEnds,+ freeEndpoint,+ generatedFrameOwner,+ layoutConnector,+ SIZE_FIELDS,+ TRANSFORM_FIELDS,+ type ConnectorEndpoint,+ type SceneGraph,+ type SceneNode,+ type UndoEntry+} from '@open-pencil/scene-graph'+import type { Vector } from '@open-pencil/scene-graph/primitives'++import type { EditorContext } from '#core/editor/types'+import { routeUnroutedConnectors } from '#core/layout'++/** Fields of any layer that move a connector attached to it or to a layer inside it. */+const PLACEMENT_FIELDS: ReadonlySet<string> = new Set<string>([+ ...TRANSFORM_FIELDS,+ ...SIZE_FIELDS,+ 'parentId'+])++/** A connector's own fields that change its route. */+const CONNECTOR_FIELDS: ReadonlySet<string> = new Set<keyof SceneNode>([+ 'connectorStart',+ 'connectorEnd',+ 'connectorLineType',+ 'connectorStartCap',+ 'connectorEndCap'+])++/** Fields of a connector's sublayers that change its route: the line's weight, the label's size. */+const SUBLAYER_FIELDS: ReadonlySet<string> = new Set<string>([+ ...SIZE_FIELDS,+ 'text',+ 'strokes',+ 'strokeWeight'+])++/**+ * The ends a connector moved as a whole carries along: its free ends stay where its line now+ * draws them, as a pasted or dragged connector's do in FigJam. Ends on layers follow their+ * layers. Null when nothing moves.+ */+function carriedFreeEnds(graph: SceneGraph, connector: SceneNode): Partial<SceneNode> | null {+ const drawn = connectorRouteEnds(graph, connector)+ if (!drawn) return null+ const carried = (endpoint: ConnectorEndpoint | null, at: Vector) =>+ endpoint?.nodeId === null ? freeEndpoint(at.x, at.y) : endpoint+ const changes = {+ connectorStart: carried(connector.connectorStart, drawn.start),+ connectorEnd: carried(connector.connectorEnd, drawn.end)+ }+ return isEqual(changes, pick(connector, ['connectorStart', 'connectorEnd'])) ? null : changes+}++/** Whether `id` or a layer above it is one of `ids`. */+function underAny(graph: SceneGraph, id: string, ids: ReadonlySet<string>): boolean {+ return graph.closest(id, (node) => ids.has(node.id)) !== undefined+}++/**+ * Keeps connectors routed as the layers they attach to move, resize, or change, as FigJam does:+ * while a drag previews, and when an edit, undo, or redo lands. A route derives from the layers,+ * so it is laid out again rather than recorded; loading a document keeps the routes it saved,+ * though a label its fonts resize moves its plate, and routes a connector it saved without one+ * once the page it is on is shown.+ */+export function createConnectorRouting(ctx: EditorContext) {+ let indexed: SceneGraph | null = null+ const connectorIds = new Set<string>()+ /** Layers changed since the last pass, and whether any change was more than a preview. */+ let pending: { ids: Set<string>; committed: boolean } | null = null+ let routing = false+ /**+ * The ends of connectors moved since the last undo step, as they were before the move. A move+ * records its step after it lands, as a drag or a run of nudges does, so the next step takes+ * them along.+ */+ const unrecorded = new Map<string, Pick<SceneNode, 'connectorStart' | 'connectorEnd'>>()+ /** Steps already seen at the top of the history, to tell a new step from undo and redo. */+ const seenSteps = new WeakSet<UndoEntry>()++ function connectors(graph: SceneGraph): Set<string> {+ if (indexed !== graph) {+ indexed = graph+ connectorIds.clear()+ for (const node of graph.getAllNodes()) {+ if (node.type === 'CONNECTOR') connectorIds.add(node.id)+ }+ }+ return connectorIds+ }++ function schedule(id: string, committed: boolean) {+ if (routing || ctx.graph.isApplyingImportedState) return+ if (!pending) {+ pending = { ids: new Set(), committed: false }+ queueMicrotask(flush)+ }+ pending.ids.add(id)+ pending.committed ||= committed+ }++ function changed(id: string, changes: Partial<SceneNode>, committed: boolean) {+ const keys = Object.keys(changes)+ const node = ctx.graph.getNode(id)+ if (!node) return+ if (node.type === 'CONNECTOR' && keys.some((key) => CONNECTOR_FIELDS.has(key))) {+ schedule(id, committed)+ return+ }+ if (node.type === 'CONNECTOR' && (keys.includes('x') || keys.includes('y'))) {+ carryFreeEnds(node, committed)+ schedule(id, committed)+ return+ }+ const owner = generatedFrameOwner(ctx.graph, node)+ if (owner?.type === 'CONNECTOR') {+ // A label laid out as its font loads moves its plate too.+ if (keys.some((key) => SUBLAYER_FIELDS.has(key))) schedule(owner.id, committed)+ return+ }+ // Laying out a page as it loads moves nothing a saved route depends on.+ if (ctx.graph.isApplyingDerivedLayout) return+ if (keys.some((key) => PLACEMENT_FIELDS.has(key))) schedule(id, committed)+ }++ /**+ * Carries a connector's free ends as it moves, by as much as its line moved, before the line is+ * laid out again. Undo and redo put the ends back with the step that recorded them instead.+ */+ function carryFreeEnds(connector: SceneNode, committed: boolean) {+ const graph = ctx.graph+ if (+ routing ||+ ctx.undo.isReplaying ||+ graph.isApplyingImportedState ||+ graph.isApplyingLayout+ ) {+ return+ }+ const carried = carriedFreeEnds(graph, connector)+ if (!carried) return+ if (!unrecorded.has(connector.id)) {+ unrecorded.set(+ connector.id,+ structuredClone(pick(connector, ['connectorStart', 'connectorEnd']))+ )+ }+ routing = true+ try {+ if (committed) graph.withLayoutMutations(() => graph.updateNode(connector.id, carried))+ else graph.updateNodePreview(connector.id, carried)+ } finally {+ routing = false+ }+ schedule(connector.id, committed)+ }++ /** Adds the ends connectors were carried from and to into the step just recorded. */+ function recordCarriedEnds() {+ const step = ctx.undo.peekUndo()+ const fresh = step !== undefined && !seenSteps.has(step)+ if (step) seenSteps.add(step)+ const graph = ctx.graph+ const moves = fresh+ ? [...unrecorded].flatMap(([id, before]) => {+ const node = graph.getNode(id)+ if (!node) return []+ const after = structuredClone(pick(node, ['connectorStart', 'connectorEnd']))+ return isEqual(before, after) ? [] : [{ id, before, after }]+ })+ : []+ unrecorded.clear()+ if (moves.length === 0) return+ const apply = (ends: 'before' | 'after') => {+ for (const move of moves) graph.updateNode(move.id, structuredClone(move[ends]))+ }+ ctx.undo.extendLastStep({+ label: 'Move connector',+ forward: () => apply('after'),+ inverse: () => apply('before')+ })+ }++ function flush() {+ const batch = pending+ pending = null+ if (!batch) return+ const graph = ctx.graph+ const ids = connectors(graph)+ const affected: SceneNode[] = []+ for (const id of ids) {+ const connector = graph.getNode(id)+ if (!connector) {+ ids.delete(id)+ continue+ }+ const watched = [id, connector.connectorStart?.nodeId, connector.connectorEnd?.nodeId]+ if (watched.some((watchedId) => watchedId && underAny(graph, watchedId, batch.ids))) {+ affected.push(connector)+ }+ }+ if (affected.length === 0) return+ routing = true+ try {+ const update = batch.committed+ ? (id: string, changes: Partial<SceneNode>) =>+ graph.withLayoutMutations(() => graph.updateNode(id, changes))+ : (id: string, changes: Partial<SceneNode>) => graph.updateNodePreview(id, changes)+ // A preview keeps each connector's own box, so a drag that places it from where it started+ // carries its free ends by the drag alone; the edit that lands fits the box again.+ const keepBox = !batch.committed+ let moved = false+ for (const connector of affected) {+ moved = layoutConnector(graph, connector, update, { keepBox }) || moved+ }+ if (moved) ctx.requestRender()+ } finally {+ routing = false+ }+ }++ // A document read without layout, as a `.fig` is, routes such connectors when shown.+ function routeShownPage(graph: SceneGraph, pageId: string) {+ graph.applyDerivedLayoutDuring(() =>+ graph.withLayoutMutations(() => routeUnroutedConnectors(graph, pageId))+ )+ }++ ctx.onEditorEvent('history:changed', recordCarriedEnds)+ ctx.onEditorEvent('graph:replaced', (graph) => {+ unrecorded.clear()+ routeShownPage(graph, ctx.state.currentPageId)+ })+ ctx.onEditorEvent('page:changed', (pageId) => routeShownPage(ctx.graph, pageId))+ ctx.onEditorEvent('node:updated', (id, changes) => changed(id, changes, true))+ ctx.onEditorEvent('node:previewUpdated', (id, changes) => changed(id, changes, false))+ ctx.onEditorEvent('node:created', (node) => {+ if (node.type === 'CONNECTOR' && indexed === ctx.graph) connectorIds.add(node.id)+ })+ ctx.onEditorEvent('node:reparented', (id) => schedule(id, true))+ // Moving a layer into another parent by reordering moves it as reparenting does.+ ctx.onEditorEvent('node:reordered', (id, parentId, _index, previousParentId) => {+ if (parentId !== previousParentId) schedule(id, true)+ })+}diff --git a/packages/core/src/editor/create.ts b/packages/core/src/editor/create.tsindex 233561339..21c812ff8 100644--- a/packages/core/src/editor/create.ts+++ b/packages/core/src/editor/create.ts@@ -35,6 +35,7 @@ import { createClipboardPropertiesActions } from './clipboard/paste/properties'import { createColorSpaceActions } from './color-space'import { createComponentSyncScheduler } from './component-sync'import { createComponentActions } from './components'+import { createConnectorRouting } from './connectors/routing'import { createDesignTokenActions } from './design-tokens'import { createGraphEventSubscription } from './graph-events'import { createGraphReadActions } from './graph-reads'@@ -295,6 +296,7 @@ export function createEditor(options?: EditorOptions) {const icons = createIconActions(ctx)const stickies = createStickyActions(ctx)const statuses = createStatusActions(ctx)+ createConnectorRouting(ctx)const shaders = createShaderActions(ctx, nodes)const alignment = createAlignmentActions(ctx)const preview = createPlayActions(ctx)diff --git a/packages/core/src/layout.ts b/packages/core/src/layout.tsindex 01425bff3..5708d7bb2 100644--- a/packages/core/src/layout.ts+++ b/packages/core/src/layout.ts@@ -35,7 +35,9 @@ export {type TextMeasurer} from './layout/text-measurement'import {+ connectorSublayers,isGeneratedFrame,+ layoutConnector,layoutSizing,type LayoutSizing,type SceneGraph,@@ -92,9 +94,24 @@ export function computeAllLayouts(graph: SceneGraph, scopeId?: string): void {if (applyEffectiveGeneratedTextLayout(graph, rootId)) {computeLayoutsBottomUp(graph, rootId, new Set())}+ routeUnroutedConnectors(graph, rootId)})}+/**+ * Routes each connector that has no route yet, as one read from a file that saved none, once its+ * label is measured, as FigJam routes such a connector when it opens. A saved route is kept.+ */+export function routeUnroutedConnectors(graph: SceneGraph, rootId: string): void {+ for (const { node } of graph.flattenTree(rootId)) {+ if (node.type !== 'CONNECTOR') continue+ const line = connectorSublayers(graph, node)?.line+ if (!line || (line.vectorNetwork?.vertices.length ?? 0) > 0) continue+ sizeAutoResizingText(graph, node.id)+ layoutConnector(graph, node)+ }+}+/*** Gives content an author wrote, such as design JSX, HTML, or a `.pen` file, the sizes and* positions its layout implies, which the source does not store, measuring its text first.diff --git a/packages/core/tests/clipboard/figma/connectors.test.ts b/packages/core/tests/clipboard/figma/connectors.test.tsindex 76cf04256..5a46ffba4 100644--- a/packages/core/tests/clipboard/figma/connectors.test.ts+++ b/packages/core/tests/clipboard/figma/connectors.test.ts@@ -10,8 +10,9 @@ import {initCodec,parseFigmaClipboard} from '@open-pencil/core'-import { connectorSublayers, SceneGraph } from '@open-pencil/scene-graph'+import { connectorSublayers, layoutConnector, SceneGraph } from '@open-pencil/scene-graph'import type { SceneNode } from '@open-pencil/scene-graph'+import type { Vector } from '@open-pencil/scene-graph/primitives'/** Two FigJam stickies joined by four connectors, as FigJam copies them. */const FIXTURE = join(FIXTURES, 'clipboard/figjam-connectors.html')@@ -93,4 +94,54 @@ describe('FigJam connectors', () => {expect(endName(reread.graph, elbow, 'connectorEnd')).toBe('c-B')expect(connectorSublayers(reread.graph, elbow)?.line.vectorNetwork?.vertices.length).toBe(6)})++ test('a connector saved without its route is routed as Figma routed it', async () => {+ const html = await Bun.file(FIXTURE).text()+ const drawn = await importFixture(html)+ const parsed = expectDefined(await parseFigmaClipboard(html))+ for (const node of parsed.nodes) {+ if (node.type === 'CONNECTOR') delete node.derivedImmutableFrameData+ }+ const graph = new SceneGraph()+ const ids = importClipboardNodes(parsed.nodes, graph, graph.getPages()[0].id, 0, 0, parsed.blobs)+ // The fixture's other two connectors keep a cut from a label since cleared, and one ends on+ // a layer left out of the copy, so Figma's saved routes for them are not what it would route.+ const routed = ['c-elbow-auto', 'c-curved-free'].map((name) =>+ expectDefined(+ ids.map((id) => graph.getNode(id)).find((node) => node?.name === name)+ )+ )+ for (const connector of routed) {+ const figma = drawn.byName(connector.name)+ // Text layout sizes a label once its font loads, and the connector routes around it again.+ const label = expectDefined(connectorSublayers(graph, connector)).label+ const { width, height } = expectDefined(connectorSublayers(drawn.graph, figma)).label+ graph.updateNode(label.id, { width, height })+ layoutConnector(graph, connector)+ expect({ name: connector.name, route: pageRoute(graph, connector) }).toEqual({+ name: connector.name,+ route: pageRoute(drawn.graph, figma)+ })+ }+ })})++/** A connector's line as rounded page points, segment by segment. */+function pageRoute(graph: SceneGraph, connector: SceneNode) {+ const line = expectDefined(connectorSublayers(graph, connector)).line+ const network = expectDefined(line.vectorNetwork)+ const at = (index: number) => {+ const vertex = network.vertices[index]+ return [+ Math.round((connector.x + line.x + vertex.x) * 10) / 10,+ Math.round((connector.y + line.y + vertex.y) * 10) / 10+ ]+ }+ const round = ({ x, y }: Vector) => [Math.round(x * 10) / 10, Math.round(y * 10) / 10]+ return network.segments.map((segment) => [+ at(segment.start),+ at(segment.end),+ round(segment.tangentStart),+ round(segment.tangentEnd)+ ])+}diff --git a/packages/core/tests/editor/connectors/routing.test.ts b/packages/core/tests/editor/connectors/routing.test.tsnew file mode 100644index 000000000..fe7333ed4--- /dev/null+++ b/packages/core/tests/editor/connectors/routing.test.ts@@ -0,0 +1,407 @@+import { afterEach, beforeEach, describe, expect, test } from 'bun:test'++import { expectDefined } from '#core-tests/helpers/assert'++import { computeAllLayouts, setTextMeasurer } from '@open-pencil/core'+import { createEditor } from '@open-pencil/core/editor'+import {+ boundEndpoint,+ buildConnectorSublayers,+ connectorSublayers,+ freeEndpoint,+ SceneGraph+} from '@open-pencil/scene-graph'+import type { SceneNode } from '@open-pencil/scene-graph'++/** Two boxes 300 apart with an elbow from the first's right side to the second's left. */+function setup() {+ const editor = createEditor()+ const page = editor.state.currentPageId+ const from = editor.graph.createNode('RECTANGLE', page, { x: 0, y: 0, width: 100, height: 100 })+ const to = editor.graph.createNode('RECTANGLE', page, { x: 400, y: 0, width: 100, height: 100 })+ const connector = editor.graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(from.id),+ connectorEnd: boundEndpoint(to.id)+ })+ buildConnectorSublayers(editor.graph, connector)+ return { editor, page, from, to, connector }+}++/** The line's points in page coordinates. */+function route(editor: ReturnType<typeof createEditor>, connector: SceneNode): number[][] {+ const node = expectDefined(editor.graph.getNode(connector.id))+ const { line } = expectDefined(connectorSublayers(editor.graph, node))+ return (line.vectorNetwork?.vertices ?? []).map((vertex) => [+ node.x + line.x + vertex.x,+ node.y + line.y + vertex.y+ ])+}++const settle = () => Promise.resolve()++/** Where the connector's end sits, if it is free. */+function end(editor: ReturnType<typeof createEditor>, connector: SceneNode) {+ return editor.graph.getNode(connector.id)?.connectorEnd?.position+}++// A one-line label "Label" measures 41×24 in Inter Medium 16, as in FigJam.+beforeEach(() => setTextMeasurer(() => ({ width: 41, height: 24 })))+afterEach(() => setTextMeasurer(null))++describe('connector routing', () => {+ test('an edit to a bound layer routes the connector again, and undo routes it back', async () => {+ const { editor, from, to, connector } = setup()+ try {+ editor.updateNodeWithUndo(to.id, { y: 200 }, 'Move')+ await settle()+ expect(route(editor, connector)).toEqual([+ [106, 50],+ [250, 50],+ [250, 250],+ [393.5, 250]+ ])+ editor.undoAction()+ await settle()+ expect(route(editor, connector)).toEqual([+ [106, 50],+ [393.5, 50]+ ])+ editor.updateNodeWithUndo(from.id, { x: 200, y: -300 }, 'Move')+ await settle()+ expect(route(editor, connector)).toEqual([+ [250, -194],+ [250, -100],+ [450, -100],+ [450, -6.5]+ ])+ } finally {+ editor.dispose()+ }+ })++ test('a drag previews the route and a cancelled drag gives it back', async () => {+ const { editor, to, connector } = setup()+ try {+ editor.updateNodeWithUndo(to.id, { x: 400 }, 'Settle')+ await settle()+ const before = route(editor, connector)+ const preview = editor.beginNodePreview('Move')+ preview.update(to.id, { y: 200 })+ await settle()+ expect(route(editor, connector).at(-1)).toEqual([393.5, 250])+ preview.cancel()+ await settle()+ expect(route(editor, connector)).toEqual(before)+ } finally {+ editor.dispose()+ }+ })++ test('a route follows a layer inside a moved frame', async () => {+ const { editor, page, connector } = setup()+ try {+ const frame = editor.graph.createNode('FRAME', page, {+ x: 400,+ y: 0,+ width: 200,+ height: 200+ })+ const inner = editor.graph.createNode('RECTANGLE', frame.id, {+ x: 0,+ y: 0,+ width: 100,+ height: 100+ })+ editor.updateNodeWithUndo(connector.id, { connectorEnd: boundEndpoint(inner.id) }, 'Bind')+ await settle()+ expect(route(editor, connector).at(-1)).toEqual([393.5, 50])+ editor.updateNodeWithUndo(frame.id, { x: 600 }, 'Move')+ await settle()+ expect(route(editor, connector).at(-1)).toEqual([593.5, 50])+ } finally {+ editor.dispose()+ }+ })++ test('a free end stays where it is put', async () => {+ const { editor, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ // It leaves by the side nearest the point and bends midway, arriving along the longer axis.+ expect(route(editor, connector)).toEqual([+ [106, 50],+ [250, 50],+ [250, 300],+ [400, 300]+ ])+ } finally {+ editor.dispose()+ }+ })++ test('a connector moved as a whole takes its free ends along', async () => {+ const { editor, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ const moved = expectDefined(editor.graph.getNode(connector.id))+ editor.updateNodeWithUndo(connector.id, { x: moved.x + 50, y: moved.y + 20 }, 'Move')+ await settle()+ // The free end moves with the connector; the bound start goes back to its layer.+ expect(editor.graph.getNode(connector.id)?.connectorEnd?.position).toEqual({ x: 450, y: 320 })+ expect(route(editor, connector).at(0)).toEqual([106, 50])+ expect(route(editor, connector).at(-1)).toEqual([450, 320])+ // Undo puts the free end back with the connector, and redo carries it again.+ editor.undoAction()+ await settle()+ expect(editor.graph.getNode(connector.id)?.connectorEnd?.position).toEqual({ x: 400, y: 300 })+ expect(route(editor, connector).at(-1)).toEqual([400, 300])+ editor.redoAction()+ await settle()+ expect(editor.graph.getNode(connector.id)?.connectorEnd?.position).toEqual({ x: 450, y: 320 })+ } finally {+ editor.dispose()+ }+ })++ test('a move recorded as no step joins no other step with its carried ends', async () => {+ const { editor, from, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ editor.updateNodeWithUndo(from.id, { name: 'Renamed' }, 'Rename')+ const moved = expectDefined(editor.graph.getNode(connector.id))+ editor.graph.updateNode(connector.id, { x: moved.x + 50, y: moved.y + 20 })+ await settle()+ expect(editor.graph.getNode(connector.id)?.connectorEnd?.position).toEqual({ x: 450, y: 320 })+ // Undoing the rename leaves the carried end where the unrecorded move put it.+ editor.undoAction()+ await settle()+ expect(editor.graph.getNode(from.id)?.name).not.toBe('Renamed')+ expect(editor.graph.getNode(connector.id)?.connectorEnd?.position).toEqual({ x: 450, y: 320 })+ } finally {+ editor.dispose()+ }+ })++ test('nudging a connector carries its free end, and undo puts it back', async () => {+ const { editor, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ editor.select([connector.id])+ editor.nudgeSelected(1, 0)+ await settle()+ editor.nudgeSelected(1, 0)+ await settle()+ editor.flushNudge()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 402, y: 300 })+ editor.undoAction()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 400, y: 300 })+ expect(route(editor, connector).at(-1)).toEqual([400, 300])+ editor.redoAction()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 402, y: 300 })+ } finally {+ editor.dispose()+ }+ })++ test('a drag carries a free end once, however often it previews', async () => {+ const { editor, page, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ const { x, y } = expectDefined(editor.graph.getNode(connector.id))+ // As a drag does: each preview places the connector from where it started.+ for (const dx of [5, 10, 15]) {+ editor.graph.updateNodePositionPreview(connector.id, x + dx, y)+ await settle()+ }+ expect(end(editor, connector)).toEqual({ x: 415, y: 300 })+ expect(route(editor, connector).at(0)).toEqual([106, 50])+ expect(route(editor, connector).at(-1)).toEqual([415, 300])+ editor.undo.runBatch('Move', () => {+ editor.graph.updateNodePositionPreview(connector.id, x, y)+ editor.updateNode(connector.id, { x: x + 15, y })+ editor.commitMoveWithReparent(new Map([[connector.id, { x, y, parentId: page }]]))+ })+ await settle()+ expect(end(editor, connector)).toEqual({ x: 415, y: 300 })+ expect(route(editor, connector).at(0)).toEqual([106, 50])+ editor.undoAction()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 400, y: 300 })+ expect(route(editor, connector).at(-1)).toEqual([400, 300])+ editor.redoAction()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 415, y: 300 })+ } finally {+ editor.dispose()+ }+ })++ test('a previewed move carries free ends, and cancelling or undoing it puts them back', async () => {+ const { editor, connector } = setup()+ try {+ editor.updateNodeWithUndo(connector.id, { connectorEnd: freeEndpoint(400, 300) }, 'Free')+ await settle()+ const { x } = expectDefined(editor.graph.getNode(connector.id))+ const cancelled = editor.beginNodePreview('Move')+ cancelled.update(connector.id, { x: x + 10 })+ await settle()+ expect(end(editor, connector)).toEqual({ x: 410, y: 300 })+ cancelled.cancel()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 400, y: 300 })+ const committed = editor.beginNodePreview('Move')+ committed.update(connector.id, { x: x + 10 })+ await settle()+ committed.commit()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 410, y: 300 })+ editor.undoAction()+ await settle()+ expect(end(editor, connector)).toEqual({ x: 400, y: 300 })+ expect(route(editor, connector).at(-1)).toEqual([400, 300])+ } finally {+ editor.dispose()+ }+ })++ test('a label sits on its plate midway and the line breaks around it', async () => {+ const { editor, connector } = setup()+ try {+ const { label } = expectDefined(connectorSublayers(editor.graph, connector))+ editor.updateNodeWithUndo(label.id, { text: 'Label' }, 'Label')+ await settle()+ const parts = expectDefined(connectorSublayers(editor.graph, connector))+ const node = expectDefined(editor.graph.getNode(connector.id))+ expect([+ node.x + parts.labelBackground.x,+ node.y + parts.labelBackground.y,+ parts.labelBackground.width,+ parts.labelBackground.height,+ parts.labelBackground.visible+ ]).toEqual([220.75, 29.5, 58, 41, true])+ expect([node.x + parts.label.x, node.y + parts.label.y]).toEqual([229.25, 38])+ expect(route(editor, connector)).toEqual([+ [106, 50],+ [220.75, 50],+ [278.75, 50],+ [393.5, 50]+ ])+ expect(parts.line.vectorNetwork?.segments.map(({ start, end }) => [start, end])).toEqual([+ [0, 1],+ [2, 3]+ ])+ } finally {+ editor.dispose()+ }+ })++ test('deleting a layer deletes the connectors attached to it in the same undo step', () => {+ const { editor, page, from, connector } = setup()+ try {+ const other = editor.graph.createNode('CONNECTOR', page, {+ connectorStart: freeEndpoint(0, 0),+ connectorEnd: freeEndpoint(100, 100)+ })+ editor.select([from.id])+ editor.deleteSelected()+ expect(editor.graph.getNode(connector.id)).toBeUndefined()+ expect(editor.graph.getNode(other.id)).toBeDefined()+ editor.undoAction()+ expect(editor.graph.getNode(from.id)).toBeDefined()+ expect(editor.graph.getNode(connector.id)?.connectorStart?.nodeId).toBe(from.id)+ } finally {+ editor.dispose()+ }+ })++ test('a layer moved into another parent by reordering routes its connectors again', async () => {+ const { editor, page, to, connector } = setup()+ try {+ const frame = editor.graph.createNode('FRAME', page, {+ x: 0,+ y: 300,+ width: 600,+ height: 300+ })+ await settle()+ // Kept at the same place in its new parent, the layer now sits 300 lower on the page.+ editor.graph.insertChildAt(to.id, frame.id, 0)+ await settle()+ expect(route(editor, connector).at(-1)).toEqual([393.5, 350])+ } finally {+ editor.dispose()+ }+ })++ test('a locked layer that a delete leaves keeps its connectors', () => {+ const { editor, from, to, connector } = setup()+ try {+ editor.graph.updateNode(from.id, { locked: true })+ editor.select([from.id, to.id])+ editor.deleteSelected()+ expect(editor.graph.getNode(from.id)).toBeDefined()+ expect(editor.graph.getNode(to.id)).toBeUndefined()+ // The connector goes with the layer that was deleted, not the one that stays.+ expect(editor.graph.getNode(connector.id)).toBeUndefined()+ editor.undoAction()+ editor.select([from.id])+ editor.deleteSelected()+ expect(editor.graph.getNode(from.id)).toBeDefined()+ expect(editor.graph.getNode(connector.id)).toBeDefined()+ } finally {+ editor.dispose()+ }+ })++ test('a connector a file saved without a route is routed when shown, without an edit', () => {+ const graph = new SceneGraph()+ const page = graph.getPages()[0].id+ const from = graph.createNode('RECTANGLE', page, { x: 0, y: 0, width: 100, height: 100 })+ const to = graph.createNode('RECTANGLE', page, { x: 400, y: 0, width: 100, height: 100 })+ const connector = graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(from.id),+ connectorEnd: boundEndpoint(to.id)+ })+ // As read from a record with no derived data: the label has its text but not its size.+ buildConnectorSublayers(graph, connector, {+ label: { text: 'Label', width: 100, height: 100, textAutoResize: 'WIDTH_AND_HEIGHT' }+ })+ const editor = createEditor()+ try {+ editor.replaceGraph(graph)+ expect(route(editor, connector)).toEqual([+ [106, 50],+ [220.75, 50],+ [278.75, 50],+ [393.5, 50]+ ])+ const { label } = expectDefined(connectorSublayers(editor.graph, connector))+ expect([label.width, label.height]).toEqual([41, 24])+ expect(editor.undo.canUndo).toBe(false)+ } finally {+ editor.dispose()+ }+ })++ test('layout routes a connector with no route and keeps one that has a route', () => {+ const { editor, page, to, connector } = setup()+ try {+ computeAllLayouts(editor.graph, page)+ const routed = route(editor, connector)+ expect(routed.length).toBeGreaterThan(0)+ editor.graph.updateNode(to.id, { y: 200 })+ computeAllLayouts(editor.graph, page)+ expect(route(editor, connector)).toEqual(routed)+ } finally {+ editor.dispose()+ }+ })+})diff --git a/packages/fig/src/node-change/generated/connector.ts b/packages/fig/src/node-change/generated/connector.tsindex 90cbe31d8..ba037253b 100644--- a/packages/fig/src/node-change/generated/connector.ts+++ b/packages/fig/src/node-change/generated/connector.ts@@ -157,7 +157,8 @@ function sublayerProps(/*** Gives an imported CONNECTOR its line type, caps, and sublayers: the line as Figma last routed- * it, and its label on its plate. Its ends are linked once their layers exist.+ * it, and its label on its plate. Its ends are linked once their layers exist; one saved without a+ * route is routed by layout, once its label is measured.*/function readConnector(graph: SceneGraph,diff --git a/packages/scene-graph/AGENTS.md b/packages/scene-graph/AGENTS.mdindex 050255317..1424956f9 100644--- a/packages/scene-graph/AGENTS.md+++ b/packages/scene-graph/AGENTS.md@@ -9,7 +9,8 @@ Framework-neutral document model. Owns node types, primitives, geometry, matrice- Bounds accumulation goes through the helpers in `packages/scene-graph/src/geometry.ts` (`computeBounds`, `computeAbsoluteBounds`, `computeVisualBounds`); do not add another min/max loop.- Reparenting preserves child world positions; groups preserve them too. Sort children geometrically before creating auto-layout. Consumers such as layer trees must react to reparenting rather than retaining stale child references.- Use the copy helpers in `packages/scene-graph/src/copy.ts` for nested values (fills, strokes, effects); never hand-copy node properties.-- A generated frame (Figma's immutable frames such as `STICKY`) owns real child layers built from its template in `packages/scene-graph/src/generated/`; nothing adds, moves, or removes them (`slotScope` reports `locked`), and the layers panel lists the frame alone. Each type registers a `GeneratedFrameKind` in `GENERATED_FRAME_KINDS`, and the editor asks it (`layerRotates`, `layerResizes`, `generatedFrameText`) instead of testing node types (`packages/scene-graph/tests/generated/kind.test.ts`). A connector's ends name the layers they follow by ID; a transfer that leaves those layers behind keeps the IDs, and a reader that cannot find one leaves that end free where it was drawn (`packages/scene-graph/tests/generated/connector.test.ts`).+- A generated frame (Figma's immutable frames such as `STICKY` and `CONNECTOR`) owns real child layers built from its template in `packages/scene-graph/src/generated/` (a connector's in `packages/scene-graph/src/connectors/`); nothing adds, moves, or removes them (`slotScope` reports `locked`), and the layers panel lists the frame alone. Each type registers a `GeneratedFrameKind` in `GENERATED_FRAME_KINDS`, and the editor asks it (`layerRotates`, `layerResizes`, `generatedFrameText`) instead of testing node types (`packages/scene-graph/tests/generated/kind.test.ts`). A connector's ends name the layers they follow by ID; a transfer that leaves those layers behind keeps the IDs, and a reader that cannot find one leaves that end free where it was drawn (`packages/scene-graph/tests/connectors/endpoints.test.ts`).+- A connector's route derives from the layers its ends follow: `routeConnector` routes as FigJam does and `layoutConnector` lays the line, label plate, and label out to match. Core's editor routes again when those layers change, during previews too, and deletes connectors with the layers they attach to; loading a document keeps the routes it saved, and one saved without a route is routed by layout or when its page is shown, once its label is measured (`packages/scene-graph/tests/connectors/route.test.ts` against recorded Figma routes, `packages/core/tests/editor/connectors/routing.test.ts`).- Instance children map to component children through `componentId`; runtime overrides use the structured `InstanceOverrideState` (`self` and `descendants` maps) in `packages/scene-graph/src/instance-overrides.ts`.- A bound numeric field records its unit conversion in `variableBindingScales`; preserve it through clone, copy, and transfer so a binding keeps meaning in its new scope. Core reconciles bindings and layout together in `packages/core/src/layout/variables.ts`, which the editor and the Figma API both call rather than reimplementing.- `componentScale` records an occurrence's coordinates relative to its component definition. Shared rescaling lives in `packages/scene-graph/src/scaling/`; Core's Figma API delegates there instead of scaling nodes itself.diff --git a/packages/scene-graph/src/connectors/elbow.ts b/packages/scene-graph/src/connectors/elbow.tsnew file mode 100644index 000000000..f77c24653--- /dev/null+++ b/packages/scene-graph/src/connectors/elbow.ts@@ -0,0 +1,235 @@+import type { Rect, Vector } from '../primitives'+import { along, EPSILON, straightPieces, type ConnectorPiece } from './pieces'+import {+ attachment,+ opposite,+ OUTWARD,+ SIDES,+ type ConnectorRouteEnd,+ type ConnectorSide+} from './sides'++/** How far an elbow runs out of a layer before it may turn, unless the layers are closer. */+const ELBOW_STUB = 48+/** What a turn costs against length, so that of two equally long routes the simpler wins. */+const BEND_COST = 1+/** What a run off the line midway between the layers costs, so turns land on that line. */+const OFF_MIDLINE_COST = 0.01++const DIRECTIONS: readonly Vector[] = SIDES.map((side) => OUTWARD[side])++/** How far `other` lies past `box`'s `side`: negative when it is not ahead of that side. */+function gapTowards(box: Rect, other: Rect, side: ConnectorSide): number {+ const { x, y } = OUTWARD[side]+ if (x > 0) return other.x - (box.x + box.width)+ if (x < 0) return box.x - (other.x + other.width)+ if (y > 0) return other.y - (box.y + box.height)+ return box.y - (other.y + other.height)+}++/** How far an elbow runs out of `box` by `side` before turning: its stub, or half the gap. */+function stubLength(box: Rect, other: Rect, side: ConnectorSide): number {+ const gap = gapTowards(box, other, side)+ return gap > 0 ? Math.min(ELBOW_STUB, gap / 2) : ELBOW_STUB+}++/** The line midway between two boxes along one axis, when they do not overlap on it. */+function midline(a0: number, a1: number, b0: number, b1: number): number | null {+ if (a1 < b0) return (a1 + b0) / 2+ if (b1 < a0) return (b1 + a0) / 2+ return null+}++function crossesBox(from: Vector, to: Vector, box: Rect | null): boolean {+ if (!box) return false+ const x0 = Math.min(from.x, to.x)+ const x1 = Math.max(from.x, to.x)+ const y0 = Math.min(from.y, to.y)+ const y1 = Math.max(from.y, to.y)+ return x1 > box.x && x0 < box.x + box.width && y1 > box.y && y0 < box.y + box.height+}++function asBox(end: ConnectorRouteEnd): Rect {+ return end.box ?? { x: end.point.x, y: end.point.y, width: 0, height: 0 }+}++/**+ * The candidate lines an elbow may run on: the stubs' ends, the boxes' centres, lines a stub's+ * length outside each box, and the lines midway between the boxes.+ */+interface Grid {+ xs: number[]+ ys: number[]+ midX: number | null+ midY: number | null+ from: Vector+ to: Vector+ obstacles: (Rect | null)[]+}++function elbowGrid(+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd,+ startSide: ConnectorSide,+ endSide: ConnectorSide+): Grid {+ const a = asBox(start)+ const b = asBox(end)+ const startStub = start.box ? stubLength(a, b, startSide) : 0+ const endStub = end.box ? stubLength(b, a, endSide) : 0+ const from = along(attachment(start, startSide), OUTWARD[startSide], startStub)+ const to = along(attachment(end, endSide), OUTWARD[endSide], endStub)+ const midX = midline(a.x, a.x + a.width, b.x, b.x + b.width)+ const midY = midline(a.y, a.y + a.height, b.y, b.y + b.height)+ const xs = new Set([from.x, to.x])+ const ys = new Set([from.y, to.y])+ for (const box of [start.box, end.box]) {+ if (!box) continue+ xs.add(box.x - ELBOW_STUB)+ .add(box.x + box.width + ELBOW_STUB)+ .add(box.x + box.width / 2)+ ys.add(box.y - ELBOW_STUB)+ .add(box.y + box.height + ELBOW_STUB)+ .add(box.y + box.height / 2)+ }+ if (midX !== null) xs.add(midX)+ if (midY !== null) ys.add(midY)+ return {+ xs: [...xs].sort((p, q) => p - q),+ ys: [...ys].sort((p, q) => p - q),+ midX,+ midY,+ from,+ to,+ obstacles: [start.box, end.box]+ }+}++interface GridState {+ cost: number+ /** Breaks ties between equal routes towards larger coordinates, as Figma goes round below. */+ tie: number+ i: number+ j: number+ direction: number+ previous: GridState | null+}++function cheaper(a: Pick<GridState, 'cost' | 'tie'>, b: Pick<GridState, 'cost' | 'tie'>): boolean {+ return a.cost < b.cost - EPSILON || (Math.abs(a.cost - b.cost) <= EPSILON && a.tie < b.tie)+}++function popCheapest(open: GridState[]): GridState {+ let index = 0+ for (let n = 1; n < open.length; n++) if (cheaper(open[n], open[index])) index = n+ return open.splice(index, 1)[0]+}++/** The states one run along a grid line away, that do not cross either box. */+function stepsFrom(grid: Grid, state: GridState): GridState[] {+ const steps: GridState[] = []+ for (let direction = 0; direction < 4; direction++) {+ if (direction === (state.direction + 2) % 4) continue+ const step = DIRECTIONS[direction]+ const i = state.i + Math.sign(step.x)+ const j = state.j + Math.sign(step.y)+ if (i < 0 || j < 0 || i >= grid.xs.length || j >= grid.ys.length) continue+ const p = { x: grid.xs[state.i], y: grid.ys[state.j] }+ const q = { x: grid.xs[i], y: grid.ys[j] }+ if (grid.obstacles.some((box) => crossesBox(p, q, box))) continue+ const length = Math.abs(q.x - p.x) + Math.abs(q.y - p.y)+ const onMidline = step.x === 0 ? q.x === grid.midX : q.y === grid.midY+ const turn = direction === state.direction ? 0 : BEND_COST+ steps.push({+ cost: state.cost + length + turn + (onMidline ? 0 : OFF_MIDLINE_COST),+ tie: state.tie - (step.x === 0 ? q.x : q.y) * length,+ i,+ j,+ direction,+ previous: state+ })+ }+ return steps+}++/** The cheapest walk on the grid from the start stub to the end stub, entering it head on. */+function cheapestWalk(grid: Grid, startSide: ConnectorSide, endSide: ConnectorSide) {+ const target = { i: grid.xs.indexOf(grid.to.x), j: grid.ys.indexOf(grid.to.y) }+ const arrival = SIDES.indexOf(opposite(endSide))+ const key = (state: GridState) => (state.i * grid.ys.length + state.j) * 4 + state.direction+ const best = new Map<number, GridState>()+ const open: GridState[] = []+ const offer = (state: GridState) => {+ const known = best.get(key(state))+ if (known && !cheaper(state, known)) return+ best.set(key(state), state)+ open.push(state)+ }+ offer({+ cost: 0,+ tie: 0,+ i: grid.xs.indexOf(grid.from.x),+ j: grid.ys.indexOf(grid.from.y),+ direction: SIDES.indexOf(startSide),+ previous: null+ })+ let done: GridState | null = null+ while (open.length > 0) {+ const state = popCheapest(open)+ if (best.get(key(state)) !== state) continue+ if (done && state.cost > done.cost + EPSILON) break+ if (state.i === target.i && state.j === target.j) {+ // Entering the end's stub from aside costs one more turn.+ const arrived = { ...state, cost: state.cost + (state.direction === arrival ? 0 : BEND_COST) }+ if (!done || cheaper(arrived, done)) done = arrived+ continue+ }+ for (const next of stepsFrom(grid, state)) offer(next)+ }+ return done+}++/** Drops repeated points and points in the middle of a straight run. */+function simplify(points: Vector[]): Vector[] {+ const result: Vector[] = []+ const same = (a: number, b: number) => Math.abs(a - b) < EPSILON+ for (const point of points) {+ const last = result.at(-1)+ if (last && same(last.x, point.x) && same(last.y, point.y)) continue+ const before = result.at(-2)+ if (+ before &&+ last &&+ ((same(before.x, last.x) && same(last.x, point.x)) ||+ (same(before.y, last.y) && same(last.y, point.y)))+ ) {+ result.pop()+ }+ result.push(point)+ }+ return result+}++/**+ * An elbow between two ends: the shortest route on the grid that avoids both layers, turns+ * penalised and placed midway between the layers where they can be, from the start's gap point to+ * the end's. Null when no route avoids the layers.+ */+export function elbowRoute(+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd,+ sides: [ConnectorSide, ConnectorSide],+ gaps: [number, number]+): ConnectorPiece[] | null {+ const [startSide, endSide] = sides+ const grid = elbowGrid(start, end, startSide, endSide)+ const walk = cheapestWalk(grid, startSide, endSide)+ if (!walk) return null+ const turns: Vector[] = []+ for (let state: GridState | null = walk; state; state = state.previous) {+ turns.unshift({ x: grid.xs[state.i], y: grid.ys[state.j] })+ }+ const from = along(attachment(start, startSide), OUTWARD[startSide], gaps[0])+ const to = along(attachment(end, endSide), OUTWARD[endSide], gaps[1])+ return straightPieces(simplify([from, ...turns, to]))+}diff --git a/packages/scene-graph/src/connectors/gaps.ts b/packages/scene-graph/src/connectors/gaps.tsnew file mode 100644index 000000000..3f9548c04--- /dev/null+++ b/packages/scene-graph/src/connectors/gaps.ts@@ -0,0 +1,72 @@+import type { StrokeCap } from '../types'+import type { ConnectorRouteEnd } from './sides'++type GapTable = readonly (readonly [number, number])[]++const ROUND_GAP: GapTable = [+ [1, 3],+ [2, 3.5],+ [4, 6],+ [8, 10.5]+]+const ARROW_LINES_GAP: GapTable = [+ [1, 3],+ [2, 3.5],+ [4, 6.5],+ [8, 10.5]+]+const TRIANGLE_GAP: GapTable = [+ [1, 3],+ [4, 4.5],+ [8, 6.5]+]+const ON_EDGE: GapTable = [[1, 0]]++/**+ * How far a bound end stops short of its layer, by cap and stroke weight; heavier strokes keep the+ * last gap. Diamonds and circles sit on the layer's edge. The equilateral arrow's gap barely+ * changes, and differs slightly between the start and the end.+ */+const CAP_GAPS: Record<StrokeCap, { start: GapTable; end: GapTable }> = {+ NONE: { start: ROUND_GAP, end: ROUND_GAP },+ ROUND: { start: ROUND_GAP, end: ROUND_GAP },+ SQUARE: { start: ROUND_GAP, end: ROUND_GAP },+ ARROW_LINES: { start: ARROW_LINES_GAP, end: ARROW_LINES_GAP },+ ARROW_EQUILATERAL: {+ start: [[1, 3.25]],+ end: [+ [1, 2.75],+ [4, 3.34],+ [8, 3.39]+ ]+ },+ TRIANGLE_FILLED: { start: TRIANGLE_GAP, end: TRIANGLE_GAP },+ DIAMOND_FILLED: { start: ON_EDGE, end: ON_EDGE },+ CIRCLE_FILLED: { start: ON_EDGE, end: ON_EDGE }+}++function interpolate(table: GapTable, x: number): number {+ const [firstX, firstY] = table[0]+ if (x <= firstX) return firstY+ for (let i = 1; i < table.length; i++) {+ const [x1, y1] = table[i]+ if (x <= x1) {+ const [x0, y0] = table[i - 1]+ return y0 + ((y1 - y0) * (x - x0)) / (x1 - x0)+ }+ }+ return table[table.length - 1][1]+}++/**+ * How far a bound end stops short of its layer's box, so its cap does not touch the layer: the+ * cap's gap past the layer's outline, except for caps that sit on the edge.+ */+export function connectorEndGap(+ end: Pick<ConnectorRouteEnd, 'cap' | 'outline'>,+ strokeWeight: number,+ at: 'start' | 'end'+): number {+ const gap = interpolate(CAP_GAPS[end.cap][at], strokeWeight)+ return gap > 0 ? gap + end.outline : 0+}diff --git a/packages/scene-graph/src/connectors/hit.ts b/packages/scene-graph/src/connectors/hit.tsnew file mode 100644index 000000000..67a2c0c13--- /dev/null+++ b/packages/scene-graph/src/connectors/hit.ts@@ -0,0 +1,60 @@+import { getWorldMatrix } from '../coordinate'+import type { SceneGraph } from '../index'+import Matrix from '../matrix'+import type { Vector } from '../primitives'+import type { SceneNode } from '../types'+import { isStraight, pointAt, type ConnectorPiece } from './pieces'+import { connectorSublayers } from './sublayers'++/** How far from a line, beyond half its stroke, a point still lands on it, in canvas units. */+const CONNECTOR_HIT_SLOP = 4+/** Points sampled along a curved segment to measure distance to it. */+const CURVE_SAMPLES = 24++function distanceToSegment(p: Vector, a: Vector, b: Vector): number {+ const dx = b.x - a.x+ const dy = b.y - a.y+ const lengthSquared = dx * dx + dy * dy+ const t =+ lengthSquared === 0+ ? 0+ : Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / lengthSquared))+ return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy))+}++/**+ * Whether a canvas point lands on a connector's line: within half its stroke and a few units of+ * slop, plus `pad`. A connector is picked by its line, not by the box around its route.+ */+export function hitsConnectorLine(+ graph: SceneGraph,+ connector: SceneNode,+ px: number,+ py: number,+ pad = 0+): boolean {+ const line = connectorSublayers(graph, connector)?.line+ const network = line?.vectorNetwork+ if (!line || !network) return false+ const inverse = Matrix.invert(getWorldMatrix(line, graph))+ if (!inverse) return false+ const [x, y] = Matrix.mapPoints(inverse, [px, py])+ const point = { x, y }+ const reach = (line.strokes[0]?.weight ?? line.strokeWeight) / 2 + CONNECTOR_HIT_SLOP + pad+ return network.segments.some((segment) => {+ const piece: ConnectorPiece = {+ from: network.vertices[segment.start],+ to: network.vertices[segment.end],+ handleFrom: segment.tangentStart,+ handleTo: segment.tangentEnd+ }+ if (isStraight(piece)) return distanceToSegment(point, piece.from, piece.to) <= reach+ let previous = piece.from+ for (let step = 1; step <= CURVE_SAMPLES; step++) {+ const current = pointAt(piece, step / CURVE_SAMPLES)+ if (distanceToSegment(point, previous, current) <= reach) return true+ previous = current+ }+ return false+ })+}diff --git a/packages/scene-graph/src/connectors/index.ts b/packages/scene-graph/src/connectors/index.tsnew file mode 100644index 000000000..1fb3ff8e2--- /dev/null+++ b/packages/scene-graph/src/connectors/index.ts@@ -0,0 +1,8 @@+export { hitsConnectorLine } from './hit'+export { CONNECTOR_LABEL_PADDING, placeConnectorLabel, type ConnectorLabelLayout } from './label'+export { attachedConnectors, layoutConnector } from './layout'+export { connectorEndGap } from './gaps'+export { connectorNetwork, type ConnectorPiece } from './pieces'+export { routeConnector } from './route'+export { connectorSides, type ConnectorRouteEnd, type ConnectorSide } from './sides'+export * from './sublayers'diff --git a/packages/scene-graph/src/connectors/label.ts b/packages/scene-graph/src/connectors/label.tsnew file mode 100644index 000000000..dc5414765--- /dev/null+++ b/packages/scene-graph/src/connectors/label.ts@@ -0,0 +1,80 @@+import type { Rect, Vector } from '../primitives'+import {+ EPSILON,+ exitPoint,+ isStraight,+ pieceLength,+ pointAt,+ subPiece,+ type ConnectorPiece+} from './pieces'++/** How far a label's plate reaches past its text. */+export const CONNECTOR_LABEL_PADDING = 8.5++function insideRect(point: Vector, rect: Rect): boolean {+ return (+ point.x > rect.x + EPSILON &&+ point.x < rect.x + rect.width - EPSILON &&+ point.y > rect.y + EPSILON &&+ point.y < rect.y + rect.height - EPSILON+ )+}++/** Where a piece running from inside `rect` at `inside` towards `outside` leaves it. */+function crossing(piece: ConnectorPiece, rect: Rect, inside: number, outside: number): number {+ const end = pointAt(piece, outside)+ if (insideRect(end, rect)) return outside+ if (isStraight(piece)) {+ const start = pointAt(piece, inside)+ const exit = exitPoint(rect, start, end)+ const share = Math.hypot(exit.x - start.x, exit.y - start.y) / pieceLength(piece)+ return inside + Math.sign(outside - inside) * share+ }+ let low = inside+ let high = outside+ for (let step = 0; step < 40; step++) {+ const t = (low + high) / 2+ if (insideRect(pointAt(piece, t), rect)) low = t+ else high = t+ }+ return high+}++/** A connector's label plate and the line with the plate's span cut out. */+export interface ConnectorLabelLayout {+ pieces: ConnectorPiece[]+ plate: Rect+}++/**+ * Places a label's plate on a route and cuts the line where it sits: midway along a straight or+ * curved line, and midway along an elbow's longest run, the first of equal runs.+ */+export function placeConnectorLabel(+ pieces: ConnectorPiece[],+ plateSize: { width: number; height: number }+): ConnectorLabelLayout | null {+ if (pieces.length === 0) return null+ let index = 0+ for (let n = 1; n < pieces.length; n++) {+ if (pieceLength(pieces[n]) > pieceLength(pieces[index]) + EPSILON) index = n+ }+ const piece = pieces[index]+ const middle = pointAt(piece, 0.5)+ const plate = {+ x: middle.x - plateSize.width / 2,+ y: middle.y - plateSize.height / 2,+ width: plateSize.width,+ height: plateSize.height+ }+ // A line between touching layers has no length to cut; it keeps its one point.+ if (pieceLength(piece) <= EPSILON) return { pieces, plate }+ const t0 = crossing(piece, plate, 0.5, 0)+ const t1 = crossing(piece, plate, 0.5, 1)+ const cut = [+ ...(t0 > EPSILON ? [subPiece(piece, 0, t0)] : []),+ ...(t1 < 1 - EPSILON ? [subPiece(piece, t1, 1)] : [])+ ]+ return { pieces: [...pieces.slice(0, index), ...cut, ...pieces.slice(index + 1)], plate }+}diff --git a/packages/scene-graph/src/connectors/layout.ts b/packages/scene-graph/src/connectors/layout.tsnew file mode 100644index 000000000..20f0b8a90--- /dev/null+++ b/packages/scene-graph/src/connectors/layout.ts@@ -0,0 +1,190 @@+import { compact, isEqual, pick } from 'es-toolkit'++import { getAxisAlignedBoundsInParent, getParentWorldMatrix, getWorldMatrix } from '../coordinate'+import { computeBounds } from '../geometry'+import type { SceneGraph } from '../index'+import Matrix from '../matrix'+import type { Vector } from '../primitives'+import type { ConnectorEndpoint, SceneNode, StrokeCap } from '../types'+import { CONNECTOR_LABEL_PADDING, placeConnectorLabel, type ConnectorLabelLayout } from './label'+import { connectorNetwork, piecesBounds, type ConnectorPiece } from './pieces'+import { routeConnector } from './route'+import type { ConnectorRouteEnd } from './sides'+import { connectorSublayers, type ConnectorSublayers } from './sublayers'++/**+ * An end as the router sees it, in the connector's parent's axes: the box of the layer it follows+ * by a magnet, or a point. An end whose layer is gone stays where its route last ended.+ */+function routeEnd(+ graph: SceneGraph,+ connector: SceneNode,+ endpoint: ConnectorEndpoint,+ cap: StrokeCap,+ fallback: Vector | undefined+): ConnectorRouteEnd | null {+ const parentId = connector.parentId+ if (!parentId) return null+ const node = endpoint.nodeId ? graph.getNode(endpoint.nodeId) : undefined+ if (!node) {+ if (endpoint.nodeId && !fallback) return null+ const point = endpoint.nodeId && fallback ? fallback : endpoint.position+ return { box: null, point, magnet: 'NONE', cap, outline: 0 }+ }+ if (endpoint.magnet === 'NONE') {+ // A point in the layer's own axes, carried into the connector's parent's.+ const toParent =+ Matrix.invert(getParentWorldMatrix(graph.getNode(parentId), graph)) ?? Matrix.identity()+ const [x, y] = Matrix.mapPoints(Matrix.multiply(toParent, getWorldMatrix(node, graph)), [+ endpoint.position.x,+ endpoint.position.y+ ])+ return { box: null, point: { x, y }, magnet: 'NONE', cap, outline: 0 }+ }+ return {+ box: getAxisAlignedBoundsInParent([node], parentId, graph),+ point: { x: 0, y: 0 },+ magnet: endpoint.magnet,+ cap,+ // FigJam keeps connectors clear of a shape's stroke, centred on its edge, hidden or not; a+ // shape with no stroke, or another layer's stroke, does not count.+ outline: node.type === 'SHAPE_WITH_TEXT' && node.strokes.length > 0 ? node.strokeWeight / 2 : 0+ }+}++/** Writes only the fields that differ, so a route that did not move changes nothing. */+function changesFor(node: SceneNode, changes: Partial<SceneNode>): Partial<SceneNode> | null {+ const differing = Object.fromEntries(+ Object.entries(changes).filter(([key, value]) => !isEqual(node[key as keyof SceneNode], value))+ ) as Partial<SceneNode>+ return Object.keys(differing).length > 0 ? differing : null+}++type Write = [SceneNode, Partial<SceneNode>]++/**+ * Where the connector, its line, and its label go for a route with the label placed on it. A+ * connector that keeps its box places its line and label inside the box it has.+ */+function routeWrites(+ connector: SceneNode,+ { line, label, labelBackground }: ConnectorSublayers,+ pieces: ConnectorPiece[],+ placed: ConnectorLabelLayout | null,+ keepBox: boolean+): Write[] | null {+ const lineBox = pieces.length > 0 ? piecesBounds(pieces) : null+ const boxes = compact([lineBox, placed?.plate])+ if (boxes.length === 0) return null+ const bounds = computeBounds(boxes)+ const frame = keepBox ? connector : bounds+ const lineOrigin = lineBox ?? bounds+ const writes: Write[] = [+ [connector, keepBox ? {} : pick(frame, ['x', 'y', 'width', 'height'])],+ [+ line,+ {+ x: lineOrigin.x - frame.x,+ y: lineOrigin.y - frame.y,+ width: lineOrigin.width,+ height: lineOrigin.height,+ vectorNetwork: connectorNetwork(pieces, lineOrigin, {+ start: connector.connectorStartCap,+ end: connector.connectorEndCap+ })+ }+ ]+ ]+ if (!placed)+ return [...writes, [labelBackground, { visible: false }], [label, { visible: false }]]+ const x = placed.plate.x - frame.x+ const y = placed.plate.y - frame.y+ const { width, height } = placed.plate+ return [+ ...writes,+ [labelBackground, { x, y, width, height, visible: true }],+ [label, { x: x + CONNECTOR_LABEL_PADDING, y: y + CONNECTOR_LABEL_PADDING, visible: true }]+ ]+}++/** Where a connector's line last started or ended, for an end whose layer is gone. */+function lastRoutePoint(connector: SceneNode, line: SceneNode, index: 0 | -1): Vector | undefined {+ const vertex = line.vectorNetwork?.vertices.at(index)+ return vertex && { x: connector.x + line.x + vertex.x, y: connector.y + line.y + vertex.y }+}++/**+ * Routes a connector again from the layers its ends follow and lays out its line, label plate,+ * and label to match, through `update` so the caller decides whether that is an edit or a+ * preview. Returns whether anything moved. A connector with an end that cannot be placed keeps+ * its route. With `keepBox`, the connector keeps its own position and size, as while a move+ * previews.+ */+export function layoutConnector(+ graph: SceneGraph,+ connector: SceneNode,+ update: (id: string, changes: Partial<SceneNode>) => void = (id, changes) =>+ graph.updateNode(id, changes),+ { keepBox = false }: { keepBox?: boolean } = {}+): boolean {+ const parts = connectorSublayers(graph, connector)+ const { connectorStart, connectorEnd } = connector+ if (!parts || !connectorStart || !connectorEnd) return false+ const { line, label } = parts+ const start = routeEnd(+ graph,+ connector,+ connectorStart,+ connector.connectorStartCap,+ lastRoutePoint(connector, line, 0)+ )+ const end = routeEnd(+ graph,+ connector,+ connectorEnd,+ connector.connectorEndCap,+ lastRoutePoint(connector, line, -1)+ )+ if (!start || !end) return false+ const weight = line.strokes[0]?.weight ?? line.strokeWeight+ const pieces = routeConnector(connector.connectorLineType, start, end, weight)+ const placed = label.text+ ? placeConnectorLabel(pieces, {+ width: label.width + CONNECTOR_LABEL_PADDING * 2,+ height: label.height + CONNECTOR_LABEL_PADDING * 2+ })+ : null+ const writes = routeWrites(connector, parts, placed?.pieces ?? pieces, placed, keepBox)+ let moved = false+ // A route derives from its ends, so laying it out is layout rather than an edit, as moving the+ // connector it fits is not.+ graph.withLayoutMutations(() => {+ for (const [node, changes] of writes ?? []) {+ const differing = changesFor(node, changes)+ if (!differing) continue+ update(node.id, differing)+ moved = true+ }+ })+ return moved+}++/** Whether `id` is one of `ids` or lies inside one of them. */+function withinAny(graph: SceneGraph, id: string, ids: ReadonlySet<string>): boolean {+ return graph.closest(id, (node) => ids.has(node.id)) !== undefined+}++/**+ * The connectors with an end on one of `ids` or a layer inside them, which go when those layers+ * are deleted, as in FigJam. Connectors inside `ids` themselves are left out.+ */+export function attachedConnectors(graph: SceneGraph, ids: Iterable<string>): SceneNode[] {+ const roots = new Set(ids)+ const attached: SceneNode[] = []+ for (const node of graph.getAllNodes()) {+ if (node.type !== 'CONNECTOR' || withinAny(graph, node.id, roots)) continue+ const ends = [node.connectorStart?.nodeId, node.connectorEnd?.nodeId]+ if (ends.some((id) => id && withinAny(graph, id, roots))) attached.push(node)+ }+ return attached+}diff --git a/packages/scene-graph/src/connectors/pieces.ts b/packages/scene-graph/src/connectors/pieces.tsnew file mode 100644index 000000000..b9fccc6d0--- /dev/null+++ b/packages/scene-graph/src/connectors/pieces.ts@@ -0,0 +1,144 @@+import { computeBounds } from '../geometry'+import type { Rect, Vector } from '../primitives'+import type { StrokeCap, VectorNetwork } from '../types'++/** One piece of a route: a straight run when both handles are zero, else a cubic. */+export interface ConnectorPiece {+ from: Vector+ to: Vector+ handleFrom: Vector+ handleTo: Vector+}++export const ZERO: Vector = { x: 0, y: 0 }+export const EPSILON = 1e-6+/** Points sampled along a curved piece to bound it. */+const CURVE_BOUND_SAMPLES = 16++export function along(point: Vector, direction: Vector, distance: number): Vector {+ return { x: point.x + direction.x * distance, y: point.y + direction.y * distance }+}++export function isStraight(piece: ConnectorPiece): boolean {+ const { handleFrom: h0, handleTo: h1 } = piece+ return h0.x === 0 && h0.y === 0 && h1.x === 0 && h1.y === 0+}++export function straightPieces(points: Vector[]): ConnectorPiece[] {+ return points+ .slice(1)+ .map((to, index) => ({ from: points[index], to, handleFrom: ZERO, handleTo: ZERO }))+}++export function pieceLength(piece: ConnectorPiece): number {+ return Math.hypot(piece.to.x - piece.from.x, piece.to.y - piece.from.y)+}++function controls(piece: ConnectorPiece): [Vector, Vector] {+ const { from: a, to: b } = piece+ return [+ { x: a.x + piece.handleFrom.x, y: a.y + piece.handleFrom.y },+ { x: b.x + piece.handleTo.x, y: b.y + piece.handleTo.y }+ ]+}++/** The point at `t` along a piece; a straight run is parametrised by length. */+export function pointAt(piece: ConnectorPiece, t: number): Vector {+ const { from: a, to: b } = piece+ if (isStraight(piece)) return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t }+ const [c1, c2] = controls(piece)+ const u = 1 - t+ return {+ x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x,+ y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y+ }+}++function derivativeAt(piece: ConnectorPiece, t: number): Vector {+ const { from: a, to: b } = piece+ const [c1, c2] = controls(piece)+ const u = 1 - t+ return {+ x: 3 * u * u * (c1.x - a.x) + 6 * u * t * (c2.x - c1.x) + 3 * t * t * (b.x - c2.x),+ y: 3 * u * u * (c1.y - a.y) + 6 * u * t * (c2.y - c1.y) + 3 * t * t * (b.y - c2.y)+ }+}++/** The part of a piece from `t0` to `t1`, its handles as de Casteljau splits them. */+export function subPiece(piece: ConnectorPiece, t0: number, t1: number): ConnectorPiece {+ const from = pointAt(piece, t0)+ const to = pointAt(piece, t1)+ if (isStraight(piece)) return { from, to, handleFrom: ZERO, handleTo: ZERO }+ const span = (t1 - t0) / 3+ const d0 = derivativeAt(piece, t0)+ const d1 = derivativeAt(piece, t1)+ return {+ from,+ to,+ handleFrom: { x: d0.x * span, y: d0.y * span },+ handleTo: { x: -d1.x * span, y: -d1.y * span }+ }+}++/** Where the ray from `from`, inside `box`, towards `toward` leaves it. */+export function exitPoint(box: Rect, from: Vector, toward: Vector): Vector {+ const dx = toward.x - from.x+ const dy = toward.y - from.y+ const tx = dx === 0 ? Infinity : ((dx > 0 ? box.x + box.width : box.x) - from.x) / dx+ const ty = dy === 0 ? Infinity : ((dy > 0 ? box.y + box.height : box.y) - from.y) / dy+ const t = Math.max(0, Math.min(tx, ty, 1))+ return { x: from.x + dx * t, y: from.y + dy * t }+}++/** The box a route's pieces cover, curves sampled along their length. */+export function piecesBounds(pieces: ConnectorPiece[]): Rect {+ const points: Rect[] = []+ for (const piece of pieces) {+ const samples = isStraight(piece) ? 1 : CURVE_BOUND_SAMPLES+ for (let step = 0; step <= samples; step++) {+ points.push({ ...pointAt(piece, step / samples), width: 0, height: 0 })+ }+ }+ return computeBounds(points)+}++/**+ * A route as a vector network: pieces that meet share a vertex, so elbows round their corners,+ * and a cut leaves two runs. The first and last vertices carry the connector's caps, as Figma+ * stores them.+ */+export function connectorNetwork(+ pieces: ConnectorPiece[],+ origin: Vector,+ caps: { start: StrokeCap; end: StrokeCap }+): VectorNetwork {+ const network: VectorNetwork = { vertices: [], segments: [], regions: [] }+ const vertexAt = (point: Vector) => {+ const last = network.vertices.at(-1)+ const x = point.x - origin.x+ const y = point.y - origin.y+ if (last && Math.abs(last.x - x) < EPSILON && Math.abs(last.y - y) < EPSILON) {+ return network.vertices.length - 1+ }+ network.vertices.push({ x, y })+ return network.vertices.length - 1+ }+ for (const piece of pieces) {+ const start = vertexAt(piece.from)+ const end = vertexAt(piece.to)+ if (start === end) continue+ network.segments.push({+ start,+ end,+ tangentStart: { ...piece.handleFrom },+ tangentEnd: { ...piece.handleTo }+ })+ }+ const first = network.vertices.at(0)+ const last = network.vertices.at(-1)+ if (first && last && first !== last) {+ first.strokeCap = caps.start+ last.strokeCap = caps.end+ }+ return network+}diff --git a/packages/scene-graph/src/connectors/route.ts b/packages/scene-graph/src/connectors/route.tsnew file mode 100644index 000000000..e1402f574--- /dev/null+++ b/packages/scene-graph/src/connectors/route.ts@@ -0,0 +1,121 @@+import type { Rect, Vector } from '../primitives'+import type { ConnectorLineType } from '../types'+import { elbowRoute } from './elbow'+import { connectorEndGap } from './gaps'+import { along, EPSILON, exitPoint, straightPieces, ZERO, type ConnectorPiece } from './pieces'+import {+ attachment,+ connectorSides,+ opposite,+ OUTWARD,+ sideMidpoint,+ sidesFor,+ type ConnectorRouteEnd,+ type ConnectorSide+} from './sides'++/**+ * Connector routing as FigJam routes, checked against routes Figma derived+ * (`packages/scene-graph/tests/connectors/figma-routes.json`).+ */++/** Curve handles as a share of the distance between the two edge points. */+const CURVE_HANDLE_RATIO = 0.42667++/** Whether two boxes share more than a corner: they overlap, or meet along an edge. */+function touches(a: Rect, b: Rect): boolean {+ const meetX = a.x <= b.x + b.width && b.x <= a.x + a.width+ const meetY = a.y <= b.y + b.height && b.y <= a.y + a.height+ const overlapX = a.x < b.x + b.width && b.x < a.x + a.width+ const overlapY = a.y < b.y + b.height && b.y < a.y + a.height+ return (overlapX && meetY) || (meetX && overlapY)+}++function unit(from: Vector, to: Vector): Vector {+ const length = Math.hypot(to.x - from.x, to.y - from.y)+ return length === 0 ? ZERO : { x: (to.x - from.x) / length, y: (to.y - from.y) / length }+}++/** Where a straight connector's end sits: its side midpoint, or the centre of its layer. */+function straightAnchor(end: ConnectorRouteEnd): Vector {+ const { box } = end+ if (!box) return end.point+ const sides = sidesFor(end.magnet)+ if (sides.length === 1) return sideMidpoint(box, sides[0])+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 }+}++/** A straight connector: centre to centre, cut where it leaves each layer, less the gaps. */+function straightRoute(+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd,+ [startGap, endGap]: [number, number]+): ConnectorPiece[] {+ const from = straightAnchor(start)+ const to = straightAnchor(end)+ const exit = start.box ? exitPoint(start.box, from, to) : from+ const entry = end.box ? exitPoint(end.box, to, from) : to+ const direction = unit(exit, entry)+ return straightPieces([along(exit, direction, startGap), along(entry, direction, -endGap)])+}++/**+ * A curved connector: one cubic between the elbow's ends, its handles along the sides it leaves+ * and enters by. Each handle is a fixed share of the distance between the edge points, less the+ * end's gap; ends that face each other in line draw straight.+ */+function curvedRoute(+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd,+ [startSide, endSide]: [ConnectorSide, ConnectorSide],+ [startGap, endGap]: [number, number]+): ConnectorPiece[] {+ const edgeFrom = attachment(start, startSide)+ const edgeTo = attachment(end, endSide)+ const from = along(edgeFrom, OUTWARD[startSide], startGap)+ const to = along(edgeTo, OUTWARD[endSide], endGap)+ const vertical = startSide === 'TOP' || startSide === 'BOTTOM'+ const offset = vertical ? from.x - to.x : from.y - to.y+ if (Math.abs(offset) < EPSILON && endSide === opposite(startSide)) {+ return straightPieces([from, to])+ }+ const handle = CURVE_HANDLE_RATIO * Math.hypot(edgeTo.x - edgeFrom.x, edgeTo.y - edgeFrom.y)+ return [+ {+ from,+ to,+ handleFrom: along(ZERO, OUTWARD[startSide], Math.max(0, handle - startGap)),+ handleTo: along(ZERO, OUTWARD[endSide], Math.max(0, handle - endGap))+ }+ ]+}++/**+ * The pieces of a connector's line between its two ends, in the connector's parent's axes. Bound+ * ends stop short of their layers by their caps' gaps; free ends sit on their points. Layers that+ * touch or overlap leave an elbow or a curve nothing to route but the start, as in Figma.+ */+export function routeConnector(+ lineType: ConnectorLineType,+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd,+ strokeWeight: number+): ConnectorPiece[] {+ const gaps: [number, number] = [+ start.box ? connectorEndGap(start, strokeWeight, 'start') : 0,+ end.box ? connectorEndGap(end, strokeWeight, 'end') : 0+ ]+ if (lineType === 'STRAIGHT') return straightRoute(start, end, gaps)+ const [startSide, endSide] = connectorSides(start, end)+ if (start.box && end.box && touches(start.box, end.box)) {+ const at = sideMidpoint(start.box, startSide)+ return [{ from: at, to: at, handleFrom: ZERO, handleTo: ZERO }]+ }+ if (lineType === 'CURVED') {+ // A curve to a free point arrives facing the way it left, where an elbow arrives along the+ // longer axis.+ const curveEndSide = end.box || !start.box ? endSide : opposite(startSide)+ return curvedRoute(start, end, [startSide, curveEndSide], gaps)+ }+ return elbowRoute(start, end, [startSide, endSide], gaps) ?? []+}diff --git a/packages/scene-graph/src/connectors/sides.ts b/packages/scene-graph/src/connectors/sides.tsnew file mode 100644index 000000000..446232ef0--- /dev/null+++ b/packages/scene-graph/src/connectors/sides.ts@@ -0,0 +1,94 @@+import type { Rect, Vector } from '../primitives'+import type { ConnectorMagnet, StrokeCap } from '../types'+import { EPSILON } from './pieces'++export type ConnectorSide = 'TOP' | 'RIGHT' | 'BOTTOM' | 'LEFT'++/** Ties between sides go to the first in this order, start side before end side. */+export const SIDES: readonly ConnectorSide[] = ['TOP', 'RIGHT', 'BOTTOM', 'LEFT']+export const OUTWARD: Record<ConnectorSide, Vector> = {+ TOP: { x: 0, y: -1 },+ RIGHT: { x: 1, y: 0 },+ BOTTOM: { x: 0, y: 1 },+ LEFT: { x: -1, y: 0 }+}++/** One end of a connector as the router sees it: the box it follows, or a free point. */+export interface ConnectorRouteEnd {+ /** The bound layer's box in the connector's parent's axes; null for a free end. */+ box: Rect | null+ /** Where a free end sits, in the connector's parent's axes. */+ point: Vector+ magnet: ConnectorMagnet+ cap: StrokeCap+ /** How far the layer's outline reaches past its box: half a FigJam shape's stroke. */+ outline: number+}++export function sideMidpoint(box: Rect, side: ConnectorSide): Vector {+ const { x, y } = OUTWARD[side]+ return { x: box.x + (box.width * (x + 1)) / 2, y: box.y + (box.height * (y + 1)) / 2 }+}++export function opposite(side: ConnectorSide): ConnectorSide {+ return SIDES[(SIDES.indexOf(side) + 2) % 4]+}++export function sidesFor(magnet: ConnectorMagnet): readonly ConnectorSide[] {+ if (magnet === 'AUTO_HORIZONTAL') return ['RIGHT', 'LEFT']+ if (magnet === 'TOP' || magnet === 'RIGHT' || magnet === 'BOTTOM' || magnet === 'LEFT') {+ return [magnet]+ }+ // Figma keeps `EDGE` and `ABSOLUTE` ends at a point of the layer; until those are drawn they+ // leave by the nearest side.+ return SIDES+}++/** Where an end attaches: on its side, or at its free point. */+export function attachment(end: ConnectorRouteEnd, side: ConnectorSide): Vector {+ return end.box ? sideMidpoint(end.box, side) : end.point+}++/** The side a free point faces: the one its line reaches it through along the longer axis. */+function freeSide(point: Vector, from: Vector): ConnectorSide {+ const dx = point.x - from.x+ const dy = point.y - from.y+ if (Math.abs(dx) >= Math.abs(dy)) return dx >= 0 ? 'LEFT' : 'RIGHT'+ return dy >= 0 ? 'TOP' : 'BOTTOM'+}++function anchorsOf(end: ConnectorRouteEnd): { side: ConnectorSide; at: Vector }[] {+ const { box } = end+ if (!box) return SIDES.map((side) => ({ side, at: end.point }))+ return sidesFor(end.magnet).map((side) => ({ side, at: sideMidpoint(box, side) }))+}++/**+ * The sides a connector leaves and enters by: of the side midpoints its magnets allow, the pair+ * closest together. A free end faces its line along the longer axis.+ */+export function connectorSides(+ start: ConnectorRouteEnd,+ end: ConnectorRouteEnd+): [ConnectorSide, ConnectorSide] {+ if (!start.box && !end.box) {+ const side = freeSide(end.point, start.point)+ return [opposite(side), side]+ }+ let best = { distance: Infinity, sides: ['TOP', 'TOP'] as [ConnectorSide, ConnectorSide] }+ let from = start.point+ let to = end.point+ for (const a of anchorsOf(start)) {+ for (const b of anchorsOf(end)) {+ const distance = Math.hypot(b.at.x - a.at.x, b.at.y - a.at.y)+ if (distance >= best.distance - EPSILON) continue+ best = { distance, sides: [a.side, b.side] }+ from = a.at+ to = b.at+ }+ }+ const [startSide, endSide] = best.sides+ if (!start.box) return [freeSide(from, to), endSide]+ if (!end.box) return [startSide, freeSide(to, from)]+ return [startSide, endSide]+}diff --git a/packages/scene-graph/src/generated/connector.ts b/packages/scene-graph/src/connectors/sublayers.tssimilarity index 64%rename from packages/scene-graph/src/generated/connector.tsrename to packages/scene-graph/src/connectors/sublayers.tsindex e32645833..4d8bdeed1 100644--- a/packages/scene-graph/src/generated/connector.ts+++ b/packages/scene-graph/src/connectors/sublayers.ts@@ -1,10 +1,8 @@import { BLACK } from '../constants'-import { getWorldMatrix } from '../coordinate'+import type { GeneratedFrameKind } from '../generated/kind'import type { SceneGraph } from '../index'-import Matrix from '../matrix'import type { Color, Vector } from '../primitives'import type { ConnectorEndpoint, Fill, SceneNode, Stroke, VectorNetwork } from '../types'-import type { GeneratedFrameKind } from './kind'/*** A FigJam connector as Figma draws it by default: a grey line 4 px wide with rounded elbows, a@@ -131,65 +129,3 @@ export function boundEndpoint(): ConnectorEndpoint {return { nodeId, magnet, position: { x: 0, y: 0 } }}--/** How far from a line, beyond half its stroke, a point still lands on it, in canvas units. */-const CONNECTOR_HIT_SLOP = 4-/** Points sampled along a curved segment to measure distance to it. */-const CURVE_SAMPLES = 24--function distanceToSegment(p: Vector, a: Vector, b: Vector): number {- const dx = b.x - a.x- const dy = b.y - a.y- const lengthSquared = dx * dx + dy * dy- const t =- lengthSquared === 0- ? 0- : Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / lengthSquared))- return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy))-}--function cubicPoint(a: Vector, c1: Vector, c2: Vector, b: Vector, t: number): Vector {- const u = 1 - t- return {- x: u * u * u * a.x + 3 * u * u * t * c1.x + 3 * u * t * t * c2.x + t * t * t * b.x,- y: u * u * u * a.y + 3 * u * u * t * c1.y + 3 * u * t * t * c2.y + t * t * t * b.y- }-}--/**- * Whether a canvas point lands on a connector's line: within half its stroke and a few units of- * slop, plus `pad`. A connector is picked by its line, not by the box around its route.- */-export function hitsConnectorLine(- graph: SceneGraph,- connector: SceneNode,- px: number,- py: number,- pad = 0-): boolean {- const line = connectorSublayers(graph, connector)?.line- const network = line?.vectorNetwork- if (!line || !network) return false- const inverse = Matrix.invert(getWorldMatrix(line, graph))- if (!inverse) return false- const [x, y] = Matrix.mapPoints(inverse, [px, py])- const point = { x, y }- const reach = (line.strokes[0]?.weight ?? line.strokeWeight) / 2 + CONNECTOR_HIT_SLOP + pad- return network.segments.some((segment) => {- const a = network.vertices[segment.start]- const b = network.vertices[segment.end]- const { tangentStart: ts, tangentEnd: te } = segment- if (ts.x === 0 && ts.y === 0 && te.x === 0 && te.y === 0) {- return distanceToSegment(point, a, b) <= reach- }- const c1 = { x: a.x + ts.x, y: a.y + ts.y }- const c2 = { x: b.x + te.x, y: b.y + te.y }- let previous = a- for (let step = 1; step <= CURVE_SAMPLES; step++) {- const current = cubicPoint(a, c1, c2, b, step / CURVE_SAMPLES)- if (distanceToSegment(point, previous, current) <= reach) return true- previous = current- }- return false- })-}diff --git a/packages/scene-graph/src/generated/index.ts b/packages/scene-graph/src/generated/index.tsindex a1c5422be..90d5ae64e 100644--- a/packages/scene-graph/src/generated/index.ts+++ b/packages/scene-graph/src/generated/index.ts@@ -1,6 +1,6 @@+import { CONNECTOR_KIND } from '../connectors/sublayers'import type { SceneGraph } from '../index'import type { NodeType, SceneNode } from '../types'-import { CONNECTOR_KIND } from './connector'import type { GeneratedFrameKind } from './kind'import { STICKY_KIND } from './sticky'@@ -52,5 +52,4 @@ export function layerResizes(node: Pick<SceneNode, 'type'>): boolean {}export type { GeneratedFrameKind } from './kind'-export * from './connector'export * from './sticky'diff --git a/packages/scene-graph/src/hit-test.ts b/packages/scene-graph/src/hit-test.tsindex 752639930..0e487bb44 100644--- a/packages/scene-graph/src/hit-test.ts+++ b/packages/scene-graph/src/hit-test.ts@@ -1,6 +1,6 @@import type { SceneGraph, SceneNode, NodeType } from './'+import { hitsConnectorLine } from './connectors/hit'import { getWorldMatrix } from './coordinate'-import { hitsConnectorLine } from './generated/connector'import Matrix from './matrix'const CONTAINER_TYPES = new Set<NodeType>([diff --git a/packages/scene-graph/src/index.ts b/packages/scene-graph/src/index.tsindex 6be61edd7..3359ba8e6 100644--- a/packages/scene-graph/src/index.ts+++ b/packages/scene-graph/src/index.ts@@ -37,6 +37,7 @@ export {export * from './slots/content'export * from './slots/authoring'export * from './slots/limits'+export * from './connectors'export * from './generated'export * from './behaviours/kinds'export * from './icons/schema'diff --git a/packages/scene-graph/src/undo.ts b/packages/scene-graph/src/undo.tsindex 50e63bffb..1fb918c18 100644--- a/packages/scene-graph/src/undo.ts+++ b/packages/scene-graph/src/undo.ts@@ -24,6 +24,7 @@ export class UndoManager {private undoStack: UndoEntry[] = []private redoStack: UndoEntry[] = []private batches: UndoBatch[] = []+ private replaying = 0private readonly settlers = new Set<() => void>()private readonly limit: numberprivate readonly onChange: (() => void) | undefined@@ -82,7 +83,7 @@ export class UndoManager {this.settle()const entry = this.undoStack.pop()if (!entry) return null- entry.inverse()+ this.replay(() => entry.inverse())this.redoStack.push(entry)this.onChange?.()return entry.label@@ -92,7 +93,7 @@ export class UndoManager {this.settle()const entry = this.redoStack.pop()if (!entry) return null- entry.forward()+ this.replay(() => entry.forward())this.undoStack.push(entry)this.onChange?.()return entry.label@@ -142,6 +143,44 @@ export class UndoManager {this.onChange?.()}+ /** Whether undo or redo is replaying a step, whose changes are history rather than new edits. */+ get isReplaying(): boolean {+ return this.replaying > 0+ }++ /**+ * Adds a change that the newest step caused, as one an editor makes in response to it, so undo+ * and redo apply them together. Inside a batch it joins the batch. False with no step to join.+ */+ extendLastStep(entry: UndoEntry): boolean {+ if (this.currentBatch) {+ this.currentBatch.entries.push(entry)+ return true+ }+ const last = this.undoStack.at(-1)+ if (!last) return false+ // The step keeps its identity, so callers that hold it still find it in the history.+ const { forward, inverse } = last+ last.forward = () => {+ forward()+ entry.forward()+ }+ last.inverse = () => {+ entry.inverse()+ inverse()+ }+ return true+ }++ private replay(step: () => void) {+ this.replaying+++ try {+ step()+ } finally {+ this.replaying--+ }+ }+get isBatching(): boolean {return this.batches.length > 0}diff --git a/packages/scene-graph/tests/generated/connector.test.ts b/packages/scene-graph/tests/connectors/endpoints.test.tssimilarity index 100%rename from packages/scene-graph/tests/generated/connector.test.tsrename to packages/scene-graph/tests/connectors/endpoints.test.tsdiff --git a/packages/scene-graph/tests/connectors/figma-routes.json b/packages/scene-graph/tests/connectors/figma-routes.jsonnew file mode 100644index 000000000..604937878--- /dev/null+++ b/packages/scene-graph/tests/connectors/figma-routes.json@@ -0,0 +1,405 @@+[+ {"name": "rp ELBOWED -400 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [-291.5, -350]]},+ {"name": "rp ELBOWED -200 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [-150, -150], [-150, -291.5]]},+ {"name": "rp ELBOWED -100 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [-50, -150], [-50, -291.5]]},+ {"name": "rp ELBOWED 0 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -291.5]]},+ {"name": "rp ELBOWED 100 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [150, -150], [150, -291.5]]},+ {"name": "rp ELBOWED 200 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [250, -150], [250, -291.5]]},+ {"name": "rp ELBOWED 400 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [391.5, -350]]},+ {"name": "rp ELBOWED -400 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-150, 50], [-150, -150], [-291.5, -150]]},+ {"name": "rp ELBOWED -200 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [-91.5, -150]]},+ {"name": "rp ELBOWED -100 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [-50, -50], [-50, -91.5]]},+ {"name": "rp ELBOWED 0 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -91.5]]},+ {"name": "rp ELBOWED 100 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [150, -50], [150, -91.5]]},+ {"name": "rp ELBOWED 200 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [191.5, -150]]},+ {"name": "rp ELBOWED 400 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, -150], [391.5, -150]]},+ {"name": "rp ELBOWED -400 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-150, 50], [-150, -50], [-291.5, -50]]},+ {"name": "rp ELBOWED -200 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-50, 50], [-50, -50], [-91.5, -50]]},+ {"name": "rp ELBOWED -100 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -100, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [8.5, -50]]},+ {"name": "rp ELBOWED 0 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -100, 100, 100], "outline": 2}, "vertices": [[50, 0]]},+ {"name": "rp ELBOWED 100 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -100, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [91.5, -50]]},+ {"name": "rp ELBOWED 200 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -100, 100, 100], "outline": 2}, "vertices": [[108, 50], [150, 50], [150, -50], [191.5, -50]]},+ {"name": "rp ELBOWED 400 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -100, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, -50], [391.5, -50]]},+ {"name": "rp ELBOWED -400 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, 50]]},+ {"name": "rp ELBOWED -200 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-91.5, 50]]},+ {"name": "rp ELBOWED -100 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 0, 100, 100], "outline": 2}, "vertices": [[0, 50]]},+ {"name": "rp ELBOWED 100 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 0, 100, 100], "outline": 2}, "vertices": [[100, 50]]},+ {"name": "rp ELBOWED 200 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [191.5, 50]]},+ {"name": "rp ELBOWED 400 0", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rp ELBOWED -400 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-150, 50], [-150, 150], [-291.5, 150]]},+ {"name": "rp ELBOWED -200 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-50, 50], [-50, 150], [-91.5, 150]]},+ {"name": "rp ELBOWED -100 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 100, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 150], [8.5, 150]]},+ {"name": "rp ELBOWED 0 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 100, 100, 100], "outline": 2}, "vertices": [[50, 100]]},+ {"name": "rp ELBOWED 100 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [150, 50], [150, 91.5]]},+ {"name": "rp ELBOWED 200 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [150, 50], [150, 150], [191.5, 150]]},+ {"name": "rp ELBOWED 400 100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, 150], [391.5, 150]]},+ {"name": "rp ELBOWED -400 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-150, 50], [-150, 250], [-291.5, 250]]},+ {"name": "rp ELBOWED -200 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [-91.5, 250]]},+ {"name": "rp ELBOWED -100 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 150], [-50, 150], [-50, 191.5]]},+ {"name": "rp ELBOWED 0 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 191.5]]},+ {"name": "rp ELBOWED 100 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 150], [150, 150], [150, 191.5]]},+ {"name": "rp ELBOWED 200 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, 191.5]]},+ {"name": "rp ELBOWED 400 200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, 250], [391.5, 250]]},+ {"name": "rp ELBOWED -400 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 450], [-291.5, 450]]},+ {"name": "rp ELBOWED -200 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [-150, 250], [-150, 391.5]]},+ {"name": "rp ELBOWED -100 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [-50, 250], [-50, 391.5]]},+ {"name": "rp ELBOWED 0 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 391.5]]},+ {"name": "rp ELBOWED 100 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [150, 250], [150, 391.5]]},+ {"name": "rp ELBOWED 200 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [250, 250], [250, 391.5]]},+ {"name": "rp ELBOWED 400 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 400, 100, 100], "outline": 2}, "vertices": [[108, 50], [450, 50], [450, 391.5]]},+ {"name": "rp STRAIGHT -400 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, -400, 100, 100], "outline": 2}, "vertices": [[-5.66, -5.66], [-293.99, -293.99]]},+ {"name": "rp STRAIGHT -200 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, -400, 100, 100], "outline": 2}, "vertices": [[21.43, -7.16], [-121.2, -292.4]]},+ {"name": "rp STRAIGHT -100 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, -400, 100, 100], "outline": 2}, "vertices": [[35.56, -7.76], [-35.44, -291.75]]},+ {"name": "rp STRAIGHT 0 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -291.5]]},+ {"name": "rp STRAIGHT 100 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, -400, 100, 100], "outline": 2}, "vertices": [[64.44, -7.76], [135.44, -291.75]]},+ {"name": "rp STRAIGHT 200 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, -400, 100, 100], "outline": 2}, "vertices": [[78.58, -7.16], [221.2, -292.4]]},+ {"name": "rp STRAIGHT 400 -400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, -400, 100, 100], "outline": 2}, "vertices": [[105.66, -5.66], [393.99, -293.99]]},+ {"name": "rp STRAIGHT -400 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, -200, 100, 100], "outline": 2}, "vertices": [[-7.16, 21.42], [-292.4, -121.2]]},+ {"name": "rp STRAIGHT -200 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, -200, 100, 100], "outline": 2}, "vertices": [[-5.66, -5.66], [-93.99, -93.99]]},+ {"name": "rp STRAIGHT -100 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, -200, 100, 100], "outline": 2}, "vertices": [[21.43, -7.16], [-21.2, -92.4]]},+ {"name": "rp STRAIGHT 0 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -91.5]]},+ {"name": "rp STRAIGHT 100 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, -200, 100, 100], "outline": 2}, "vertices": [[78.58, -7.16], [121.2, -92.4]]},+ {"name": "rp STRAIGHT 200 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, -200, 100, 100], "outline": 2}, "vertices": [[105.66, -5.66], [193.99, -93.99]]},+ {"name": "rp STRAIGHT 400 -200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, -200, 100, 100], "outline": 2}, "vertices": [[107.16, 21.42], [392.4, -121.2]]},+ {"name": "rp STRAIGHT -400 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, -100, 100, 100], "outline": 2}, "vertices": [[-7.76, 35.56], [-291.75, -35.44]]},+ {"name": "rp STRAIGHT -200 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, -100, 100, 100], "outline": 2}, "vertices": [[-7.16, 21.42], [-92.4, -21.2]]},+ {"name": "rp STRAIGHT -100 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, -100, 100, 100], "outline": 2}, "vertices": [[0, 0]]},+ {"name": "rp STRAIGHT 0 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, -100, 100, 100], "outline": 2}, "vertices": [[50, 0]]},+ {"name": "rp STRAIGHT 100 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, -100, 100, 100], "outline": 2}, "vertices": [[100, 0]]},+ {"name": "rp STRAIGHT 200 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, -100, 100, 100], "outline": 2}, "vertices": [[107.16, 21.42], [192.4, -21.2]]},+ {"name": "rp STRAIGHT 400 -100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, -100, 100, 100], "outline": 2}, "vertices": [[107.76, 35.56], [391.75, -35.44]]},+ {"name": "rp STRAIGHT -400 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, 50]]},+ {"name": "rp STRAIGHT -200 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-91.5, 50]]},+ {"name": "rp STRAIGHT -100 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, 0, 100, 100], "outline": 2}, "vertices": [[0, 50]]},+ {"name": "rp STRAIGHT 100 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, 0, 100, 100], "outline": 2}, "vertices": [[100, 50]]},+ {"name": "rp STRAIGHT 200 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [191.5, 50]]},+ {"name": "rp STRAIGHT 400 0", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rp STRAIGHT -400 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, 100, 100, 100], "outline": 2}, "vertices": [[-7.76, 64.44], [-291.75, 135.44]]},+ {"name": "rp STRAIGHT -200 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, 100, 100, 100], "outline": 2}, "vertices": [[-7.16, 78.58], [-92.4, 121.2]]},+ {"name": "rp STRAIGHT -100 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, 100, 100, 100], "outline": 2}, "vertices": [[0, 100]]},+ {"name": "rp STRAIGHT 0 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, 100, 100, 100], "outline": 2}, "vertices": [[50, 100]]},+ {"name": "rp STRAIGHT 100 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, 100, 100, 100], "outline": 2}, "vertices": [[100, 100]]},+ {"name": "rp STRAIGHT 200 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, 100, 100, 100], "outline": 2}, "vertices": [[107.16, 78.58], [192.4, 121.2]]},+ {"name": "rp STRAIGHT 400 100", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, 100, 100, 100], "outline": 2}, "vertices": [[107.76, 64.44], [391.75, 135.44]]},+ {"name": "rp STRAIGHT -400 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, 200, 100, 100], "outline": 2}, "vertices": [[-7.16, 78.58], [-292.4, 221.2]]},+ {"name": "rp STRAIGHT -200 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, 200, 100, 100], "outline": 2}, "vertices": [[-5.66, 105.66], [-93.99, 193.99]]},+ {"name": "rp STRAIGHT -100 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, 200, 100, 100], "outline": 2}, "vertices": [[21.43, 107.16], [-21.2, 192.4]]},+ {"name": "rp STRAIGHT 0 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 191.5]]},+ {"name": "rp STRAIGHT 100 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, 200, 100, 100], "outline": 2}, "vertices": [[78.58, 107.16], [121.2, 192.4]]},+ {"name": "rp STRAIGHT 200 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, 200, 100, 100], "outline": 2}, "vertices": [[105.66, 105.66], [193.99, 193.99]]},+ {"name": "rp STRAIGHT 400 200", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, 200, 100, 100], "outline": 2}, "vertices": [[107.16, 78.58], [392.4, 221.2]]},+ {"name": "rp STRAIGHT -400 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-400, 400, 100, 100], "outline": 2}, "vertices": [[-5.66, 105.66], [-293.99, 393.99]]},+ {"name": "rp STRAIGHT -200 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-200, 400, 100, 100], "outline": 2}, "vertices": [[21.43, 107.16], [-121.2, 392.4]]},+ {"name": "rp STRAIGHT -100 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [-100, 400, 100, 100], "outline": 2}, "vertices": [[35.56, 107.76], [-35.44, 391.75]]},+ {"name": "rp STRAIGHT 0 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [0, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 391.5]]},+ {"name": "rp STRAIGHT 100 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [100, 400, 100, 100], "outline": 2}, "vertices": [[64.44, 107.76], [135.44, 391.75]]},+ {"name": "rp STRAIGHT 200 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [200, 400, 100, 100], "outline": 2}, "vertices": [[78.58, 107.16], [221.2, 392.4]]},+ {"name": "rp STRAIGHT 400 400", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, 400, 100, 100], "outline": 2}, "vertices": [[105.66, 105.66], [393.99, 393.99]]},+ {"name": "rp CURVED -400 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [-291.5, -350]], "segments": [[0, 1, [0, -203.19], [202.69, 0]]]},+ {"name": "rp CURVED -200 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [-150, -291.5]], "segments": [[0, 1, [0, -145.84], [0, 145.34]]]},+ {"name": "rp CURVED -100 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [-50, -291.5]], "segments": [[0, 1, [0, -126.92], [0, 126.42]]]},+ {"name": "rp CURVED 0 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -291.5]]},+ {"name": "rp CURVED 100 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [150, -291.5]], "segments": [[0, 1, [0, -126.92], [0, 126.42]]]},+ {"name": "rp CURVED 200 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [250, -291.5]], "segments": [[0, 1, [0, -145.84], [0, 145.34]]]},+ {"name": "rp CURVED 400 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [391.5, -350]], "segments": [[0, 1, [0, -203.19], [-202.69, 0]]]},+ {"name": "rp CURVED -400 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, -150]], "segments": [[0, 1, [-145.84, 0], [145.34, 0]]]},+ {"name": "rp CURVED -200 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [-91.5, -150]], "segments": [[0, 1, [0, -82.51], [82.01, 0]]]},+ {"name": "rp CURVED -100 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [-50, -91.5]], "segments": [[0, 1, [0, -52.34], [0, 51.84]]]},+ {"name": "rp CURVED 0 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -91.5]]},+ {"name": "rp CURVED 100 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [150, -91.5]], "segments": [[0, 1, [0, -52.34], [0, 51.84]]]},+ {"name": "rp CURVED 200 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [191.5, -150]], "segments": [[0, 1, [0, -82.51], [-82.01, 0]]]},+ {"name": "rp CURVED 400 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, -150]], "segments": [[0, 1, [145.84, 0], [-145.34, 0]]]},+ {"name": "rp CURVED -400 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, -100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, -50]], "segments": [[0, 1, [-126.92, 0], [126.42, 0]]]},+ {"name": "rp CURVED -200 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, -100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-91.5, -50]], "segments": [[0, 1, [-52.34, 0], [51.84, 0]]]},+ {"name": "rp CURVED -100 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, -100, 100, 100], "outline": 2}, "vertices": [[50, -8], [8.5, -50]], "segments": [[0, 1, [0, -22.17], [21.67, 0]]]},+ {"name": "rp CURVED 0 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -100, 100, 100], "outline": 2}, "vertices": [[50, 0]]},+ {"name": "rp CURVED 100 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -100, 100, 100], "outline": 2}, "vertices": [[50, -8], [91.5, -50]], "segments": [[0, 1, [0, -22.17], [-21.67, 0]]]},+ {"name": "rp CURVED 200 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -100, 100, 100], "outline": 2}, "vertices": [[108, 50], [191.5, -50]], "segments": [[0, 1, [52.34, 0], [-51.84, 0]]]},+ {"name": "rp CURVED 400 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -100, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, -50]], "segments": [[0, 1, [126.92, 0], [-126.42, 0]]]},+ {"name": "rp CURVED -400 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, 50]]},+ {"name": "rp CURVED -200 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-91.5, 50]]},+ {"name": "rp CURVED -100 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 0, 100, 100], "outline": 2}, "vertices": [[0, 50]]},+ {"name": "rp CURVED 100 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 0, 100, 100], "outline": 2}, "vertices": [[100, 50]]},+ {"name": "rp CURVED 200 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [191.5, 50]]},+ {"name": "rp CURVED 400 0", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rp CURVED -400 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, 150]], "segments": [[0, 1, [-126.92, 0], [126.42, 0]]]},+ {"name": "rp CURVED -200 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 100, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-91.5, 150]], "segments": [[0, 1, [-52.34, 0], [51.84, 0]]]},+ {"name": "rp CURVED -100 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 100, 100, 100], "outline": 2}, "vertices": [[50, 108], [8.5, 150]], "segments": [[0, 1, [0, 22.17], [21.67, 0]]]},+ {"name": "rp CURVED 0 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 100, 100, 100], "outline": 2}, "vertices": [[50, 100]]},+ {"name": "rp CURVED 100 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [150, 91.5]], "segments": [[0, 1, [22.17, 0], [0, -21.67]]]},+ {"name": "rp CURVED 200 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [191.5, 150]], "segments": [[0, 1, [52.34, 0], [-51.84, 0]]]},+ {"name": "rp CURVED 400 100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 100, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 150]], "segments": [[0, 1, [126.92, 0], [-126.42, 0]]]},+ {"name": "rp CURVED -400 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-291.5, 250]], "segments": [[0, 1, [-145.84, 0], [145.34, 0]]]},+ {"name": "rp CURVED -200 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [-91.5, 250]], "segments": [[0, 1, [0, 82.51], [82.01, 0]]]},+ {"name": "rp CURVED -100 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [-50, 191.5]], "segments": [[0, 1, [0, 52.34], [0, -51.84]]]},+ {"name": "rp CURVED 0 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 191.5]]},+ {"name": "rp CURVED 100 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [150, 191.5]], "segments": [[0, 1, [0, 52.34], [0, -51.84]]]},+ {"name": "rp CURVED 200 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 191.5]], "segments": [[0, 1, [82.51, 0], [0, -82.01]]]},+ {"name": "rp CURVED 400 200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 250]], "segments": [[0, 1, [145.84, 0], [-145.34, 0]]]},+ {"name": "rp CURVED -400 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-400, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [-291.5, 450]], "segments": [[0, 1, [0, 203.19], [202.69, 0]]]},+ {"name": "rp CURVED -200 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-200, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [-150, 391.5]], "segments": [[0, 1, [0, 145.84], [0, -145.34]]]},+ {"name": "rp CURVED -100 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-100, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [-50, 391.5]], "segments": [[0, 1, [0, 126.92], [0, -126.42]]]},+ {"name": "rp CURVED 0 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 391.5]]},+ {"name": "rp CURVED 100 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [150, 391.5]], "segments": [[0, 1, [0, 126.92], [0, -126.42]]]},+ {"name": "rp CURVED 200 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, 400, 100, 100], "outline": 2}, "vertices": [[50, 108], [250, 391.5]], "segments": [[0, 1, [0, 145.84], [0, -145.34]]]},+ {"name": "rp CURVED 400 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 400, 100, 100], "outline": 2}, "vertices": [[108, 50], [450, 391.5]], "segments": [[0, 1, [203.19, 0], [0, -202.69]]]},+ {"name": "rq sw1", "lineType": "ELBOWED", "weight": 1, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[105, 50], [395, 50]]},+ {"name": "rq sw2", "lineType": "ELBOWED", "weight": 2, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[105.5, 50], [394.5, 50]]},+ {"name": "rq sw4", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rq sw8", "lineType": "ELBOWED", "weight": 8, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[112.5, 50], [387.5, 50]]},+ {"name": "rq sw16", "lineType": "ELBOWED", "weight": 16, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[112.5, 50], [387.5, 50]]},+ {"name": "rq ec-NONE", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [392, 50]]},+ {"name": "rq ec-ARROW_LINES", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rq ec-ARROW_EQUILATERAL", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [394.69, 50]]},+ {"name": "rq ec-TRIANGLE_FILLED", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [393.5, 50]]},+ {"name": "rq ec-DIAMOND_FILLED", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [400, 50]]},+ {"name": "rq ec-CIRCLE_FILLED", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [400, 50]]},+ {"name": "rq sc-ARROW_LINES", "lineType": "ELBOWED", "weight": 4, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108.5, 50], [391.5, 50]]},+ {"name": "rq sc-CIRCLE_FILLED", "lineType": "ELBOWED", "weight": 4, "startCap": "CIRCLE_FILLED", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[100, 50], [391.5, 50]]},+ {"name": "rq tie 300 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [291.5, -250]]},+ {"name": "rq tie 299 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [299, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [290.5, -250]]},+ {"name": "rq tie 301 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [301, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [292.5, -250]]},+ {"name": "rq tie 300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, 300, 100, 100], "outline": 2}, "vertices": [[108, 50], [350, 50], [350, 291.5]]},+ {"name": "rq tie 299 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [299, 300, 100, 100], "outline": 2}, "vertices": [[108, 50], [349, 50], [349, 291.5]]},+ {"name": "rq tie 301 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [301, 300, 100, 100], "outline": 2}, "vertices": [[108, 50], [351, 50], [351, 291.5]]},+ {"name": "rq tie -300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-300, 300, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 350], [-191.5, 350]]},+ {"name": "rq tie -299 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-299, 300, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 350], [-190.5, 350]]},+ {"name": "rq tie -301 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-301, 300, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 350], [-192.5, 350]]},+ {"name": "rq tie -300 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-300, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [-191.5, -250]]},+ {"name": "rq tie -299 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-299, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [-190.5, -250]]},+ {"name": "rq tie -301 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [-301, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [-192.5, -250]]},+ {"name": "rq size wideA 400 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 300, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -300, 100, 100], "outline": 2}, "vertices": [[308, 50], [450, 50], [450, -191.5]]},+ {"name": "rq size tallB 400 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -300, 100, 300], "outline": 2}, "vertices": [[108, 50], [450, 50], [450, 8.5]]},+ {"name": "rq size wide both 500 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 300, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [500, -200, 300, 100], "outline": 2}, "vertices": [[308, 50], [400, 50], [400, -150], [491.5, -150]]},+ {"name": "rq curve 0 -150", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [0, -150, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -41.5]]},+ {"name": "rq curve 50 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [50, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [100, -91.5]], "segments": [[0, 1, [0, -39.7], [0, 39.2]]]},+ {"name": "rq curve 100 -300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [150, -191.5]], "segments": [[0, 1, [0, -87.41], [0, 86.91]]]},+ {"name": "rq curve 300 -300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [291.5, -250]], "segments": [[0, 1, [0, -142.85], [-142.35, 0]]]},+ {"name": "rq curve 600 -600", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [591.5, -550]], "segments": [[0, 1, [0, -323.87], [-323.37, 0]]]},+ {"name": "rq curve 600 -300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [591.5, -250]], "segments": [[0, 1, [240.79, 0], [-240.29, 0]]]},+ {"name": "rq curve 150 -1000", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [150, -1000, 100, 100], "outline": 2}, "vertices": [[50, -8], [200, -891.5]], "segments": [[0, 1, [0, -381.3], [0, 380.8]]]},+ {"name": "rq curve 800 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [800, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [791.5, -150]], "segments": [[0, 1, [302.62, 0], [-302.12, 0]]]},+ {"name": "rs 100 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [150, -50], [150, -91.5]]},+ {"name": "rs 125 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [125, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [175, -50], [175, -91.5]]},+ {"name": "rs 150 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [150, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [200, -50], [200, -91.5]]},+ {"name": "rs 175 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [175, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [166.5, -150]]},+ {"name": "rs 200 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [191.5, -150]]},+ {"name": "rs 225 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [225, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [216.5, -150]]},+ {"name": "rs 250 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [250, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [241.5, -150]]},+ {"name": "rs 275 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [275, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [187.5, 50], [187.5, -150], [266.5, -150]]},+ {"name": "rs 300 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [200, 50], [200, -150], [291.5, -150]]},+ {"name": "rs 325 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [325, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [212.5, 50], [212.5, -150], [316.5, -150]]},+ {"name": "rs 350 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [350, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [225, 50], [225, -150], [341.5, -150]]},+ {"name": "rs 375 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [375, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [237.5, 50], [237.5, -150], [366.5, -150]]},+ {"name": "rs 400 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, -150], [391.5, -150]]},+ {"name": "rs 425 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [425, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [262.5, 50], [262.5, -150], [416.5, -150]]},+ {"name": "rs 450 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [450, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [275, 50], [275, -150], [441.5, -150]]},+ {"name": "rs 475 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [475, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [287.5, 50], [287.5, -150], [466.5, -150]]},+ {"name": "rs 500 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [500, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [300, 50], [300, -150], [491.5, -150]]},+ {"name": "rs 100 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [150, -100], [150, -191.5]]},+ {"name": "rs 125 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [125, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [175, -100], [175, -191.5]]},+ {"name": "rs 150 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [150, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [200, -100], [200, -191.5]]},+ {"name": "rs 175 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [175, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [225, -100], [225, -191.5]]},+ {"name": "rs 200 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [250, -100], [250, -191.5]]},+ {"name": "rs 225 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [225, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [275, -100], [275, -191.5]]},+ {"name": "rs 250 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [250, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -100], [300, -100], [300, -191.5]]},+ {"name": "rs 275 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [275, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [266.5, -250]]},+ {"name": "rs 300 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [291.5, -250]]},+ {"name": "rs 325 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [325, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [316.5, -250]]},+ {"name": "rs 350 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [350, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [341.5, -250]]},+ {"name": "rs 375 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [375, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [237.5, 50], [237.5, -250], [366.5, -250]]},+ {"name": "rs 400 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, -250], [391.5, -250]]},+ {"name": "rs 425 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [425, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [262.5, 50], [262.5, -250], [416.5, -250]]},+ {"name": "rs 450 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [450, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [275, 50], [275, -250], [441.5, -250]]},+ {"name": "rs 475 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [475, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [287.5, 50], [287.5, -250], [466.5, -250]]},+ {"name": "rs 500 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [500, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [300, 50], [300, -250], [491.5, -250]]},+ {"name": "rs 525 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [525, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [312.5, 50], [312.5, -250], [516.5, -250]]},+ {"name": "rs 550 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [550, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [325, 50], [325, -250], [541.5, -250]]},+ {"name": "rs 575 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [575, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [337.5, 50], [337.5, -250], [566.5, -250]]},+ {"name": "rs 600 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, -300, 100, 100], "outline": 2}, "vertices": [[108, 50], [350, 50], [350, -250], [591.5, -250]]},+ {"name": "rs 100 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [150, -150], [150, -291.5]]},+ {"name": "rs 125 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [125, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [175, -150], [175, -291.5]]},+ {"name": "rs 150 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [150, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [200, -150], [200, -291.5]]},+ {"name": "rs 175 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [175, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [225, -150], [225, -291.5]]},+ {"name": "rs 200 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [250, -150], [250, -291.5]]},+ {"name": "rs 225 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [225, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [275, -150], [275, -291.5]]},+ {"name": "rs 250 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [250, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [300, -150], [300, -291.5]]},+ {"name": "rs 275 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [275, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [325, -150], [325, -291.5]]},+ {"name": "rs 300 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [350, -150], [350, -291.5]]},+ {"name": "rs 325 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [325, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [375, -150], [375, -291.5]]},+ {"name": "rs 350 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [350, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [400, -150], [400, -291.5]]},+ {"name": "rs 375 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [375, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [366.5, -350]]},+ {"name": "rs 400 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [391.5, -350]]},+ {"name": "rs 425 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [425, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [416.5, -350]]},+ {"name": "rs 450 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [450, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -350], [441.5, -350]]},+ {"name": "rs 475 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [475, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [287.5, 50], [287.5, -350], [466.5, -350]]},+ {"name": "rs 500 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [500, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [300, 50], [300, -350], [491.5, -350]]},+ {"name": "rs 525 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [525, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [312.5, 50], [312.5, -350], [516.5, -350]]},+ {"name": "rs 550 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [550, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [325, 50], [325, -350], [541.5, -350]]},+ {"name": "rs 575 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [575, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [337.5, 50], [337.5, -350], [566.5, -350]]},+ {"name": "rs 600 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [350, 50], [350, -350], [591.5, -350]]},+ {"name": "rs 625 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [625, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [362.5, 50], [362.5, -350], [616.5, -350]]},+ {"name": "rs 650 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [650, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [375, 50], [375, -350], [641.5, -350]]},+ {"name": "rs 675 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [675, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [387.5, 50], [387.5, -350], [666.5, -350]]},+ {"name": "rs 700 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [700, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [400, 50], [400, -350], [691.5, -350]]},+ {"name": "rs 100 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [100, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [150, -250], [150, -491.5]]},+ {"name": "rs 125 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [125, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [175, -250], [175, -491.5]]},+ {"name": "rs 150 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [150, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [200, -250], [200, -491.5]]},+ {"name": "rs 175 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [175, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [225, -250], [225, -491.5]]},+ {"name": "rs 200 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [250, -250], [250, -491.5]]},+ {"name": "rs 225 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [225, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [275, -250], [275, -491.5]]},+ {"name": "rs 250 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [250, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [300, -250], [300, -491.5]]},+ {"name": "rs 275 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [275, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [325, -250], [325, -491.5]]},+ {"name": "rs 300 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [350, -250], [350, -491.5]]},+ {"name": "rs 325 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [325, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [375, -250], [375, -491.5]]},+ {"name": "rs 350 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [350, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [400, -250], [400, -491.5]]},+ {"name": "rs 375 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [375, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [425, -250], [425, -491.5]]},+ {"name": "rs 400 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [450, -250], [450, -491.5]]},+ {"name": "rs 425 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [425, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [475, -250], [475, -491.5]]},+ {"name": "rs 450 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [450, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [500, -250], [500, -491.5]]},+ {"name": "rs 475 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [475, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [525, -250], [525, -491.5]]},+ {"name": "rs 500 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [500, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [550, -250], [550, -491.5]]},+ {"name": "rs 525 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [525, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [575, -250], [575, -491.5]]},+ {"name": "rs 550 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [550, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -250], [600, -250], [600, -491.5]]},+ {"name": "rs 575 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [575, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -550], [566.5, -550]]},+ {"name": "rs 600 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -550], [591.5, -550]]},+ {"name": "rs 625 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [625, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -550], [616.5, -550]]},+ {"name": "rs 650 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [650, -600, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -550], [641.5, -550]]},+ {"name": "rs 675 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [675, -600, 100, 100], "outline": 2}, "vertices": [[108, 50], [387.5, 50], [387.5, -550], [666.5, -550]]},+ {"name": "rs 700 -600", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [700, -600, 100, 100], "outline": 2}, "vertices": [[108, 50], [400, 50], [400, -550], [691.5, -550]]},+ {"name": "rt mag 300 -200 TOP TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -248], [350, -248], [350, -208.5]]},+ {"name": "rt mag 300 -200 TOP RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [448, -50], [448, -150], [408.5, -150]]},+ {"name": "rt mag 300 -200 TOP BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -50], [350, -50], [350, -91.5]]},+ {"name": "rt mag 300 -200 TOP LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [291.5, -150]]},+ {"name": "rt mag 300 -200 RIGHT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [200, 50], [200, -248], [350, -248], [350, -208.5]]},+ {"name": "rt mag 300 -200 RIGHT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [448, 50], [448, -150], [408.5, -150]]},+ {"name": "rt mag 300 -200 RIGHT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [350, 50], [350, -91.5]]},+ {"name": "rt mag 300 -200 RIGHT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [200, 50], [200, -150], [291.5, -150]]},+ {"name": "rt mag 300 -200 BOTTOM TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [200, 148], [200, -248], [350, -248], [350, -208.5]]},+ {"name": "rt mag 300 -200 BOTTOM RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [448, 148], [448, -150], [408.5, -150]]},+ {"name": "rt mag 300 -200 BOTTOM BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [350, 148], [350, -91.5]]},+ {"name": "rt mag 300 -200 BOTTOM LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [200, 148], [200, -150], [291.5, -150]]},+ {"name": "rt mag 300 -200 LEFT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -248], [350, -248], [350, -208.5]]},+ {"name": "rt mag 300 -200 LEFT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -50], [448, -50], [448, -150], [408.5, -150]]},+ {"name": "rt mag 300 -200 LEFT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -50], [350, -50], [350, -91.5]]},+ {"name": "rt mag 300 -200 LEFT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [300, -200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -150], [291.5, -150]]},+ {"name": "rt mag 400 0 TOP TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [450, -48], [450, -8.5]]},+ {"name": "rt mag 400 0 TOP RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [548, -48], [548, 50], [508.5, 50]]},+ {"name": "rt mag 400 0 TOP BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [250, -48], [250, 148], [450, 148], [450, 108.5]]},+ {"name": "rt mag 400 0 TOP LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [250, -48], [250, 50], [391.5, 50]]},+ {"name": "rt mag 400 0 RIGHT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, -48], [450, -48], [450, -8.5]]},+ {"name": "rt mag 400 0 RIGHT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, 148], [548, 148], [548, 50], [508.5, 50]]},+ {"name": "rt mag 400 0 RIGHT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [250, 50], [250, 148], [450, 148], [450, 108.5]]},+ {"name": "rt mag 400 0 RIGHT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [391.5, 50]]},+ {"name": "rt mag 400 0 BOTTOM TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [250, 148], [250, -48], [450, -48], [450, -8.5]]},+ {"name": "rt mag 400 0 BOTTOM RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [548, 148], [548, 50], [508.5, 50]]},+ {"name": "rt mag 400 0 BOTTOM BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [450, 148], [450, 108.5]]},+ {"name": "rt mag 400 0 BOTTOM LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [250, 148], [250, 50], [391.5, 50]]},+ {"name": "rt mag 400 0 LEFT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -48], [450, -48], [450, -8.5]]},+ {"name": "rt mag 400 0 LEFT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, 148], [548, 148], [548, 50], [508.5, 50]]},+ {"name": "rt mag 400 0 LEFT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, 148], [450, 148], [450, 108.5]]},+ {"name": "rt mag 400 0 LEFT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, 148], [250, 148], [250, 50], [391.5, 50]]},+ {"name": "rt mag 0 -400 TOP TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [148, -150], [148, -448], [50, -448], [50, -408.5]]},+ {"name": "rt mag 0 -400 TOP RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [148, -150], [148, -350], [108.5, -350]]},+ {"name": "rt mag 0 -400 TOP BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -291.5]]},+ {"name": "rt mag 0 -400 TOP LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [-48, -150], [-48, -350], [-8.5, -350]]},+ {"name": "rt mag 0 -400 RIGHT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, -448], [50, -448], [50, -408.5]]},+ {"name": "rt mag 0 -400 RIGHT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, -350], [108.5, -350]]},+ {"name": "rt mag 0 -400 RIGHT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, -150], [50, -150], [50, -291.5]]},+ {"name": "rt mag 0 -400 RIGHT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, -150], [-48, -150], [-48, -350], [-8.5, -350]]},+ {"name": "rt mag 0 -400 BOTTOM TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [148, 148], [148, -448], [50, -448], [50, -408.5]]},+ {"name": "rt mag 0 -400 BOTTOM RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [148, 148], [148, -350], [108.5, -350]]},+ {"name": "rt mag 0 -400 BOTTOM BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [148, 148], [148, -150], [50, -150], [50, -291.5]]},+ {"name": "rt mag 0 -400 BOTTOM LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 148], [-48, 148], [-48, -350], [-8.5, -350]]},+ {"name": "rt mag 0 -400 LEFT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -448], [50, -448], [50, -408.5]]},+ {"name": "rt mag 0 -400 LEFT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -150], [148, -150], [148, -350], [108.5, -350]]},+ {"name": "rt mag 0 -400 LEFT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -150], [50, -150], [50, -291.5]]},+ {"name": "rt mag 0 -400 LEFT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [0, -400, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-48, 50], [-48, -350], [-8.5, -350]]},+ {"name": "rt mag -300 200 TOP TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [-250, -48], [-250, 191.5]]},+ {"name": "rt mag -300 200 TOP RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [-100, -48], [-100, 250], [-191.5, 250]]},+ {"name": "rt mag -300 200 TOP BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [-100, -48], [-100, 348], [-250, 348], [-250, 308.5]]},+ {"name": "rt mag -300 200 TOP LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "TOP", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -48], [-348, -48], [-348, 250], [-308.5, 250]]},+ {"name": "rt mag -300 200 RIGHT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, 150], [-250, 150], [-250, 191.5]]},+ {"name": "rt mag -300 200 RIGHT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, 250], [-191.5, 250]]},+ {"name": "rt mag -300 200 RIGHT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, 348], [-250, 348], [-250, 308.5]]},+ {"name": "rt mag -300 200 RIGHT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "RIGHT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[108, 50], [148, 50], [148, 150], [-348, 150], [-348, 250], [-308.5, 250]]},+ {"name": "rt mag -300 200 BOTTOM TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 150], [-250, 150], [-250, 191.5]]},+ {"name": "rt mag -300 200 BOTTOM RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 250], [-191.5, 250]]},+ {"name": "rt mag -300 200 BOTTOM BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 348], [-250, 348], [-250, 308.5]]},+ {"name": "rt mag -300 200 BOTTOM LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "BOTTOM", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[50, 108], [50, 150], [-348, 150], [-348, 250], [-308.5, 250]]},+ {"name": "rt mag -300 200 LEFT TOP", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "TOP", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-250, 50], [-250, 191.5]]},+ {"name": "rt mag -300 200 LEFT RIGHT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "RIGHT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-100, 50], [-100, 250], [-191.5, 250]]},+ {"name": "rt mag -300 200 LEFT BOTTOM", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "BOTTOM", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-100, 50], [-100, 348], [-250, 348], [-250, 308.5]]},+ {"name": "rt mag -300 200 LEFT LEFT", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "LEFT", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "LEFT", "box": [-300, 200, 100, 100], "outline": 2}, "vertices": [[-8, 50], [-348, 50], [-348, 250], [-308.5, 250]]},+ {"name": "rt free 300 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "NONE", "point": [300, -200]}, "vertices": [[50, -8], [50, -200], [300, -200]]},+ {"name": "rt free 400 50", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "NONE", "point": [400, 50]}, "vertices": [[108, 50], [400, 50]]},+ {"name": "rt free 50 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "NONE", "point": [50, -400]}, "vertices": [[50, -8], [50, -400]]},+ {"name": "rt free -300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "NONE", "point": [-300, 300]}, "vertices": [[-8, 50], [-150, 50], [-150, 300], [-300, 300]]},+ {"name": "rt obstacle", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [600, 0, 100, 100], "outline": 2}, "vertices": [[108, 50], [591.5, 50]]},+ {"name": "rt label 400 0 STRAIGHT", "lineType": "STRAIGHT", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "CENTER", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "CENTER", "box": [400, 0, 100, 100], "outline": 2}, "vertices": [[108, 50.0], [220.75, 50.0], [278.75, 50.0], [391.5, 50.0]], "segments": [[0, 1, [0, 0], [0, 0]], [2, 3, [0, 0], [0, 0]]], "label": {"text": [41, 24], "plate": [220.75, 29.5, 58, 41]}},+ {"name": "rt label 300 -300 ELBOWED", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [300, -300, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -108.5], [50, -149.5], [50, -250], [291.5, -250]], "segments": [[0, 1, [0, 0], [0, 0]], [2, 3, [0, 0], [0, 0]], [3, 4, [0, 0], [0, 0]]], "label": {"text": [41, 24], "plate": [21, -149.5, 58, 41]}},+ {"name": "rt label 200 -400 ELBOWED", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [200, -400, 100, 100], "outline": 2}, "vertices": [[50, -8], [50, -150], [121, -150], [179, -150], [250, -150], [250, -291.5]], "segments": [[0, 1, [0, 0], [0, 0]], [1, 2, [0, 0], [0, 0]], [3, 4, [0, 0], [0, 0]], [4, 5, [0, 0], [0, 0]]], "label": {"text": [41, 24], "plate": [121, -170.5, 58, 41]}},+ {"name": "rt label 400 -200 CURVED", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 2}, "end": {"magnet": "AUTO", "box": [400, -200, 100, 100], "outline": 2}, "vertices": [[108, 50], [235.61, -29.5], [264.26, -70.5], [391.5, -150]], "segments": [[0, 1, [62.89, 0], [-30.38, 42.31]], [2, 3, [30.35, -42.31], [-62.67, 0]]], "label": {"text": [41, 24], "plate": [220.94, -70.5, 58, 41]}},+ {"name": "ry NONE shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243, 120], [797, 120]]},+ {"name": "ry NONE shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[246, 120], [794, 120]]},+ {"name": "ry NONE shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[250.5, 120], [789.5, 120]]},+ {"name": "ry NONE shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248, 120], [792, 120]]},+ {"name": "ry NONE shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[251, 120], [789, 120]]},+ {"name": "ry NONE shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "NONE", "endCap": "NONE", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[255.5, 120], [784.5, 120]]},+ {"name": "ry ARROW_LINES shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243, 120], [797, 120]]},+ {"name": "ry ARROW_LINES shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[246.5, 120], [793.5, 120]]},+ {"name": "ry ARROW_LINES shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[250.5, 120], [789.5, 120]]},+ {"name": "ry ARROW_LINES shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248, 120], [792, 120]]},+ {"name": "ry ARROW_LINES shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[251.5, 120], [788.5, 120]]},+ {"name": "ry ARROW_LINES shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "ARROW_LINES", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[255.5, 120], [784.5, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243.25, 120], [797.25, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243.25, 120], [796.63, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243.25, 120], [796.61, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248.25, 120], [792.25, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248.25, 120], [791.63, 120]]},+ {"name": "ry ARROW_EQUILATERAL shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "ARROW_EQUILATERAL", "endCap": "ARROW_EQUILATERAL", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248.25, 120], [791.61, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[243, 120], [797, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[244.5, 120], [795.5, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[246.5, 120], [793.5, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[248, 120], [792, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[249.5, 120], [790.5, 120]]},+ {"name": "ry TRIANGLE_FILLED shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "TRIANGLE_FILLED", "endCap": "TRIANGLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[251.5, 120], [788.5, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry DIAMOND_FILLED shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "DIAMOND_FILLED", "endCap": "DIAMOND_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 0 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 0 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 0 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 0.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 0.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 10 weight 1", "lineType": "ELBOWED", "weight": 1, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 10 weight 4", "lineType": "ELBOWED", "weight": 4, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "ry CIRCLE_FILLED shape stroke 10 weight 8", "lineType": "ELBOWED", "weight": 8, "startCap": "CIRCLE_FILLED", "endCap": "CIRCLE_FILLED", "start": {"magnet": "AUTO", "box": [0, 0, 240, 240], "outline": 5.0}, "end": {"magnet": "AUTO", "box": [800, 0, 240, 240], "outline": 5.0}, "vertices": [[240, 120], [800, 120]]},+ {"name": "rz CURVED free 300 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, -200]}, "vertices": [[50, -6], [300, -200]], "segments": [[0, 1, [0, -130.6], [0, 136.6]]]},+ {"name": "rz CURVED free 400 50", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [400, 50]}, "vertices": [[106, 50], [400, 50]], "segments": [[0, 1, [0, 0], [0, 0]]]},+ {"name": "rz CURVED free 50 -400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [50, -400]}, "vertices": [[50, -6], [50, -400]], "segments": [[0, 1, [0, 0], [0, 0]]]},+ {"name": "rz CURVED free -300 300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [-300, 300]}, "vertices": [[-6, 50], [-300, 300]], "segments": [[0, 1, [-160.62, 0], [166.62, 0]]]},+ {"name": "rz CURVED free 210 -670", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [210, -670]}, "vertices": [[50, -6], [210, -670]], "segments": [[0, 1, [0, -287.9], [0, 293.9]]]},+ {"name": "rz CURVED free 150 -300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [150, -300]}, "vertices": [[50, -6], [150, -300]], "segments": [[0, 1, [0, -128.92], [0, 134.92]]]},+ {"name": "rz CURVED free 300 -100", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, -100]}, "vertices": [[106, 50], [300, -100]], "segments": [[0, 1, [100.67, 0], [-106.67, 0]]]},+ {"name": "rz CURVED free -100 -300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [-100, -300]}, "vertices": [[50, -6], [-100, -300]], "segments": [[0, 1, [0, -137.11], [0, 143.11]]]},+ {"name": "rz CURVED free 300 300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, 300]}, "vertices": [[106, 50], [300, 300]], "segments": [[0, 1, [130.6, 0], [-136.6, 0]]]},+ {"name": "rz CURVED free 120 400", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [120, 400]}, "vertices": [[50, 106], [120, 400]], "segments": [[0, 1, [0, 125.44], [0, -131.44]]]},+ {"name": "rz ELBOWED free 300 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, -200]}, "vertices": [[50, -6], [50, -200], [300, -200]]},+ {"name": "rz ELBOWED free 400 50", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [400, 50]}, "vertices": [[106, 50], [400, 50]]},+ {"name": "rz ELBOWED free 50 -400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [50, -400]}, "vertices": [[50, -6], [50, -400]]},+ {"name": "rz ELBOWED free -300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [-300, 300]}, "vertices": [[-6, 50], [-150, 50], [-150, 300], [-300, 300]]},+ {"name": "rz ELBOWED free 210 -670", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [210, -670]}, "vertices": [[50, -6], [50, -335], [210, -335], [210, -670]]},+ {"name": "rz ELBOWED free 150 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [150, -300]}, "vertices": [[50, -6], [50, -150], [150, -150], [150, -300]]},+ {"name": "rz ELBOWED free 300 -100", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, -100]}, "vertices": [[106, 50], [200, 50], [200, -100], [300, -100]]},+ {"name": "rz ELBOWED free -100 -300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [-100, -300]}, "vertices": [[50, -6], [50, -150], [-100, -150], [-100, -300]]},+ {"name": "rz ELBOWED free 300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [300, 300]}, "vertices": [[106, 50], [300, 50], [300, 300]]},+ {"name": "rz ELBOWED free 120 400", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "end": {"magnet": "NONE", "point": [120, 400]}, "vertices": [[50, 106], [50, 250], [120, 250], [120, 400]]},+ {"name": "rz CURVED freestart -300 300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [-300, 300]}, "end": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "vertices": [[-300, 300], [-6.5, 50]], "segments": [[0, 1, [166.62, 0], [-160.12, 0]]]},+ {"name": "rz CURVED freestart 210 -670", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [210, -670]}, "end": {"magnet": "AUTO", "box": [0, 0, 100, 100], "outline": 0}, "vertices": [[210, -670], [50, -6.5]], "segments": [[0, 1, [0, 293.9], [0, -287.4]]]},+ {"name": "rz CURVED bothfree 300 -200", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [0, 0]}, "end": {"magnet": "NONE", "point": [300, -200]}, "vertices": [[0, 0], [300, -200]], "segments": [[0, 1, [153.84, 0], [-153.84, 0]]]},+ {"name": "rz ELBOWED bothfree 300 -200", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [0, 0]}, "end": {"magnet": "NONE", "point": [300, -200]}, "vertices": [[0, 0], [150, 0], [150, -200], [300, -200]]},+ {"name": "rz CURVED bothfree -300 300", "lineType": "CURVED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [0, 0]}, "end": {"magnet": "NONE", "point": [-300, 300]}, "vertices": [[0, 0], [-300, 300]], "segments": [[0, 1, [-181.02, 0], [181.02, 0]]]},+ {"name": "rz ELBOWED bothfree -300 300", "lineType": "ELBOWED", "weight": 4, "startCap": "ROUND", "endCap": "ARROW_LINES", "start": {"magnet": "NONE", "point": [0, 0]}, "end": {"magnet": "NONE", "point": [-300, 300]}, "vertices": [[0, 0], [-150, 0], [-150, 300], [-300, 300]]}+]diff --git a/packages/scene-graph/tests/connectors/layout.test.ts b/packages/scene-graph/tests/connectors/layout.test.tsnew file mode 100644index 000000000..d99cca9ae--- /dev/null+++ b/packages/scene-graph/tests/connectors/layout.test.ts@@ -0,0 +1,123 @@+import { describe, expect, test } from 'bun:test'++import {+ attachedConnectors,+ boundEndpoint,+ buildConnectorSublayers,+ connectorRouteEnds,+ connectorSublayers,+ freeEndpoint,+ layoutConnector,+ SceneGraph,+ type Stroke+} from '@open-pencil/scene-graph'+import { BLACK } from '@open-pencil/scene-graph/constants'++function boxes() {+ const graph = new SceneGraph()+ const page = graph.getPages()[0].id+ const from = graph.createNode('RECTANGLE', page, { x: 0, y: 0, width: 100, height: 100 })+ const to = graph.createNode('RECTANGLE', page, { x: 400, y: 0, width: 100, height: 100 })+ const connector = graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(from.id),+ connectorEnd: boundEndpoint(to.id)+ })+ buildConnectorSublayers(graph, connector)+ return { graph, page, from, to, connector }+}++describe('connector layout', () => {+ test('places the connector on its route and the line inside it', () => {+ const { graph, connector } = boxes()+ expect(layoutConnector(graph, connector)).toBe(true)+ const { line } = connectorSublayers(graph, connector) ?? {}+ expect([connector.x, connector.y, connector.width, connector.height]).toEqual([+ 106, 50, 287.5, 0+ ])+ expect([line?.x, line?.y, line?.width, line?.height]).toEqual([0, 0, 287.5, 0])+ expect(line?.vectorNetwork?.vertices).toEqual([+ { x: 0, y: 0, strokeCap: 'ROUND' },+ { x: 287.5, y: 0, strokeCap: 'ARROW_LINES' }+ ])+ expect(layoutConnector(graph, connector)).toBe(false)+ })++ test('a shape keeps the connector clear of its stroke, hidden or not, and not of none', () => {+ const startFor = (strokes: Stroke[]) => {+ const graph = new SceneGraph()+ const page = graph.getPages()[0].id+ const shape = (x: number) =>+ graph.createNode('SHAPE_WITH_TEXT', page, {+ x,+ width: 100,+ height: 100,+ strokeWeight: 4,+ strokes+ })+ const connector = graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(shape(0).id),+ connectorEnd: boundEndpoint(shape(400).id)+ })+ buildConnectorSublayers(graph, connector)+ layoutConnector(graph, connector)+ return connectorRouteEnds(graph, connector)?.start.x+ }+ const stroke: Stroke = {+ type: 'SOLID',+ color: BLACK,+ opacity: 1,+ visible: true,+ weight: 4,+ align: 'CENTER'+ }+ // Measured in FigJam: a weight 4 connector stops 6 from a shape, plus half its stroke.+ expect(startFor([stroke])).toBe(108)+ expect(startFor([{ ...stroke, visible: false }])).toBe(108)+ expect(startFor([])).toBe(106)+ })++ test('an end whose layer is gone stays where the route last ended', () => {+ const { graph, to, connector } = boxes()+ layoutConnector(graph, connector)+ graph.deleteNode(to.id)+ graph.updateNode(connector.id, { connectorEnd: boundEndpoint(to.id) })+ layoutConnector(graph, connector)+ expect(connectorRouteEnds(graph, connector)?.end).toEqual({ x: 393.5, y: 50 })+ })++ test('a point on a layer follows the layer', () => {+ const { graph, from, connector } = boxes()+ graph.updateNode(connector.id, {+ connectorLineType: 'STRAIGHT',+ connectorStart: { nodeId: from.id, magnet: 'NONE', position: { x: 100, y: 20 } },+ connectorEnd: freeEndpoint(300, 20)+ })+ graph.updateNode(from.id, { y: 30 })+ layoutConnector(graph, connector)+ expect(connectorRouteEnds(graph, connector)).toEqual({+ start: { x: 100, y: 50 },+ end: { x: 300, y: 20 }+ })+ })++ test('the connectors attached to deleted layers are those with an end on or inside them', () => {+ const { graph, page, from, connector } = boxes()+ const frame = graph.createNode('FRAME', page, { x: 0, y: 300, width: 200, height: 200 })+ const inner = graph.createNode('RECTANGLE', frame.id, { width: 50, height: 50 })+ const nested = graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(inner.id),+ connectorEnd: freeEndpoint(500, 500)+ })+ const inside = graph.createNode('CONNECTOR', frame.id, {+ connectorStart: boundEndpoint(inner.id),+ connectorEnd: freeEndpoint(0, 0)+ })+ expect(attachedConnectors(graph, [from.id]).map((node) => node.id)).toEqual([connector.id])+ expect(attachedConnectors(graph, [frame.id]).map((node) => node.id)).toEqual([nested.id])+ expect(+ attachedConnectors(graph, [inner.id])+ .map((node) => node.id)+ .sort()+ ).toEqual([nested.id, inside.id].sort())+ })+})diff --git a/packages/scene-graph/tests/connectors/route.test.ts b/packages/scene-graph/tests/connectors/route.test.tsnew file mode 100644index 000000000..d31853709--- /dev/null+++ b/packages/scene-graph/tests/connectors/route.test.ts@@ -0,0 +1,160 @@+import { describe, expect, test } from 'bun:test'+import { readFileSync } from 'node:fs'++import * as v from 'valibot'++import {+ connectorNetwork,+ placeConnectorLabel,+ routeConnector,+ type ConnectorRouteEnd+} from '@open-pencil/scene-graph'++const MAGNETS = [+ 'NONE',+ 'AUTO',+ 'AUTO_HORIZONTAL',+ 'TOP',+ 'RIGHT',+ 'BOTTOM',+ 'LEFT',+ 'CENTER'+] as const+const CAPS = [+ 'NONE',+ 'ROUND',+ 'ARROW_LINES',+ 'ARROW_EQUILATERAL',+ 'TRIANGLE_FILLED',+ 'DIAMOND_FILLED',+ 'CIRCLE_FILLED'+] as const+const Pair = v.tuple([v.number(), v.number()])+const End = v.object({+ magnet: v.picklist(MAGNETS),+ box: v.optional(v.tuple([v.number(), v.number(), v.number(), v.number()])),+ outline: v.optional(v.number()),+ point: v.optional(Pair)+})++/**+ * Routes FigJam derived for connectors from a FigJam square at the origin, recorded on 2026-10-15:+ * squares around it in every direction and size, every magnet pair, caps, stroke weights, the+ * squares' own strokes (`outline`, half the stroke), free ends, and labels. Coordinates are+ * relative to the start square.+ */+const Oracle = v.array(+ v.object({+ name: v.string(),+ lineType: v.picklist(['ELBOWED', 'STRAIGHT', 'CURVED']),+ weight: v.number(),+ startCap: v.picklist(CAPS),+ endCap: v.picklist(CAPS),+ start: End,+ end: End,+ vertices: v.array(Pair),+ segments: v.optional(v.array(v.tuple([v.number(), v.number(), Pair, Pair]))),+ label: v.optional(+ v.object({ text: Pair, plate: v.tuple([v.number(), v.number(), v.number(), v.number()]) })+ )+ })+)++const oracle = v.parse(+ v.pipe(v.string(), v.parseJson(), Oracle),+ readFileSync(new URL('figma-routes.json', import.meta.url), 'utf8')+)++type Case = (typeof oracle)[number]++function routeEnd(end: Case['start'], cap: Case['startCap']): ConnectorRouteEnd {+ const [x, y, width, height] = end.box ?? [0, 0, 0, 0]+ const [px, py] = end.point ?? [0, 0]+ return {+ box: end.box ? { x, y, width, height } : null,+ point: { x: px, y: py },+ magnet: end.magnet,+ cap,+ outline: end.outline ?? 0+ }+}++function route(c: Case) {+ const pieces = routeConnector(+ c.lineType,+ routeEnd(c.start, c.startCap),+ routeEnd(c.end, c.endCap),+ c.weight+ )+ if (!c.label) return { pieces, plate: null }+ const [width, height] = c.label.text+ const placed = placeConnectorLabel(pieces, { width: width + 17, height: height + 17 })+ return { pieces: placed?.pieces ?? pieces, plate: placed?.plate ?? null }+}++/** The fixture keeps routes to a hundredth. */+const TOLERANCE = 0.01+/** Figma's gap for an equilateral arrow drifts by a few hundredths between connectors. */+const EQUILATERAL_TOLERANCE = 0.05++function close(actual: number, expected: number, tolerance = TOLERANCE) {+ return Math.abs(actual - expected) <= tolerance+}++describe('connector routes match Figma', () => {+ for (const c of oracle) {+ test(c.name, () => {+ const { pieces, plate } = route(c)+ const network = connectorNetwork(pieces, { x: 0, y: 0 }, { start: c.startCap, end: c.endCap })+ const tolerance = [c.startCap, c.endCap].includes('ARROW_EQUILATERAL')+ ? EQUILATERAL_TOLERANCE+ : TOLERANCE+ const vertices = network.vertices.map(({ x, y }) => [x, y])+ expect(vertices.length).toBe(c.vertices.length)+ for (const [index, [x, y]] of c.vertices.entries()) {+ const [ax, ay] = vertices[index]+ expect({ index, ok: close(ax, x, tolerance) && close(ay, y, tolerance) }).toEqual({+ index,+ ok: true+ })+ }+ const segments =+ c.segments ??+ c.vertices+ .slice(1)+ .map((_, index): [number, number, [number, number], [number, number]] => [+ index,+ index + 1,+ [0, 0],+ [0, 0]+ ])+ expect(network.segments.map(({ start, end }) => [start, end])).toEqual(+ segments.map(([start, end]) => [start, end])+ )+ for (const [index, [, , [t0x, t0y], [t1x, t1y]]] of segments.entries()) {+ const { tangentStart, tangentEnd } = network.segments[index]+ expect(+ close(tangentStart.x, t0x) &&+ close(tangentStart.y, t0y) &&+ close(tangentEnd.x, t1x) &&+ close(tangentEnd.y, t1y)+ ).toBe(true)+ }+ if (c.label) {+ if (!plate) throw new Error('A labelled case places no plate')+ const [x, y, width, height] = c.label.plate+ expect(+ [plate.x, plate.y, plate.width, plate.height].map((n) => Math.round(n * 100) / 100)+ ).toEqual([x, y, width, height])+ }+ })+ }+})++test('a label on a line with no length keeps the line its one point', () => {+ const point = { x: 50, y: 0 }+ const pieces = [{ from: point, to: point, handleFrom: { x: 0, y: 0 }, handleTo: { x: 0, y: 0 } }]+ const placed = placeConnectorLabel(pieces, { width: 40, height: 20 })+ expect(placed?.pieces).toEqual(pieces)+ expect(placed?.plate).toEqual({ x: 30, y: -10, width: 40, height: 20 })+})diff --git a/packages/scene-graph/tests/undo/extend.test.ts b/packages/scene-graph/tests/undo/extend.test.tsnew file mode 100644index 000000000..845bf4d5a--- /dev/null+++ b/packages/scene-graph/tests/undo/extend.test.ts@@ -0,0 +1,42 @@+import { expect, test } from 'bun:test'++import { UndoManager } from '@open-pencil/scene-graph'++test('a change a step caused joins it, so undo and redo apply them together', () => {+ const undo = new UndoManager()+ const log: string[] = []+ const step = { label: 'Move', forward: () => log.push('move'), inverse: () => log.push('unmove') }+ undo.push(step)+ const joined = undo.extendLastStep({+ label: 'Carry',+ forward: () => log.push('carry'),+ inverse: () => log.push('uncarry')+ })+ expect(joined).toBe(true)+ undo.undo()+ undo.redo()+ expect(log).toEqual(['uncarry', 'unmove', 'move', 'carry'])+ // The step is still the one its caller recorded.+ expect(undo.stateOf(step)).toBe('applied')+})++test('there is nothing to join before the first step', () => {+ const undo = new UndoManager()+ const noop = () => undefined+ expect(undo.extendLastStep({ label: 'Carry', forward: noop, inverse: noop })).toBe(false)+})++test('undo and redo say they are replaying while a step runs', () => {+ const undo = new UndoManager()+ const seen: boolean[] = []+ undo.push({+ label: 'Edit',+ forward: () => seen.push(undo.isReplaying),+ inverse: () => seen.push(undo.isReplaying)+ })+ expect(undo.isReplaying).toBe(false)+ undo.undo()+ undo.redo()+ expect(seen).toEqual([true, true])+ expect(undo.isReplaying).toBe(false)+})diff --git a/packages/vue/src/shared/input/select/move.ts b/packages/vue/src/shared/input/select/move.tsindex a640af5a4..4d2498035 100644--- a/packages/vue/src/shared/input/select/move.ts+++ b/packages/vue/src/shared/input/select/move.ts@@ -64,6 +64,13 @@ function autoLayoutMoveTarget(id: string, editor: Editor): string {return target?.id ?? id}+/** Whether a connector holds onto a layer at either end. */+function joinsLayer(node: SceneNode) {+ return (+ node.type === 'CONNECTOR' && [node.connectorStart, node.connectorEnd].some((end) => end?.nodeId)+ )+}+function collectMoveOriginals(editor: Editor) {const originals = new Map<string, MovePlace>()for (const selectedId of editor.state.selectedIds) {@@ -80,6 +87,11 @@ function collectMoveOriginals(editor: Editor) {})}}+ // FigJam moves a connector held by a layer only along with other layers; dragged alone, it+ // stays put.+ const [only] = originals.keys()+ const lone = originals.size === 1 ? editor.graph.getNode(only) : undefined+ if (lone && joinsLayer(lone)) originals.clear()return originals}diff --git a/packages/vue/tests/shared/input/move/connectors.test.ts b/packages/vue/tests/shared/input/move/connectors.test.tsnew file mode 100644index 000000000..d0393c2dd--- /dev/null+++ b/packages/vue/tests/shared/input/move/connectors.test.ts@@ -0,0 +1,67 @@+import { afterEach, describe, expect, test } from 'bun:test'++import { boundEndpoint, buildConnectorSublayers, freeEndpoint } from '@open-pencil/scene-graph'++import { createMoveHarness, type MoveHarness } from './harness'++// Each case replays an interaction observed in FigJam with real pointer input.++let h: MoveHarness++afterEach(() => h.editor.dispose())++const settle = () => Promise.resolve()++/** A box with a connector from its right side to a free point below and to the right. */+async function setup() {+ h = createMoveHarness()+ const { editor, node, page } = h+ const box = node('RECTANGLE', page, { x: 0, y: 0, width: 100, height: 100 })+ const other = node('RECTANGLE', page, { x: 600, y: 0, width: 100, height: 100 })+ const connector = editor.graph.createNode('CONNECTOR', page, {+ connectorStart: boundEndpoint(box.id)+ })+ buildConnectorSublayers(editor.graph, connector)+ // Routes it, as an edit to its ends does.+ editor.updateNode(connector.id, { connectorEnd: freeEndpoint(400, 300) })+ await settle()+ return { box, other, connector }+}++function freeEnd(id: string) {+ return h.editor.graph.getNode(id)?.connectorEnd?.position+}++describe('moving connectors', () => {+ test('a connector held by a layer stays put when dragged alone', async () => {+ const { connector } = await setup()+ const before = h.editor.graph.getNode(connector.id)?.x+ h.drag([connector.id], [250, 200], [330, 260])+ await settle()+ expect(freeEnd(connector.id)).toEqual({ x: 400, y: 300 })+ expect(h.editor.graph.getNode(connector.id)?.x).toBe(before)+ })++ test('dragged with another layer, its free end moves by the drag once', async () => {+ const { connector, other } = await setup()+ h.drag([other.id, connector.id], [650, 50], [730, 110])+ await settle()+ expect(freeEnd(connector.id)).toEqual({ x: 480, y: 360 })+ h.editor.undoAction()+ await settle()+ expect(freeEnd(connector.id)).toEqual({ x: 400, y: 300 })+ })++ test('a connector with only free ends drags on its own', async () => {+ const { connector } = await setup()+ h.editor.updateNode(connector.id, { connectorStart: freeEndpoint(200, 300) })+ await settle()+ h.drag([connector.id], [300, 300], [380, 360])+ await settle()+ expect(h.editor.graph.getNode(connector.id)?.connectorStart?.position).toEqual({+ x: 280,+ y: 360+ })+ expect(freeEnd(connector.id)).toEqual({ x: 480, y: 360 })+ })+})diff --git a/tests/e2e/canvas/connectors-visual.spec.ts b/tests/e2e/canvas/connectors-visual.spec.tsindex 3878e2d6e..bea998b4b 100644--- a/tests/e2e/canvas/connectors-visual.spec.ts+++ b/tests/e2e/canvas/connectors-visual.spec.ts@@ -2,8 +2,10 @@ import { readFile } from 'node:fs/promises'import { expect, test, useEditorSetupWithClear } from '#tests/e2e/fixtures'import { pasteFigmaClipboard } from '#tests/helpers/canvas/figma-paste'+import { layerDriver } from '#tests/helpers/canvas/layers'const editor = useEditorSetupWithClear('/?test&no-chrome&no-rulers')+const layers = layerDriver(() => editor.page)test('FigJam connectors draw their elbows, curve, caps, dashes, and label as Figma routed them', async () => {const html = await readFile('tests/fixtures/clipboard/figjam-connectors.html', 'utf8')@@ -12,3 +14,17 @@ test('FigJam connectors draw their elbows, curve, caps, dashes, and label as Figeditor.canvas.assertNoErrors()expect(await editor.canvas.screenshotCanvasRegion()).toMatchSnapshot('figjam-connectors.png')})++test('dragging a sticky routes the connectors attached to it again', async () => {+ const html = await readFile('tests/fixtures/clipboard/figjam-connectors.html', 'utf8')+ await pasteFigmaClipboard(editor.page, html)+ await editor.canvas.waitForRender()+ const center = await layers.screenCenter('c-B')+ await editor.canvas.drag(center.x, center.y, center.x - 260, center.y - 120)+ await layers.clearSelection()+ await editor.canvas.waitForRender()+ editor.canvas.assertNoErrors()+ expect(await editor.canvas.screenshotCanvasRegion()).toMatchSnapshot(+ 'figjam-connectors-moved.png'+ )+})diff --git a/tests/e2e/canvas/connectors-visual.spec.ts-snapshots/figjam-connectors-moved-openpencil-darwin.png b/tests/e2e/canvas/connectors-visual.spec.ts-snapshots/figjam-connectors-moved-openpencil-darwin.pngnew file mode 100644index 000000000..f079307e7Binary files /dev/null and b/tests/e2e/canvas/connectors-visual.spec.ts-snapshots/figjam-connectors-moved-openpencil-darwin.png differdiff --git a/tests/helpers/canvas/layers.ts b/tests/helpers/canvas/layers.tsnew file mode 100644index 000000000..b1e83b683--- /dev/null+++ b/tests/helpers/canvas/layers.ts@@ -0,0 +1,34 @@+import type { Page } from '@playwright/test'++import type { Vector } from '@open-pencil/scene-graph/primitives'++/** Probes and drivers for top-level layers on the current page, found by name. */+export function layerDriver(page: () => Page) {+ return {+ /** Where the centre of the named layer shows on the canvas, in canvas-element pixels. */+ screenCenter(name: string): Promise<Vector> {+ return page().evaluate((layerName) => {+ const store = window.openPencil?.getStore?.()+ if (!store) throw new Error('OpenPencil store not initialized')+ const layer = store.graph+ .getChildren(store.state.currentPageId)+ .find((node) => node.name === layerName)+ if (!layer) throw new Error(`No layer named ${layerName}`)+ const { zoom, panX, panY } = store.state+ return {+ x: (layer.x + layer.width / 2) * zoom + panX,+ y: (layer.y + layer.height / 2) * zoom + panY+ }+ }, name)+ },++ /** Driver: clears the selection, so a screenshot shows no handles. */+ clearSelection(): Promise<void> {+ return page().evaluate(() => {+ const store = window.openPencil?.getStore?.()+ if (!store) throw new Error('OpenPencil store not initialized')+ store.clearSelection()+ })+ }+ }+}