From 10c2716aeb374a38bc26293ebbd3d332b2129143 Mon Sep 17 00:00:00 2001 From: Huh Hyeongjun Date: Mon, 24 Feb 2025 16:20:28 +0900 Subject: [PATCH] feat: remove box --- src/components/button/BottomButton.tsx | 50 +++++++++++-- src/components/map/Processing.tsx | 82 ++++++++++++++++++++- src/components/map/SelectMap.tsx | 98 ++++++++++++++++++++------ src/index.css | 5 ++ src/ui/App.tsx | 53 +++++++++++--- 5 files changed, 251 insertions(+), 37 deletions(-) diff --git a/src/components/button/BottomButton.tsx b/src/components/button/BottomButton.tsx index cebf0ea..2b38937 100644 --- a/src/components/button/BottomButton.tsx +++ b/src/components/button/BottomButton.tsx @@ -1,12 +1,15 @@ import { css } from "@emotion/react"; import { ButtonHTMLAttributes, DetailedHTMLProps } from "react"; -type ButtonProps = DetailedHTMLProps< - ButtonHTMLAttributes, - HTMLButtonElement ->; +interface ButtonProps + extends DetailedHTMLProps< + ButtonHTMLAttributes, + HTMLButtonElement + > { + isShow?: boolean; +} -export function BottomButton(props: ButtonProps) { +export function NextButton(props: ButtonProps) { return ( + ); +} + +export function PrevButton(props: ButtonProps) { + return ( + +
    + {buildings.map((b) => ( +
  • +
    Building {b.id}
    +
    Height: {b.tags.height || "No height info"}
    +
    Location/Shape:
    + {b.geometry ? ( +
      + {b.geometry.map((pt, index) => ( +
    • + ({pt.lat.toFixed(5)}, {pt.lng.toFixed(5)}) +
    • + ))} +
    + ) : ( +
    No geometry info
    + )} +
    Other Tags: {JSON.stringify(b.tags)}
    +
  • + ))} +
+ + ); } diff --git a/src/components/map/SelectMap.tsx b/src/components/map/SelectMap.tsx index c7b882f..6b472a9 100644 --- a/src/components/map/SelectMap.tsx +++ b/src/components/map/SelectMap.tsx @@ -11,12 +11,13 @@ import { css } from "@emotion/react"; function RectangleSelector({ isDrag = true, + bounds, onChange, }: { isDrag: boolean; + bounds: LatLngBounds | null; onChange: (LatLngBounds: LatLngBounds) => void; }) { - const [bounds, setBounds] = useState(null); const [firstPoint, setFirstPoint] = useState(null); useEffect(() => { @@ -35,12 +36,11 @@ function RectangleSelector({ }, mousemove(e) { if (firstPoint) { - setBounds(new L.LatLngBounds(firstPoint, e.latlng)); + onChange(new L.LatLngBounds(firstPoint, e.latlng)); } }, mouseup(e) { if (firstPoint) { - setBounds(new L.LatLngBounds(firstPoint, e.latlng)); onChange(new L.LatLngBounds(firstPoint, e.latlng)); setFirstPoint(null); } @@ -51,14 +51,28 @@ function RectangleSelector({ ) : null; } -export function MapComponent({ onDone }: { onDone: (e) => void }) { +export function MapComponent({ + onDone, + onRemove, +}: { + onDone: (e) => void; + onRemove: () => void; +}) { const [isDrag, setIsDrag] = useState(true); + const [bounds, setBounds] = useState(null); const handleClickSwitchDrag = () => { setIsDrag(!isDrag); }; + const handleClickRemoveBox = () => { + onRemove(); + setBounds(null); + setIsDrag(true); + }; + const handleChangeDone = (e) => { + setBounds(e); onDone([e._northEast, e._southWest]); }; @@ -68,40 +82,80 @@ export function MapComponent({ onDone }: { onDone: (e) => void }) { position: "relative", })} > - + + + + - + ); diff --git a/src/index.css b/src/index.css index 6db4745..e1deaab 100644 --- a/src/index.css +++ b/src/index.css @@ -14,6 +14,11 @@ body, -moz-user-select: none; -ms-user-select: none; user-select: none; + -ms-overflow-style: none; +} + +::-webkit-scrollbar { + display: none; } * { diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 4244bd1..f3b0d6f 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -6,20 +6,36 @@ import { Description } from "@/components/text/Description"; import { Column } from "@/components/flex/Column"; import { MapComponent } from "@/components/map/SelectMap"; import { useState } from "react"; -import { BottomButton } from "@/components/button/BottomButton"; +import { NextButton, PrevButton } from "@/components/button/BottomButton"; +import { BuildingHeights } from "@/components/map/Processing"; function App() { const [isNextButtonDisabled, setIsNextButtonDisabled] = useState(true); - const handleDone = (e) => { - console.log(e); + const [areaData, setAreaData] = useState([]); + const [steps, setSteps] = useState(["front", "processing"]); + const [step, setStep] = useState(0); + + const handleDone = (data) => { + setAreaData(data); setIsNextButtonDisabled(false); }; - const handleClickNextStep = () => {}; + const handleRemove = () => { + setAreaData([]); + setIsNextButtonDisabled(true); + }; + + const handleClickNextStep = () => { + setStep(step + 1); + }; + + const handleClickPrevStep = () => { + setStep(step - 1); + }; return (
- + Generate 3d map @@ -27,16 +43,37 @@ function App() { Tools to create 3D maps based on maps and export them in 3D format - + - + + + Processing + + Tools to create 3D maps based on maps and export them in 3D format + + + + + + + + + Prev Step + + + Next Step - +