MCPcopy Create free account
hub / github.com/cartesiancs/map3d / MapComponent

Function MapComponent

src/components/map/SelectMap.tsx:123–245  ·  view source on GitHub ↗
({
  onDone,
  onRemove,
}: {
  onDone: (e) => void;
  onRemove: () => void;
})

Source from the content-addressed store, hash-verified

121}
122
123export function MapComponent({
124 onDone,
125 onRemove,
126}: {
127 onDone: (e) => void;
128 onRemove: () => void;
129}) {
130 const [isDrag, setIsDrag] = useState(true);
131 const [bounds, setBounds] = useState<LatLngBounds | null>(null);
132 const [drawBounds, setDrawBounds] = useState<LatLngBounds | null>(null);
133
134 const handleClickSwitchDrag = () => {
135 setIsDrag(!isDrag);
136 };
137
138 const handleClickRemoveBox = () => {
139 onRemove();
140 setBounds(null);
141 setDrawBounds(null);
142 setIsDrag(true);
143 };
144
145 const handleChangeDone = (e) => {
146 setBounds(e);
147 onDone([e._northEast, e._southWest]);
148 };
149
150 const handleChangeDraw = (e) => {
151 setDrawBounds(e);
152 onDone([e._northEast, e._southWest]);
153 };
154
155 return (
156 <div
157 css={css({
158 position: "relative",
159 })}
160 >
161 <div
162 css={css({
163 position: "absolute",
164 zIndex: 9999,
165 right: "1rem",
166 top: "1rem",
167 display: "flex",
168 justifyContent: "flex-end",
169 gap: "0.5rem",
170 })}
171 >
172 <button
173 css={css({
174 display: bounds == null || isDrag == true ? "none" : "flex",
175 color: "#ffffff",
176
177 backgroundColor: "#ef4444",
178 backdropFilter: "blur(8px)",
179 border: "none",
180 padding: "0.5rem 1rem",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected