ea29887d9c
- 快速编辑支持最多8张额外参考图,并将原图自动作为最后一张参考图提交 - 快速编辑尺寸和模型沿用原图配置,按禁用态参数胶囊展示 - 快速编辑提交前同步改写原图引用为实际图序号 - 快速编辑生成改为创建独立画布生成占位,并支持键盘删除生成中对象 - 对齐生成类面板参考图图标、规范类固定参数和相关文档测试
31 lines
890 B
TypeScript
31 lines
890 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { resizeCropExpandFrame } from './ImageCanvasCropExpandModel';
|
|
|
|
describe('ImageCanvasCropExpandModel', () => {
|
|
it('resizes crop-expand frame freely from canvas handles', () => {
|
|
expect(
|
|
resizeCropExpandFrame({
|
|
frame: { x: 100, y: 80, width: 200, height: 120 },
|
|
handle: 'right',
|
|
deltaX: 40,
|
|
deltaY: 0,
|
|
ratio: 'free',
|
|
}),
|
|
).toEqual({ x: 100, y: 80, width: 240, height: 120 });
|
|
});
|
|
|
|
it('keeps a fixed ratio while dragging a crop-expand handle', () => {
|
|
const frame = resizeCropExpandFrame({
|
|
frame: { x: 100, y: 80, width: 200, height: 120 },
|
|
handle: 'bottom-right',
|
|
deltaX: 80,
|
|
deltaY: 10,
|
|
ratio: '1:1',
|
|
});
|
|
|
|
expect(frame.width).toBe(frame.height);
|
|
expect(frame).toEqual({ x: 100, y: 80, width: 280, height: 280 });
|
|
});
|
|
});
|