Initial TrueGrowth source import

This commit is contained in:
2026-07-07 09:36:36 +08:00
commit 3b6781d695
2283 changed files with 691996 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Change: 批量插入画布改为视口流式排布
## Why
当前批量插入默认按纵向堆叠,宽屏桌面下浪费横向空间,生成多张图片或音频卡片时需要大量向下滚动。
## What Changes
- 批量插入按当前画布可视宽度和缩放比例计算一行可用宽度
- 插入项先横向排布,超出一屏宽度后自动换行
- 插入完成后滚动到整批内容包围盒中心
- 服务层、MCP 工具层、自动入画布复用同一套布局计算
## Impact
- Affected specs:
- `canvas-insertion`
- Affected code:
- `packages/drawnix/src/utils/canvas-insertion-layout.ts`
- `packages/drawnix/src/services/canvas-operations/canvas-insertion.ts`
- `packages/drawnix/src/mcp/tools/canvas-insertion.ts`

View File

@@ -0,0 +1,29 @@
## ADDED Requirements
### Requirement: Batch canvas insertion uses viewport flow layout
Batch canvas insertion SHALL place inserted items left-to-right using the current canvas viewport width in canvas coordinates, then wrap to a new row when the next item would exceed that width.
For media items inserted through the batch path, the final insertion size SHALL remain stable for the batch flow and SHALL NOT be rewritten after load in a way that changes the batch spacing.
#### Scenario: Wide viewport fits multiple items on one row
- **GIVEN** the current canvas viewport can fit multiple batch items at the active zoom
- **WHEN** a batch insertion runs
- **THEN** items SHALL be inserted left-to-right on the same row until the next item would exceed the viewport width
#### Scenario: Narrow or zoomed-in viewport wraps items
- **GIVEN** the current canvas viewport cannot fit the next batch item at the active zoom
- **WHEN** a batch insertion runs
- **THEN** the next item SHALL be inserted at the batch start x coordinate on the next row
- **AND** the next row SHALL start after the tallest item in the previous row plus the configured vertical gap
#### Scenario: Batch insertion scrolls to the batch center
- **GIVEN** one or more items were inserted by a batch insertion
- **WHEN** insertion completes
- **THEN** the canvas SHALL scroll toward the center of the inserted batch bounds
#### Scenario: Batch media sizes stay stable
- **GIVEN** image or video items are inserted through the batch flow
- **WHEN** the media finishes loading
- **THEN** the batch spacing SHALL remain based on the original batch layout size
- **AND** later media resizing SHALL NOT shift the row spacing for the completed batch

View File

@@ -0,0 +1,20 @@
# Tasks: 批量插入画布视口流式排布
## 1. Layout
- [x] 1.1 增加共享视口流式布局工具
- [x] 1.2 使用画布容器宽度和 zoom 计算画布坐标宽度
- [x] 1.3 按行最高元素推进换行 y 坐标
## 2. Integration
- [x] 2.1 服务层批量插入接入共享布局
- [x] 2.2 MCP 插入工具接入共享布局
- [x] 2.3 Markdown 卡片宽度改为视口感知
- [x] 2.4 插入后滚动到整批内容中心
## 3. Verification
- [x] 3.1 补充流式排布单元测试
- [x] 3.2 运行定向测试
- [x] 3.3 收口图片批量插入尺寸回写