Skip to content

Commit 0ce5864

Browse files
committed
Fix: issue in square seat placement
1 parent cafaf00 commit 0ce5864

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Changelog
22

3+
# v3.2.4 [2024-12-26]
4+
5+
## Patch Release
6+
7+
### Fixes
8+
- Fixed square seat placement issue
9+
10+
311
# v3.2.3 [2024-12-25]
412

513
## Patch Release

src/components/workspace/elements/seat.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ const Seat: React.FC<ISeatProps> = forwardRef(
6464
let value = (+ref.current?.getAttribute("cx") || x) - seatLabelFontSize / 3.5;
6565
const labelLength = label?.toString()?.length ?? 0;
6666
if (labelLength >= 2) value -= (seatLabelFontSize / 2.75) * (labelLength - 1);
67+
if (element.square) value += seatSizeHalf;
6768
return value;
6869
}, [ref, label, x]);
6970

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

7477
useEffect(() => {
@@ -139,15 +142,7 @@ const Seat: React.FC<ISeatProps> = forwardRef(
139142
return (
140143
<>
141144
{element.square ? (
142-
<rect
143-
x={x - seatSizeHalf}
144-
y={y - seatSizeHalf}
145-
height={seatSize}
146-
width={seatSize}
147-
rx={3}
148-
ry={3}
149-
{...seatProps}
150-
/>
145+
<rect x={x} y={y} height={seatSize} width={seatSize} rx={3} ry={3} {...seatProps} />
151146
) : (
152147
<circle cx={x} cy={y} r={seatSizeHalf} {...seatProps} />
153148
)}

0 commit comments

Comments
 (0)