Skip to content

Commit

Permalink
Fix: issue in square seat placement
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Dec 26, 2024
1 parent cafaf00 commit 0ce5864
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Changelog

# v3.2.4 [2024-12-26]

## Patch Release

### Fixes
- Fixed square seat placement issue


# v3.2.3 [2024-12-25]

## Patch Release
Expand Down
15 changes: 5 additions & 10 deletions src/components/workspace/elements/seat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ const Seat: React.FC<ISeatProps> = forwardRef(
let value = (+ref.current?.getAttribute("cx") || x) - seatLabelFontSize / 3.5;
const labelLength = label?.toString()?.length ?? 0;
if (labelLength >= 2) value -= (seatLabelFontSize / 2.75) * (labelLength - 1);
if (element.square) value += seatSizeHalf;
return value;
}, [ref, label, x]);

const textY = useMemo(() => {
return (+ref.current?.getAttribute("cy") || y) + seatLabelFontSize / 2.75;
let value = (+ref.current?.getAttribute("cy") || y) + seatLabelFontSize / 2.75;
if (element.square) value += seatSizeHalf;
return value;
}, [ref, label, y]);

useEffect(() => {
Expand Down Expand Up @@ -139,15 +142,7 @@ const Seat: React.FC<ISeatProps> = forwardRef(
return (
<>
{element.square ? (
<rect
x={x - seatSizeHalf}
y={y - seatSizeHalf}
height={seatSize}
width={seatSize}
rx={3}
ry={3}
{...seatProps}
/>
<rect x={x} y={y} height={seatSize} width={seatSize} rx={3} ry={3} {...seatProps} />
) : (
<circle cx={x} cy={y} r={seatSizeHalf} {...seatProps} />
)}
Expand Down

0 comments on commit 0ce5864

Please sign in to comment.