selected object is highlighted only in editor

This commit is contained in:
azykov@mail.ru
2026-06-02 08:13:39 +03:00
parent ca5dea5093
commit f3033d1d0d
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -16,7 +16,8 @@ export const ObjectView = observer(function ({ object }: ObjectViewProps) {
if (!objectType) if (!objectType)
return null; return null;
const isSelected = state.worldEditor.selectedObjectId === object.id; const isSelected = state.worldEditor.isEnabled &&
state.worldEditor.selectedObjectId === object.id;
const handleClick = (e: { stopPropagation: () => void }) => { const handleClick = (e: { stopPropagation: () => void }) => {
if (!state.worldEditor.isEnabled) if (!state.worldEditor.isEnabled)
+3
View File
@@ -5,6 +5,7 @@ import { CharacterState } from "./character";
import type { Pos3, V3 } from "../types/3d"; import type { Pos3, V3 } from "../types/3d";
import { clone, randomId } from "../utils"; import { clone, randomId } from "../utils";
import type { VoxelType } from "../types/voxel"; import type { VoxelType } from "../types/voxel";
import { state } from "./root";
export class WorldState { export class WorldState {
public data: World = WorldFactory.create(); public data: World = WorldFactory.create();
@@ -117,6 +118,8 @@ export class WorldState {
scene: clone(this.data.intialScene), scene: clone(this.data.intialScene),
} }
} }
state.worldEditor.setSelectedObjectId(undefined);
} }
public pause(): void { public pause(): void {