Skip to content

Commit 531347e

Browse files
committed
Fix overflow
1 parent 60a27e1 commit 531347e

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

src/Bugzilla.tsx

Whitespace-only changes.

src/Graph.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ interface GraphProps {
4848

4949
export function Graph(props: GraphProps) {
5050
const containerRef = useRef<HTMLDivElement>(null);
51+
const graphContainerRef = useRef<HTMLDivElement>(null);
5152
const [scale, setScale] = useState(1);
5253
const [position, setPosition] = useState({ x: 0, y: 0 });
5354
const [isDragging, setIsDragging] = useState(false);
@@ -207,12 +208,24 @@ export function Graph(props: GraphProps) {
207208
highlightSelectedNode();
208209
}, [highlightSelectedNode]);
209210

210-
const handleWheel = useCallback((e: React.WheelEvent) => {
211+
const handleWheel = useCallback((e: WheelEvent) => {
211212
e.preventDefault();
212213
const delta = e.deltaY > 0 ? 0.9 : 1.1;
213214
setScale((prev) => Math.max(0.1, Math.min(3, prev * delta)));
214215
}, []);
215216

217+
// Add wheel event listener with ref
218+
useEffect(() => {
219+
const element = graphContainerRef.current;
220+
if (!element) return;
221+
222+
element.addEventListener("wheel", handleWheel, { passive: false });
223+
224+
return () => {
225+
element.removeEventListener("wheel", handleWheel);
226+
};
227+
}, [handleWheel]);
228+
216229
const handleMouseDown = useCallback(
217230
(e: React.MouseEvent) => {
218231
if (e.button === 0) {
@@ -273,8 +286,8 @@ export function Graph(props: GraphProps) {
273286

274287
{/* Graph Container */}
275288
<div
289+
ref={graphContainerRef}
276290
className={`w-full h-full cursor-grab active:cursor-grabbing ${props.selectedNodeId ? "pr-80" : ""}`}
277-
onWheel={handleWheel}
278291
onMouseDown={handleMouseDown}
279292
onMouseMove={handleMouseMove}
280293
onMouseUp={handleMouseUp}

src/Splitter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const Splitter: React.FC<SplitterProps> = ({
9595
return (
9696
<div
9797
ref={containerRef}
98-
className={`flex ${isHorizontal ? "flex-row" : "flex-col"} h-full w-full ${className}`}
98+
className={`flex ${isHorizontal ? "flex-row" : "flex-col"} ${className}`}
9999
>
100100
{/* First Panel */}
101101
<div style={firstPanelStyle} className="overflow-hidden">

src/TechTreeViewer.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ export function TechTreeViewer(props: TechTreeViewerProps) {
308308
rel="noopener noreferrer"
309309
onClick={(e) => {
310310
if (treeIndex !== 0) {
311-
if (!confirm("You have unsaved changes. Are you sure you want to go back?")) {
311+
if (
312+
!confirm(
313+
"You have unsaved changes. Are you sure you want to go back?",
314+
)
315+
) {
312316
return;
313317
}
314318
}
@@ -390,7 +394,11 @@ export function TechTreeViewer(props: TechTreeViewerProps) {
390394
<Hamburger menuItems={menuItems} />
391395
</div>
392396
</div>
393-
<Splitter direction="horizontal" initialSplit={66} className="flex-1">
397+
<Splitter
398+
direction="horizontal"
399+
initialSplit={66}
400+
className="flex-1 w-full overflow-hidden"
401+
>
394402
<div className="bg-gray-50 w-full h-full">
395403
{!rootNodeId && (
396404
<NodePicker

0 commit comments

Comments
 (0)