more precise object click handling

This commit is contained in:
azykov@mail.ru 2026-06-02 13:58:42 +03:00
parent 42e6d17167
commit 4d8de50d58
No known key found for this signature in database
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import type { ObjectInstance } from "../types";
import { useEffect, useRef, type RefObject } from "react";
import type { Group, Mesh } from "three";
import { Edges, TransformControls } from "@react-three/drei";
import type { ThreeEvent } from "@react-three/fiber";
import { state } from "../state";
import { nextSelectionEditMode } from "../state/worldEditor";
import type { R3 } from "../types/3d";
@ -38,9 +39,11 @@ export const ObjectView = observer(function ({ object }: ObjectViewProps) {
};
}, [isSelected]);
const handleClick = (e: { stopPropagation: () => void }) => {
const handleClick = (e: ThreeEvent<MouseEvent>) => {
if (!state.worldEditor.isEnabled)
return;
if (e.delta > 5)
return;
e.stopPropagation();
state.worldEditor.setSelectedObject(object.id, nextSelectionEditMode(selectionMode));