Skip to content

Commit 67f7751

Browse files
committed
Fix: zoom and pan control responsiveness
1 parent 3ca4cff commit 67f7751

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/components/workspace/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export const Workspace: React.FC<ISTKProps> = (props) => {
4343
[selectedElementIds]
4444
);
4545

46+
const showZoomControls = props.options?.showZoomControls ?? true;
47+
4648
return (
4749
<div
4850
id={ids.workspaceContainer}
@@ -119,7 +121,7 @@ export const Workspace: React.FC<ISTKProps> = (props) => {
119121
<Grid />
120122
</>
121123
)}
122-
<Zoom {...props} />
124+
{showZoomControls && <Zoom {...props} />}
123125
</div>
124126
);
125127
};

src/components/workspace/zoom.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ const Zoom = (props: ISTKProps) => {
101101
return (
102102
<div
103103
id={ids.zoomControls}
104-
className={twMerge("fixed bottom-14 left-20 flex flex-col items-center gap-4", zoomStyles?.root?.className)}
104+
className={twMerge(
105+
"fixed bottom-14 left-20 flex flex-col items-center gap-4",
106+
props.mode === "user" && "bottom-5 left-6 sm:bottom-6 sm:left-8 md:bottom-8 md:left-10",
107+
zoomStyles?.root?.className
108+
)}
105109
style={zoomStyles?.root?.properties}
106110
>
107111
<div

src/hooks/events/workspace-load.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const useWorkspaceLoad = (props: ISTKProps) => {
2323
const scaleFactor = 1.05;
2424
panAndZoom({
2525
k: scaleFactor,
26-
y: (workspaceheight - (wgOffsetTop * scaleFactor * 2 + workspaceGroupHeight * scaleFactor)) / 2 - 5,
26+
y: (workspaceheight - (wgOffsetTop * scaleFactor * 2 + workspaceGroupHeight * scaleFactor)) / 2 - 7,
2727
x: (workspaceWidth - (wgOffsetLeft * scaleFactor * 2 + workspaceGroupWidth * scaleFactor)) / 2
2828
});
2929
}, 0);

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface ISTKProps {
4343
showGridSwitch?: boolean;
4444
showSeatLabels?: boolean;
4545
showFooter?: boolean;
46+
showZoomControls?: boolean;
4647
exportButtonText?: string;
4748
operationTriggerIcon?: React.FC;
4849
};

0 commit comments

Comments
 (0)