Add pixel-size fit and drag-to-reorder in the hierarchy

The aspect button now carries two offers, so it becomes a menu: fit one
side to the texture ratio, or set both sides to the exact pixel size as a
single undo step.

Dropping a row on the outer quarter of another row inserts it into that
gap instead of parenting into it, reordering among the siblings there.
Order is the stored order, so ReorderObjectCommand is a splice; equal z
falls back to tree order, which makes this the way to draw one object in
front of another. Rejected on container content like the other structural
edits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-08 22:20:46 +02:00
1 parent f40b8a0523
commit 4568c6581b
17 files changed
+416 -85

No files matched your search

+17 -1
View File
@@ -2,7 +2,12 @@ import { describe, expect, it } from 'vitest';
import { CreateTextureCommand } from '../../src/core/commands/assetCommands';
import { AddFrameCommand } from '../../src/core/commands/frameCommands';
import type { PropertyBag } from '../../src/core/model/Properties';
import { fitAxisToAspect, matchesAspect, texturePixelSize } from '../../src/core/properties/aspect';
import {
fitAxisToAspect,
matchesAspect,
matchesPixelSize,
texturePixelSize,
} from '../../src/core/properties/aspect';
import { makeSpriteScene } from '../helpers';
const FILE = `${'a1b2c3d4'.repeat(8)}.png`;
@@ -54,6 +59,17 @@ describe('fitAxisToAspect', () => {
});
});
describe('matchesPixelSize', () => {
const size = { w: 64, h: 48 };
it('asks for both sides, unlike the proportions', () => {
expect(matchesPixelSize(size, props({ width: 64, height: 48 }))).toBe(true);
// Proportional, but half the size: the "set to 64 × 48 px" action still has something to do.
expect(matchesPixelSize(size, props({ width: 32, height: 24 }))).toBe(false);
expect(matchesAspect(size, props({ width: 32, height: 24 }))).toBe(true);
});
});
describe('matchesAspect', () => {
it('compares proportions, not sizes', () => {
const size = { w: 64, h: 48 };