0797410eef
* 支持从项目, 本地电脑, 主站导入/引用素材. * 页面复杂, 需要足够空间, 作为资源打开时会占满右侧 * 编辑结果作为一种新的美术资源. * 新增素材按钮现在是空的实现, 临时在旁边加了一个新增UI设计的按钮 临时入口:  简化: * 组件实现了最基本的图片和文本 * 容器式布局未接入llm编辑 * 不同阶段统一维护一个状态State, 任何阶段都可以人工调整, 不设单独的步骤 * 多图的UI合并功能暂时不要求, 隐藏入口 * 因为生成工具尚未从主站迁移, 主站地图子画布未实现, 以tab栏的形式容纳素材的子画布需求搁置 * 未实现llm绑定字体功能 * 识别会替换现有UI树, 暂时不是增量的 Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/170 Co-authored-by: 王德宇 <kvtodev@outlook.com> Co-committed-by: 王德宇 <kvtodev@outlook.com>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
resizePageRect,
|
|
resolveProportionalResizeAxis,
|
|
} from '../src/features/ui-editor/nodeTransformGeometry';
|
|
|
|
describe('proportional resize', () => {
|
|
it('selects the axis with the greater relative size change', () => {
|
|
expect(resolveProportionalResizeAxis([100, 100], [30, -20])).toBe(
|
|
'horizontal',
|
|
);
|
|
expect(resolveProportionalResizeAxis([100, 100], [20, -30])).toBe(
|
|
'vertical',
|
|
);
|
|
});
|
|
|
|
it('uses the supplied locked axis instead of the larger candidate size', () => {
|
|
expect(
|
|
resizePageRect(
|
|
{ min: [0, 0], max: [100, 100] },
|
|
'se',
|
|
[50, -10],
|
|
true,
|
|
'horizontal',
|
|
),
|
|
).toEqual({ min: [0, 0], max: [150, 150] });
|
|
});
|
|
|
|
it('uses the locked vertical axis for an opposite-sign diagonal drag', () => {
|
|
expect(
|
|
resizePageRect(
|
|
{ min: [0, 0], max: [100, 100] },
|
|
'se',
|
|
[10, -50],
|
|
true,
|
|
'vertical',
|
|
),
|
|
).toEqual({ min: [0, 0], max: [50, 50] });
|
|
});
|
|
});
|