From c2d952c190a824a1e29249bf542e02263cc22636 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Thu, 22 May 2025 16:37:02 +0530 Subject: [PATCH 1/2] fix: update distance text calculation to include cone height in MeasurementTool --- .../geomentries/lines/updateDistanceText.ts | 2 +- .../commentInstance/commentInstance.tsx | 23 ++++--------------- .../modules/scene/tools/measurementTool.tsx | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/src/modules/builder/geomentries/lines/updateDistanceText.ts b/app/src/modules/builder/geomentries/lines/updateDistanceText.ts index 8a5a1cc..8d7fbe2 100644 --- a/app/src/modules/builder/geomentries/lines/updateDistanceText.ts +++ b/app/src/modules/builder/geomentries/lines/updateDistanceText.ts @@ -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; diff --git a/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx b/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx index 5b5c145..1efff39 100644 --- a/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx +++ b/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx @@ -10,7 +10,6 @@ function CommentInstance({ comment }: { comment: CommentSchema }) { const [selectedComment, setSelectedComment] = useState(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' > - {/*
{ - e.stopPropagation(); - setSelectedComment(comment); - console.log("down"); - }} - onPointerOver={(e) => { - e.stopPropagation(); - }}> -
- hii -
-
*/} {CommentRef.current && transformMode && ( { sprite >
- {startConePosition.distanceTo(endConePosition).toFixed(2)} m + {(startConePosition.distanceTo(endConePosition) + (coneSize.height)).toFixed(2)} m
)} From 07b98b92ee33d2c1dec59afc9f6ee0401b1ea00c Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Thu, 22 May 2025 17:02:48 +0530 Subject: [PATCH 2/2] feat: enhance CommentThreads component with commentClicked prop and update reply structure --- .../ui/collaboration/CommentThreads.tsx | 32 +++++++++++++++---- .../commentInstance/commentInstance.tsx | 9 ++++-- .../comments/instances/commentInstances.tsx | 2 +- app/src/types/collaborationTypes.d.ts | 2 +- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/app/src/components/ui/collaboration/CommentThreads.tsx b/app/src/components/ui/collaboration/CommentThreads.tsx index 2d41abc..ed8d563 100644 --- a/app/src/components/ui/collaboration/CommentThreads.tsx +++ b/app/src/components/ui/collaboration/CommentThreads.tsx @@ -1,7 +1,11 @@ import React, { useState } from "react"; import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor"; -const CommentThreads: React.FC = () => { +interface CommentThreadsProps { + commentClicked: () => void; +} + +const CommentThreads: React.FC = ({ commentClicked }) => { const [expand, setExpand] = useState(false); const commentsedUsers = [{ creatorId: "1" }]; @@ -12,11 +16,25 @@ const CommentThreads: React.FC = () => { createdAt: "2 hours ago", comment: "Thread check", lastUpdatedAt: "string", - replies: [], + replies: [ + { + replyId: 'string', + creatorId: 'string', + createdAt: 'string', + lastUpdatedAt: 'string', + reply: 'string', + }, + { + replyId: 'string', + creatorId: 'string', + createdAt: 'string', + lastUpdatedAt: 'string', + reply: 'string', + } + ], }; function getUsername(userId: string) { - console.log(userId); const UserName = "username"; return UserName; } @@ -24,6 +42,7 @@ const CommentThreads: React.FC = () => { function getDetails(type?: "clicked") { if (type === "clicked") { setExpand(true); + commentClicked(); } else { setExpand((prev) => !prev); } @@ -35,9 +54,8 @@ const CommentThreads: React.FC = () => { onPointerEnter={() => getDetails()} onPointerLeave={() => getDetails()} onClick={() => getDetails("clicked")} - className={`comments-threads-container ${ - expand ? "open" : "closed" - } unread`} + className={`comments-threads-container ${expand ? "open" : "closed" + } unread`} >
{commentsedUsers.map((val, i) => ( @@ -61,7 +79,7 @@ const CommentThreads: React.FC = () => {
{CommentDetails.comment}
{CommentDetails.replies.length > 0 && ( -
{CommentDetails.replies.length}
+
{CommentDetails.replies.length} reply(s)
)} diff --git a/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx b/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx index 1efff39..1b23a98 100644 --- a/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx +++ b/app/src/modules/collaboration/comments/instances/commentInstance/commentInstance.tsx @@ -26,6 +26,11 @@ function CommentInstance({ comment }: { comment: CommentSchema }) { return () => window.removeEventListener("keydown", handleKeyDown); }, [selectedComment]); + const commentClicked = () => { + console.log('hii'); + setSelectedComment(comment); + } + if (comment.state === 'inactive' || isPlaying) return null; return ( @@ -36,12 +41,12 @@ function CommentInstance({ comment }: { comment: CommentSchema }) { zIndexRange={[1, 0]} prepend sprite - center + center position={comment.position} rotation={comment.rotation} className='comments-main-wrapper' > - + {CommentRef.current && transformMode && ( { - console.log('comments: ', comments); + // console.log('comments: ', comments); }, [comments]) return ( diff --git a/app/src/types/collaborationTypes.d.ts b/app/src/types/collaborationTypes.d.ts index 26295d5..151ee58 100644 --- a/app/src/types/collaborationTypes.d.ts +++ b/app/src/types/collaborationTypes.d.ts @@ -10,7 +10,7 @@ interface CommentSchema { replies: Reply[]; } -export interface Reply { +interface Reply { replyId: string; creatorId: string; createdAt: string;