created points using pen icon
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { DragControls, Line } from "@react-three/drei";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useActiveSubTool, useToolMode } from "../../../../store/builder/store";
|
||||
import { useActiveTool, useToolMode } from "../../../../store/builder/store";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import { LineCurve3, Plane, Vector3 } from "three";
|
||||
import { getPathsByPointId, setPathPosition } from "./function/getPaths";
|
||||
@@ -49,7 +49,7 @@ export default function PathHandler({
|
||||
paths?: any;
|
||||
}>({});
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const { activeSubTool } = useActiveSubTool();
|
||||
const { activeTool } = useActiveTool();
|
||||
const plane = useMemo(() => new Plane(new Vector3(0, 1, 0), 0), []);
|
||||
const path = useMemo(() => {
|
||||
const [start, end] = points.map((p) => new Vector3(...p.position));
|
||||
@@ -64,7 +64,7 @@ export default function PathHandler({
|
||||
}
|
||||
};
|
||||
const handleDragStart = (points: [PointData, PointData]) => {
|
||||
if (activeSubTool !== "free-hand") return;
|
||||
if (activeTool !== "cursor") return;
|
||||
const intersectionPoint = new Vector3();
|
||||
const hit = raycaster.ray.intersectPlane(plane, intersectionPoint);
|
||||
if (hit) {
|
||||
@@ -106,6 +106,7 @@ export default function PathHandler({
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
const handleDrag = (points: [PointData, PointData]) => {
|
||||
if (isHovered && dragOffset) {
|
||||
const intersectionPoint = new Vector3();
|
||||
|
||||
Reference in New Issue
Block a user