Skip to content

AI-native design editor. Open-source Figma alternative.

fix(canvas): include arrow caps in bounds and controls

Danila Poyarkov3702f9c93ab0
diff --git a/packages/scene-graph/src/geometry.ts b/packages/scene-graph/src/geometry.ts
index d615a2157..9b21d991c 100644
--- a/packages/scene-graph/src/geometry.ts
+++ b/packages/scene-graph/src/geometry.ts
@@ -226,6 +226,8 @@ export interface VisualBoundsNode {
flipX?: boolean
flipY?: boolean
strokes?: Stroke[]
+ strokeCap?: StrokeCap
+ vectorNetwork?: VectorNetwork | null
effects?: Effect[]
fillGeometry?: Array<{ commandsBlob: Uint8Array }>
strokeGeometry?: Array<{ commandsBlob: Uint8Array }>
diff --git a/src/components/properties/StrokeSection.vue b/src/components/properties/StrokeSection.vue
index 488949f6a..d685f2220 100644
--- a/src/components/properties/StrokeSection.vue
+++ b/src/components/properties/StrokeSection.vue
@@ -280,7 +280,12 @@ function onToggleSides(activeNode: SceneNode | null) {
<Tip :label="option.label">
<icon-lucide-minus v-if="option.value === 'NONE'" class="size-3" />
<icon-lucide-circle v-else-if="option.value === 'ROUND'" class="size-2.5" />
- <icon-lucide-square v-else class="size-2.5" />
+ <icon-lucide-square v-else-if="option.value === 'SQUARE'" class="size-2.5" />
+ <icon-lucide-arrow-right
+ v-else-if="option.value === 'ARROW_LINES'"
+ class="size-3"
+ />
+ <icon-lucide-triangle v-else class="size-2.5" />
</Tip>
</template>
</SegmentedControl>
diff --git a/tests/engine/geometry/visual-bounds.test.ts b/tests/engine/geometry/visual-bounds.test.ts
index 0257e8e21..af1f5e682 100644
--- a/tests/engine/geometry/visual-bounds.test.ts
+++ b/tests/engine/geometry/visual-bounds.test.ts
@@ -402,6 +402,35 @@ describe('computeVisualBounds', () => {
expect(outsideBounds).toEqual({ minX: 9, minY: 19, maxX: 111, maxY: 71 })
})
+ test('descendant bounds include arrow overflow', () => {
+ const nodes = {
+ root: {
+ id: 'root',
+ type: 'FRAME',
+ width: 100,
+ height: 50,
+ visible: true,
+ childIds: ['line']
+ },
+ line: {
+ id: 'line',
+ type: 'LINE',
+ width: 100,
+ height: 0,
+ visible: true,
+ strokeCap: 'ARROW_EQUILATERAL' as const,
+ strokes: [{ weight: 4, visible: true, align: 'CENTER' as const }],
+ childIds: []
+ }
+ }
+ const bounds = computeDescendantVisualBounds(
+ ['root'],
+ (id) => nodes[id as keyof typeof nodes],
+ () => ({ x: 0, y: 0 })
+ )
+ expect(bounds?.minY).toBe(-18)
+ })
+
test('nested clipping stops descendants outside the ancestor clip', () => {
const nodes = {
root: {