fix: update distance text calculation to include cone height in MeasurementTool

This commit is contained in:
Jerald-Golden-B 2025-05-22 16:37:02 +05:30
parent 73bb37e083
commit c2d952c190
3 changed files with 6 additions and 21 deletions

View File

@ -10,7 +10,7 @@ function updateDistanceText(
////////// Updating the Distance Texts of the lines that are affected during drag //////////
const DistanceGroup = scene.children.find((child) => child.name === "Distance_Text") as THREE.Group;
const DistanceGroup = scene.getObjectByName('Distance_Text') as THREE.Group;
affectedLines.forEach((lineIndex) => {
const mesh = floorPlanGroupLine.current.children[lineIndex] as THREE.Mesh;

View File

@ -10,7 +10,6 @@ function CommentInstance({ comment }: { comment: CommentSchema }) {
const [selectedComment, setSelectedComment] = useState<CommentSchema | null>(null);
const [transformMode, setTransformMode] = useState<"translate" | "rotate" | null>(null);
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
const keyCombination = detectModifierKeys(e);
@ -22,13 +21,13 @@ function CommentInstance({ comment }: { comment: CommentSchema }) {
setTransformMode((prev) => (prev === "rotate" ? null : "rotate"));
}
};
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
}, [selectedComment]);
if (comment.state === 'inactive' || isPlaying) return null;
return (
<>
@ -37,26 +36,12 @@ function CommentInstance({ comment }: { comment: CommentSchema }) {
zIndexRange={[1, 0]}
prepend
sprite
center
center
position={comment.position}
rotation={comment.rotation}
className='comments-main-wrapper'
>
<CommentThreads />
{/* <div
className='outer'
onClick={(e) => {
e.stopPropagation();
setSelectedComment(comment);
console.log("down");
}}
onPointerOver={(e) => {
e.stopPropagation();
}}>
<div>
hii
</div>
</div> */}
</Html>
{CommentRef.current && transformMode && (
<TransformControls

View File

@ -218,7 +218,7 @@ const MeasurementTool = () => {
sprite
>
<div>
{startConePosition.distanceTo(endConePosition).toFixed(2)} m
{(startConePosition.distanceTo(endConePosition) + (coneSize.height)).toFixed(2)} m
</div>
</Html>
)}