Refactor target label creation logic in commit-transform-session-command.ts
This commit is contained in:
@@ -26,39 +26,51 @@ import {
|
|||||||
} from "../core/transform-session";
|
} from "../core/transform-session";
|
||||||
|
|
||||||
function createTransformCommandLabel(session: ActiveTransformSession): string {
|
function createTransformCommandLabel(session: ActiveTransformSession): string {
|
||||||
return `${getTransformOperationLabel(session.operation)} ${
|
let targetLabel = "model instance";
|
||||||
session.target.kind === "brush"
|
|
||||||
? "whitebox box"
|
switch (session.target.kind) {
|
||||||
: session.target.kind === "brushFace"
|
case "brush":
|
||||||
? "whitebox face"
|
targetLabel = "whitebox box";
|
||||||
: session.target.kind === "brushEdge"
|
break;
|
||||||
? "whitebox edge"
|
case "brushFace":
|
||||||
: session.target.kind === "brushVertex"
|
targetLabel = "whitebox face";
|
||||||
? "whitebox vertex"
|
break;
|
||||||
: session.target.kind === "entity"
|
case "brushEdge":
|
||||||
? session.target.entityKind === "playerStart"
|
targetLabel = "whitebox edge";
|
||||||
|
break;
|
||||||
|
case "brushVertex":
|
||||||
|
targetLabel = "whitebox vertex";
|
||||||
|
break;
|
||||||
|
case "pathPoint":
|
||||||
|
targetLabel = "path point";
|
||||||
|
break;
|
||||||
|
case "entity":
|
||||||
|
targetLabel =
|
||||||
|
session.target.entityKind === "playerStart"
|
||||||
? "player start"
|
? "player start"
|
||||||
: session.target.entityKind === "npc"
|
: session.target.entityKind === "npc"
|
||||||
? "NPC"
|
? "NPC"
|
||||||
: session.target.entityKind === "pointLight"
|
: session.target.entityKind === "pointLight"
|
||||||
? "point light"
|
? "point light"
|
||||||
: session.target.entityKind === "spotLight"
|
: session.target.entityKind === "spotLight"
|
||||||
? "spot light"
|
? "spot light"
|
||||||
: session.target.entityKind === "soundEmitter"
|
: session.target.entityKind === "soundEmitter"
|
||||||
? "sound emitter"
|
? "sound emitter"
|
||||||
: session.target.entityKind === "triggerVolume"
|
: session.target.entityKind === "triggerVolume"
|
||||||
? "trigger volume"
|
? "trigger volume"
|
||||||
: session.target.entityKind === "sceneEntry"
|
: session.target.entityKind === "sceneEntry"
|
||||||
? "scene entry"
|
? "scene entry"
|
||||||
: session.target.entityKind === "teleportTarget"
|
: session.target.entityKind === "teleportTarget"
|
||||||
? "teleport target"
|
? "teleport target"
|
||||||
: session.target.entityKind === "interactable"
|
: session.target.entityKind === "interactable"
|
||||||
? "interactable"
|
? "interactable"
|
||||||
: "scene exit"
|
: "scene exit";
|
||||||
: session.target.kind === "pathPoint"
|
break;
|
||||||
? "path point"
|
case "modelInstance":
|
||||||
: "model instance"
|
break;
|
||||||
}`;
|
}
|
||||||
|
|
||||||
|
return `${getTransformOperationLabel(session.operation)} ${targetLabel}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createCommitTransformSessionCommand(document: SceneDocument, session: ActiveTransformSession): EditorCommand {
|
export function createCommitTransformSessionCommand(document: SceneDocument, session: ActiveTransformSession): EditorCommand {
|
||||||
|
|||||||
Reference in New Issue
Block a user