Skip to content

Commit

Permalink
Merge pull request #12 from mezh-hq/development
Browse files Browse the repository at this point in the history
Fixed an issue in custom seat icon visibility
  • Loading branch information
Akalanka47000 authored Dec 5, 2024
2 parents 6252b75 + 7852fbe commit eb1fe7e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 48 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mezh-hq/react-seat-toolkit",
"version": "3.0.0",
"version": "3.0.1-blizzard.0",
"description": "React UI library to design and render seat layouts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down
33 changes: 16 additions & 17 deletions src/components/workspace/cursor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,26 @@ export const Cursor = () => {

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

const workspace = document.getElementById(ids.workspace)?.getBoundingClientRect();
const zoomControls = document.getElementById(ids.zoomControls)?.getBoundingClientRect();
const mainControls = document.getElementById(ids.controls)?.getBoundingClientRect();

const move = (e) => {
const ptr = pointer(e);
const x = ptr[0];
const y = ptr[1];
const workspace = document.getElementById(ids.workspace)?.getBoundingClientRect();
const zoomControls = document.getElementById(ids.zoomControls)?.getBoundingClientRect();
const mainControls = document.getElementById(ids.controls)?.getBoundingClientRect();
if (workspace) {
const customCursor = document.getElementById(ids.cursor);
if (
isWithinBounds(x, y, workspace) &&
!isWithinBounds(x, y, zoomControls) &&
!isWithinBounds(x, y, mainControls) &&
!resizeCursors.includes(e.target?.style?.cursor) &&
!e.target.id.includes("radix:") &&
e.target.getAttribute("role") !== "dialog"
) {
customCursor.style.display = "block";
} else {
customCursor.style.display = "none";
}
const customCursor = document.getElementById(ids.cursor);
if (
isWithinBounds(x, y, workspace) &&
!isWithinBounds(x, y, zoomControls) &&
!isWithinBounds(x, y, mainControls) &&
!resizeCursors.includes(e.target?.style?.cursor) &&
!e.target.id.includes("radix:") &&
e.target.getAttribute("role") !== "dialog"
) {
customCursor.classList.remove("hidden");
} else {
customCursor.classList.add("hidden");
}
setCursorX(x);
setCursorY(y);
Expand Down
2 changes: 1 addition & 1 deletion src/components/workspace/elements/seat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const Seat: React.FC<ISeatProps> = forwardRef(
width={seatSize * 0.75}
height={seatSize * 0.75}
size={seatSize * 0.75}
className={consumer.styles?.elements?.seat?.icon?.className}
className={twMerge(consumer.styles?.elements?.seat?.icon?.className, "stk-seat-icon")}
style={consumer.styles?.elements?.seat?.icon?.properties}
/>
)}
Expand Down
13 changes: 0 additions & 13 deletions src/stories/designer/basic.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ export const Story = {
render: (props) => <SeatToolkit mode={STKMode.DESIGNER} {...props} />
};

export const WithoutFooter = {
render: (props) => (
<SeatToolkit
mode={STKMode.DESIGNER}
{...props}
options={{
showFooter: false,
...props.options
}}
/>
)
};

export const WithReloadButton = {
render: (props) => (
<SeatToolkit
Expand Down
5 changes: 0 additions & 5 deletions src/stories/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ export const options = {
...disableArgTypes(["options"]),
...prefixKeys(
{
showFooter: {
control: "boolean",
description: "Show or hide the footer",
defaultValue: { summary: true }
},
showGridSwitch: {
control: "boolean",
description: "Show or hide the grid switch",
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ rect.workspace-selection {
fill-opacity: 0.5;
}

.stk-core svg * {
.stk-core svg *:not(.stk-seat-icon *) {
transform-box: fill-box;
}
1 change: 0 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export interface ISTKProps {
options?: {
showGridSwitch?: boolean;
showSeatLabels?: boolean;
showFooter?: boolean;
showZoomControls?: boolean;
showVisibilityControls?: boolean;
showReloadButton?: boolean;
Expand Down
9 changes: 0 additions & 9 deletions src/types/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,11 @@ export interface IStyles {
input?: IStyle;
trigger?: IStyle;
};
footer?: {
root?: IStyle;
title?: IStyle;
meta?: IStyle;
};
zoomControls?: {
in?: IStyle;
out?: IStyle;
root?: IStyle;
};
panControls?: {
root?: IStyle;
innerRing?: IStyle;
handles?: {
up?: IStyle;
right?: IStyle;
Expand All @@ -44,7 +36,6 @@ export interface IStyles {
};
};
visibilityControls?: {
root?: IStyle;
buttons?: IStyle;
};
reloadButton?: IStyle;
Expand Down

0 comments on commit eb1fe7e

Please sign in to comment.