Skip to content

Commit

Permalink
Merge pull request #432 from boostcampwm-2024/feature/fe/#258-qa
Browse files Browse the repository at this point in the history
[FE][Feat] : 검색창,zoomslider에서 이벤트 버블링 방지
  • Loading branch information
juwon5272 authored Dec 5, 2024
2 parents d1272e4 + 5f3b04b commit b169429
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@ export const MapProviderForDraw = ({ width, height }: ICanvasScreenProps) => {
};
}, []);

useEffect(() => {
const preventDefault = (e: TouchEvent) => {
e.preventDefault();
};

document.body.style.overflow = 'hidden';
document.addEventListener('touchmove', preventDefault, { passive: false });

return () => {
document.body.style.overflow = 'auto';
document.removeEventListener('touchmove', preventDefault);
};
}, []);

return (
<MapCanvasForDraw
width={windowSize.width}
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/component/searchbox/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ export const SearchBox = (props: ISearchBoxProps) => {
};

return (
<div className="absolute top-2 z-[6000] w-full px-2">
<div
className="absolute top-2 z-[6000] w-full px-2"
onTouchMove={e => {
e.stopPropagation();
e.preventDefault();
}}
>
{/* 검색 입력 */}
<div className="border-grayscale-75 text-grayscale-400 flex h-11 w-full rounded border bg-white px-3">
<input
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/component/zoomslider/ZoomSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ export const ZoomSlider = ({ map, redrawCanvas }: IZoomSliderProps) => {
};

return (
<div className="flex h-48 w-9 flex-col items-center rounded bg-white shadow">
<div
className="flex h-48 w-9 flex-col items-center rounded bg-white shadow"
onTouchMove={e => {
e.stopPropagation();
e.preventDefault();
}}
>
<ZoomButton label={<MdOutlineAdd />} onClick={() => handleZoomChange(1)} />
<ZoomSliderInput zoomLevel={zoomLevel} onSliderChange={handleSliderChange} />
<ZoomButton label={<MdRemove />} onClick={() => handleZoomChange(-1)} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/DrawRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const DrawRoute = () => {
return (
<ToolTypeProvider>
<div className="flex h-full w-full flex-col py-[75px]">
<div style={{ position: 'relative', padding: '1rem' }}>
<div className="relative px-4">
<MapProviderForDraw width={window.innerWidth - 32} height={window.innerHeight - 180} />
</div>
</div>
Expand Down

0 comments on commit b169429

Please sign in to comment.