Trim needless comments and fix the picker width
Remove comments that only restate the code, keeping the section banners and the notes that carry a reason, a measured fact or an external contract. ButtonOptions.width claimed to be a fixed width but only set minWidth, so the Graph and Texture pickers grew with the name they showed. It is now what it promises, with a separate minWidth for the buttons that have two forms. Narrow buttons shrink their padding, otherwise a 24px icon button had 8px left for its glyph and truncate dropped it entirely. __gm.labelsDropped() guards that class: the overflow guard only saw text that was too wide, never a label truncated to nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f16801aef3
commit
4d84231b9f
115 files changed
+707
-1564
No files matched your search
@@ -18,7 +18,6 @@ import { makeSpriteScene, place, roundTrip } from '../helpers';
|
||||
const FILE = `${'a1b2c3d4'.repeat(8)}.png`;
|
||||
const OTHER_FILE = `${'0f'.repeat(32)}.webp`;
|
||||
|
||||
/** Adds a texture asset carrying `file` and returns it. */
|
||||
function addTexture(fixture: ReturnType<typeof makeSpriteScene>, file = FILE, name = 'Bricks') {
|
||||
const command = new CreateTextureCommand(name, { file, width: 64, height: 48 });
|
||||
fixture.stack.execute(command);
|
||||
@@ -51,7 +50,7 @@ describe('resolveTexture', () => {
|
||||
const sprite = findAsset(fixture.project, fixture.spriteId)!;
|
||||
sprite.props.texture = texture.id;
|
||||
|
||||
// A whole-texture reference carries no rectangle: the renderer then needs no matrix at all.
|
||||
// A whole-texture reference carries no rectangle.
|
||||
const whole = { file: FILE, rect: null, sourceWidth: 64, sourceHeight: 48 };
|
||||
expect(resolveTexture(fixture.project, sprite.props)).toEqual({ ...whole, smooth: true });
|
||||
texture.props.filter = 'nearest';
|
||||
@@ -64,8 +63,6 @@ describe('resolveTexture', () => {
|
||||
texture.frames.push({ id: 'f1', name: 'Idle', x: 16, y: 8, w: 32, h: 24 });
|
||||
const sprite = findAsset(fixture.project, fixture.spriteId)!;
|
||||
|
||||
// The same property holds either kind of id, which is what keeps sprites written before
|
||||
// frames existed meaning exactly what they meant.
|
||||
sprite.props.texture = 'f1';
|
||||
expect(resolveTexture(fixture.project, sprite.props)).toEqual({
|
||||
file: FILE,
|
||||
@@ -146,8 +143,7 @@ describe('findPropertyUsages', () => {
|
||||
sprite.props.texture = texture.id;
|
||||
const objectId = place(fixture, fixture.spriteId, { x: 0, y: 0 });
|
||||
|
||||
// A texture is never placed, so the "is it used?" question `findUsages` answers is blind
|
||||
// to it – that is exactly the gap this function fills.
|
||||
// A texture is never placed, so `findUsages` is blind to it – hence this function.
|
||||
expect(findUsages(fixture.project, texture.id)).toHaveLength(0);
|
||||
|
||||
const usages = findPropertyUsages(fixture.project, texture.id);
|
||||
@@ -165,8 +161,7 @@ describe('findPropertyUsages', () => {
|
||||
texture.frames.push({ id: 'f1', name: 'Idle', x: 0, y: 0, w: 8, h: 8 });
|
||||
findAsset(fixture.project, fixture.spriteId)!.props.texture = 'f1';
|
||||
|
||||
// Asking by the asset id alone under-reports exactly the sheets that were sliced – the
|
||||
// ones with the most users – which is why deleting one asks about every id it owns.
|
||||
// The asset id alone under-reports sliced sheets, so deleting one asks about every id it owns.
|
||||
expect(findPropertyUsages(fixture.project, texture.id)).toHaveLength(0);
|
||||
expect(findPropertyUsages(fixture.project, textureRefIds(texture))).toHaveLength(1);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user