more precise object click handling
This commit is contained in:
parent
42e6d17167
commit
4d8de50d58
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue