A frame with borders tiles unless told to stretch
The fill of a sliced frame defaulted to `Stretch`. It is `Repeat` now, and the Fill dropdown lists `Repeat` first. The saved document keeps writing only the fill that differs from the default, so the key it carries is now `stretch`, and a frame without it repeats. A frame saved before with the key absent and meaning stretch would therefore tile; none of the stored projects has one - both sliced frames on the server carry `fill: "repeat"` explicitly, so they draw as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
94a0a578ed
commit
bf0be66c9d
6 files changed
+54
-27
No files matched your search
@@ -117,7 +117,7 @@ function refFor(asset: TextureAsset, frame: TextureFrame | null): TextureRef | n
|
||||
}
|
||||
|
||||
export const NO_BORDERS: FrameBorders = { left: 0, top: 0, right: 0, bottom: 0 };
|
||||
export const DEFAULT_FILL: FrameFill = 'stretch';
|
||||
export const DEFAULT_FILL: FrameFill = 'repeat';
|
||||
|
||||
/** Whole pixels of the frame that must stay between two opposite borders (see `normalizeBorders`). */
|
||||
export const MIN_SLICE_MIDDLE = 1;
|
||||
@@ -127,7 +127,7 @@ export function frameBorders(frame: TextureFrame): FrameBorders {
|
||||
}
|
||||
|
||||
export function frameFill(frame: TextureFrame): FrameFill {
|
||||
return frame.fill === 'repeat' ? 'repeat' : DEFAULT_FILL;
|
||||
return frame.fill === 'stretch' ? 'stretch' : DEFAULT_FILL;
|
||||
}
|
||||
|
||||
export function hasBorders(border: FrameBorders): boolean {
|
||||
@@ -181,9 +181,9 @@ export function setFrameSlice(frame: TextureFrame, slice: FrameSlice): void {
|
||||
const border = normalizeBorders(slice.border, frame.w, frame.h);
|
||||
if (hasBorders(border)) frame.border = border;
|
||||
else delete frame.border;
|
||||
// Kept even without borders: a fill chosen before the borders are dragged would otherwise
|
||||
// snap back to "stretch" under the hand that just set it.
|
||||
if (slice.fill === 'repeat') frame.fill = 'repeat';
|
||||
// Only the fill that differs from `DEFAULT_FILL` is written. Kept even without borders: a fill
|
||||
// chosen before the borders are dragged would otherwise snap back under the hand that just set it.
|
||||
if (slice.fill !== DEFAULT_FILL) frame.fill = slice.fill;
|
||||
else delete frame.fill;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,13 @@ import {
|
||||
import { PROJECT_FORMAT_VERSION, type Project } from '../model/Project';
|
||||
import { readScope } from '../model/Scope';
|
||||
import type { SceneObject } from '../model/SceneObject';
|
||||
import { isTextureFile, normalizeBorders, normalizeFrameRect, setFrameSlice } from '../model/texture';
|
||||
import {
|
||||
DEFAULT_FILL,
|
||||
isTextureFile,
|
||||
normalizeBorders,
|
||||
normalizeFrameRect,
|
||||
setFrameSlice,
|
||||
} from '../model/texture';
|
||||
import { hasParentCycle } from '../model/walk';
|
||||
import {
|
||||
DECLARED_PORT_KINDS,
|
||||
@@ -448,7 +454,7 @@ function normalizeTexture(
|
||||
rect.w,
|
||||
rect.h,
|
||||
),
|
||||
fill: f.fill === 'repeat' ? 'repeat' : 'stretch',
|
||||
fill: f.fill === 'stretch' ? 'stretch' : DEFAULT_FILL,
|
||||
});
|
||||
frames.push(frame);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user