feat: Enhance cursor handling and mouse action notes in the footer and builder components
This commit is contained in:
@@ -9,6 +9,7 @@ import * as Constants from '../../../types/world/worldConstants';
|
||||
import { useVersionContext } from '../version/versionContext';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { getUserData } from '../../../functions/getUserData';
|
||||
import { handleCanvasCursors } from '../../../utils/mouseUtils/handleCanvasCursors';
|
||||
|
||||
// import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { deleteWallApi } from '../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
@@ -23,7 +24,7 @@ interface LineProps {
|
||||
|
||||
function Line({ points }: Readonly<LineProps>) {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const { raycaster, camera, pointer, gl } = useThree();
|
||||
const { raycaster, camera, pointer } = useThree();
|
||||
const plane = useMemo(() => new THREE.Plane(new THREE.Vector3(0, 1, 0), 0), []);
|
||||
const [isDeletable, setIsDeletable] = useState(false);
|
||||
const { socket } = useSocketStore();
|
||||
@@ -213,7 +214,7 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
});
|
||||
}
|
||||
}
|
||||
gl.domElement.style.cursor = 'default';
|
||||
handleCanvasCursors('default');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +225,7 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
const hit = raycaster.ray.intersectPlane(plane, intersectionPoint);
|
||||
|
||||
if (hit) {
|
||||
gl.domElement.style.cursor = 'move';
|
||||
handleCanvasCursors('grabbing');
|
||||
const positionWithOffset = new THREE.Vector3().addVectors(hit, dragOffset);
|
||||
|
||||
const start = new THREE.Vector3(...points[0].position);
|
||||
@@ -269,7 +270,7 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
|
||||
const handleDragEnd = (points: [Point, Point]) => {
|
||||
if (toolMode !== 'move' || !dragOffset) return;
|
||||
gl.domElement.style.cursor = 'default';
|
||||
handleCanvasCursors('default');
|
||||
setDragOffset(null);
|
||||
if (points[0].pointType === 'Wall' && points[1].pointType === 'Wall') {
|
||||
const updatedWalls1 = getWallsByPointId(points[0].pointUuid);
|
||||
@@ -377,14 +378,14 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
setHoveredLine(points);
|
||||
setIsHovered(true)
|
||||
if (toolMode === 'move' && !hoveredPoint) {
|
||||
gl.domElement.style.cursor = 'pointer';
|
||||
handleCanvasCursors('grab');
|
||||
}
|
||||
}
|
||||
}}
|
||||
onPointerOut={() => {
|
||||
if (hoveredLine) {
|
||||
setHoveredLine(null);
|
||||
gl.domElement.style.cursor = 'default';
|
||||
handleCanvasCursors('default');
|
||||
}
|
||||
setIsHovered(false)
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user