Paste where the view shows it, editor offsets included (#263)
Paste mixed two frames. The pointer comes from the Scene View, which draws every object moved by the editor offsets of it and its parents. Paste turned that point into a local position through the parents' plain world transform, so the copy landed beside the pointer by the offset of the parent it went into. Without a pointer, an original with an offset of its own had its copy placed beside its game position, which the view does not show. - A copied root now remembers where the view showed it (`ClipRoot.shown`, from `editorTransform`) instead of its world position. - New `editorLocalPositionFor` in `properties/transform.ts` turns a shown point into a local position through the parent chain with the editor offsets, as the view draws it. Paste uses it. - The copy itself still gets no editor offset of its own, as since #240. In the game it stands where it was drawn, minus the offsets of its parents. - Re-parenting under a parent with an offset still keeps the game position, so the object jumps in the view by that offset. That is a different rule from paste and is left as it is. Tests: - Unit (clipboard, groups, references, transform): 50 passed, 2 new. - e2e 51 on melektaus-atx: ALL PASSED, 12 checks, 1 new (51f). - Gate on melektaus-atx: 195 files, 2829 tests, CHECK EXIT 0. - Counter-checks: without the paste fix both new unit tests fail (copy at 540/470 instead of 500/500) and 51f fails by exactly the 60/-40 offset. With the root remembering its world position again, the own-offset unit test fails. - No full run. The e2e total of 1591 is 1590 plus 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9cff5282b6
commit
6d4247ebf8
7 files changed
+100
-23
No files matched your search
@@ -105,6 +105,24 @@ export async function clipboard(t) {
|
||||
JSON.stringify({ target, rows, inside }),
|
||||
);
|
||||
await undo();
|
||||
|
||||
// 51f. The red crate drawn aside by its editor offset (#263): Ctrl+V with it selected puts the
|
||||
// copy inside it and still right under the pointer, where the view shows the copy.
|
||||
await t.mutate(`
|
||||
__gm.state.activeScene.objects.find((o) => o.id === ${JSON.stringify(RED)}).editorOffset = { x: 60, y: -40 }`);
|
||||
await select({ kind: 'object', holderId: 'scene1', objectId: RED, objectIds: [RED] });
|
||||
const offsetSpot = await json('__gm.emptySpot()');
|
||||
await moveTo(offsetSpot);
|
||||
await press('v', { ctrl: true });
|
||||
const underRedId = (await selected()).objectId;
|
||||
const underRed = (await stored()).find((o) => o.id === underRedId);
|
||||
const shownAt = await json(`__gm.objectScreen(${JSON.stringify(underRedId)})`);
|
||||
check(
|
||||
'Ctrl+V into a parent with an editor offset still lands under the pointer',
|
||||
underRed?.assetId === 'crate' && underRed.parentId === RED && near(shownAt, offsetSpot),
|
||||
JSON.stringify({ offsetSpot, shownAt, underRed: underRed && underRed.position }),
|
||||
);
|
||||
await undo();
|
||||
check('the scene is back as it was', (await stored()).length === before.length);
|
||||
|
||||
// 51d. A node of the Mover behavior, copied and pasted under the pointer in its own graph.
|
||||
|
||||
Reference in new issue
Block a user