A frame that keeps its corners can be stretched to any size (#41)
game-maker / suite (push) Successful in 6m21s

TextureFrame carries optional `border` (left/right/top/bottom) and
`fill` (stretch | repeat); absent keys mean "not sliced", so no format
bump and undo restores the plain frame instead of four zeroes.

The sliced sprite builds its own geometry instead of the shared
UNIT_QUAD: a 4x4 grid, and for `repeat` one quad per tile carrying the
frame cell's real UVs -- tiling in the geometry, not in the sampler, so
a frame out of a sheet cannot pull its neighbour in. Above 64 tiles per
axis it stretches, to bound the buffer.

A sprite narrower than left+right scales both borders down together
until the middle is exactly 0, so the corners meet at a seam and never
overlap.

The texture editor gets four draggable border lines plus the same four
numbers in the inspector. Hit order is resize handles, then the lines,
then the frame body -- handleAt reports 'move' anywhere inside a frame,
so lines placed after it were unreachable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-16 12:04:09 +02:00
1 parent b9f1a9d319
commit be8f2331de
17 files changed
+1091 -31

No files matched your search

+19 -2
View File
@@ -33,7 +33,7 @@ import {
import { PROJECT_FORMAT_VERSION, type Project } from '../model/Project';
import { readScope } from '../model/Scope';
import type { SceneObject } from '../model/SceneObject';
import { isTextureFile, normalizeFrameRect } from '../model/texture';
import { isTextureFile, normalizeBorders, normalizeFrameRect, setFrameSlice } from '../model/texture';
import { hasParentCycle } from '../model/walk';
import {
DECLARED_PORT_KINDS,
@@ -433,7 +433,24 @@ function normalizeTexture(
width,
height,
);
frames.push({ id, name: typeof f.name === 'string' ? f.name : '', ...rect });
const frame: TextureFrame = { id, name: typeof f.name === 'string' ? f.name : '', ...rect };
// Against the frame, not the image: the borders are distances inside the cut-out. A frame
// without them is one nobody sliced, and keeps saying so.
const border = asRecord(f.border);
setFrameSlice(frame, {
border: normalizeBorders(
{
left: toNumber(border.left),
top: toNumber(border.top),
right: toNumber(border.right),
bottom: toNumber(border.bottom),
},
rect.w,
rect.h,
),
fill: f.fill === 'repeat' ? 'repeat' : 'stretch',
});
frames.push(frame);
}
return { file, width, height, frames };
}