Z-order via position.z and reset-to-default for asset properties
- Position is now { x, y, z }; higher z draws on top, ties keep hierarchy order
- Viewport sorts the objects layer deterministically (syncDrawOrder)
- Inspector shows a Z field; asset properties that differ from the schema
default are marked bold with a reset button (ResetAssetPropertyCommand)
- isModified() helper, unit tests, E2E checks and seed updated
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
aaa8154adf
commit
d4b1ffa051
18 files changed
+232
-63
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { isPlaceableType } from '../model/AssetTypes';
|
||||
import type { PropertyValue, Vec2 } from '../model/Properties';
|
||||
import type { Position, PropertyValue, Vec2 } from '../model/Properties';
|
||||
import { findScene, findSceneObject, type Project } from '../model/Project';
|
||||
import { createSceneObject, type SceneObject } from '../model/SceneObject';
|
||||
import { coerceValue, schemaFor } from '../properties/PropertySchema';
|
||||
@@ -24,7 +24,7 @@ export class PlaceAssetCommand implements Command {
|
||||
readonly label = 'Place asset';
|
||||
readonly objectId = newId();
|
||||
|
||||
constructor(private readonly sceneId: string, private readonly assetId: string, private readonly position: Vec2) {}
|
||||
constructor(private readonly sceneId: string, private readonly assetId: string, private readonly position: Vec2 | Position) {}
|
||||
|
||||
execute(project: Project): void {
|
||||
const scene = requireScene(project, this.sceneId);
|
||||
@@ -60,15 +60,16 @@ export class RemoveSceneObjectCommand implements Command {
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the full position (x, y and draw order z) of a scene object. */
|
||||
export class MoveSceneObjectCommand implements Command {
|
||||
readonly label = 'Move object';
|
||||
private previous: Vec2 = { x: 0, y: 0 };
|
||||
private previous: Position = { x: 0, y: 0, z: 0 };
|
||||
|
||||
constructor(
|
||||
private readonly sceneId: string,
|
||||
private readonly objectId: string,
|
||||
private readonly position: Vec2,
|
||||
previous?: Vec2,
|
||||
private readonly position: Position,
|
||||
previous?: Position,
|
||||
) {
|
||||
if (previous) this.previous = { ...previous };
|
||||
}
|
||||
@@ -76,7 +77,7 @@ export class MoveSceneObjectCommand implements Command {
|
||||
execute(project: Project): void {
|
||||
const object = requireObject(project, this.sceneId, this.objectId);
|
||||
this.previous = { ...object.position };
|
||||
object.position = { x: this.position.x, y: this.position.y };
|
||||
object.position = { x: this.position.x, y: this.position.y, z: this.position.z };
|
||||
}
|
||||
|
||||
undo(project: Project): void {
|
||||
|
||||
Reference in new issue
Block a user