Skip to content

Commit eb1fe7e

Browse files
Merge pull request #12 from mezh-hq/development
Fixed an issue in custom seat icon visibility
2 parents 6252b75 + 7852fbe commit eb1fe7e

File tree

8 files changed

+19
-48
lines changed

8 files changed

+19
-48
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mezh-hq/react-seat-toolkit",
3-
"version": "3.0.0",
3+
"version": "3.0.1-blizzard.0",
44
"description": "React UI library to design and render seat layouts",
55
"main": "dist/index.cjs",
66
"module": "dist/index.mjs",

src/components/workspace/cursor.tsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,26 @@ export const Cursor = () => {
1313

1414
const Cursor = useSelector((state: any) => state.editor.cursor);
1515

16+
const workspace = document.getElementById(ids.workspace)?.getBoundingClientRect();
17+
const zoomControls = document.getElementById(ids.zoomControls)?.getBoundingClientRect();
18+
const mainControls = document.getElementById(ids.controls)?.getBoundingClientRect();
19+
1620
const move = (e) => {
1721
const ptr = pointer(e);
1822
const x = ptr[0];
1923
const y = ptr[1];
20-
const workspace = document.getElementById(ids.workspace)?.getBoundingClientRect();
21-
const zoomControls = document.getElementById(ids.zoomControls)?.getBoundingClientRect();
22-
const mainControls = document.getElementById(ids.controls)?.getBoundingClientRect();
23-
if (workspace) {
24-
const customCursor = document.getElementById(ids.cursor);
25-
if (
26-
isWithinBounds(x, y, workspace) &&
27-
!isWithinBounds(x, y, zoomControls) &&
28-
!isWithinBounds(x, y, mainControls) &&
29-
!resizeCursors.includes(e.target?.style?.cursor) &&
30-
!e.target.id.includes("radix:") &&
31-
e.target.getAttribute("role") !== "dialog"
32-
) {
33-
customCursor.style.display = "block";
34-
} else {
35-
customCursor.style.display = "none";
36-
}
24+
const customCursor = document.getElementById(ids.cursor);
25+
if (
26+
isWithinBounds(x, y, workspace) &&
27+
!isWithinBounds(x, y, zoomControls) &&
28+
!isWithinBounds(x, y, mainControls) &&
29+
!resizeCursors.includes(e.target?.style?.cursor) &&
30+
!e.target.id.includes("radix:") &&
31+
e.target.getAttribute("role") !== "dialog"
32+
) {
33+
customCursor.classList.remove("hidden");
34+
} else {
35+
customCursor.classList.add("hidden");
3736
}
3837
setCursorX(x);
3938
setCursorY(y);

src/components/workspace/elements/seat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const Seat: React.FC<ISeatProps> = forwardRef(
152152
width={seatSize * 0.75}
153153
height={seatSize * 0.75}
154154
size={seatSize * 0.75}
155-
className={consumer.styles?.elements?.seat?.icon?.className}
155+
className={twMerge(consumer.styles?.elements?.seat?.icon?.className, "stk-seat-icon")}
156156
style={consumer.styles?.elements?.seat?.icon?.properties}
157157
/>
158158
)}

src/stories/designer/basic.stories.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@ export const Story = {
1313
render: (props) => <SeatToolkit mode={STKMode.DESIGNER} {...props} />
1414
};
1515

16-
export const WithoutFooter = {
17-
render: (props) => (
18-
<SeatToolkit
19-
mode={STKMode.DESIGNER}
20-
{...props}
21-
options={{
22-
showFooter: false,
23-
...props.options
24-
}}
25-
/>
26-
)
27-
};
28-
2916
export const WithReloadButton = {
3017
render: (props) => (
3118
<SeatToolkit

src/stories/options.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export const options = {
99
...disableArgTypes(["options"]),
1010
...prefixKeys(
1111
{
12-
showFooter: {
13-
control: "boolean",
14-
description: "Show or hide the footer",
15-
defaultValue: { summary: true }
16-
},
1712
showGridSwitch: {
1813
control: "boolean",
1914
description: "Show or hide the grid switch",

src/styles/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ rect.workspace-selection {
1919
fill-opacity: 0.5;
2020
}
2121

22-
.stk-core svg * {
22+
.stk-core svg *:not(.stk-seat-icon *) {
2323
transform-box: fill-box;
2424
}

src/types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export interface ISTKProps {
7070
options?: {
7171
showGridSwitch?: boolean;
7272
showSeatLabels?: boolean;
73-
showFooter?: boolean;
7473
showZoomControls?: boolean;
7574
showVisibilityControls?: boolean;
7675
showReloadButton?: boolean;

src/types/styles.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,11 @@ export interface IStyles {
2323
input?: IStyle;
2424
trigger?: IStyle;
2525
};
26-
footer?: {
27-
root?: IStyle;
28-
title?: IStyle;
29-
meta?: IStyle;
30-
};
3126
zoomControls?: {
3227
in?: IStyle;
3328
out?: IStyle;
34-
root?: IStyle;
3529
};
3630
panControls?: {
37-
root?: IStyle;
38-
innerRing?: IStyle;
3931
handles?: {
4032
up?: IStyle;
4133
right?: IStyle;
@@ -44,7 +36,6 @@ export interface IStyles {
4436
};
4537
};
4638
visibilityControls?: {
47-
root?: IStyle;
4839
buttons?: IStyle;
4940
};
5041
reloadButton?: IStyle;

0 commit comments

Comments
 (0)