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