From 1d249618fd39b9503f4f880ed5e9ead93d8a4d5c Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Thu, 29 Feb 2024 09:51:15 +0530 Subject: [PATCH] Patch: removed seat select outline --- src/components/workspace/elements/index.tsx | 71 +++++++-------------- 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/src/components/workspace/elements/index.tsx b/src/components/workspace/elements/index.tsx index 63da450..ae76039 100644 --- a/src/components/workspace/elements/index.tsx +++ b/src/components/workspace/elements/index.tsx @@ -1,4 +1,4 @@ -import { memo, useEffect, useMemo, useRef } from "react"; +import { memo, useEffect, useRef } from "react"; import * as d3 from "d3"; import { isEqual } from "lodash"; import { twMerge } from "tailwind-merge"; @@ -6,7 +6,6 @@ import { dataAttributes } from "@/constants"; import { store } from "@/store"; import { clearAndSelectElements, deselectElement, selectElement } from "@/store/reducers/editor"; import { STKMode } from "@/types"; -import { d3Extended } from "@/utils"; import { Tool } from "../../toolbar/data"; import { ElementType, @@ -23,21 +22,8 @@ export * from "./utils"; export const Element = ({ type = ElementType.Seat, id, x = 250, y = 250, isSelected = false, options, ...props }) => { const ref = useRef(); - const node = ref.current && d3.select(ref.current); - - const centerCoords = isSelected && options.mode === STKMode.Designer && node && d3Extended.getNodeCenter(node); - const Element = elements[type]; - const controlRadius = useMemo(() => { - if (!node) return 0; - switch (type) { - case ElementType.Seat: - return +node.attr("r") * 6; - } - return +node.attr("width") * 1.5; - }, [node]); - useEffect(() => { if (!ref.current || options.mode !== STKMode.Designer) return; const node = d3.select(ref.current); @@ -73,40 +59,27 @@ export const Element = ({ type = ElementType.Seat, id, x = 250, y = 250, isSelec }; return ( - <> - {centerCoords && - ![ElementType.Text, ElementType.Shape, ElementType.Image, ElementType.Polyline].includes(type) && ( - - )} - - + ); };