1 | import React, { useState } from "react";
|
---|
2 | import styles from "./MapControls.module.css";
|
---|
3 | import plusIcon from "../../assets/plus_icon.png";
|
---|
4 | import minusIcon from "../../assets/minus_icon.png";
|
---|
5 | import floorIcon from "../../assets/floor_icon.png";
|
---|
6 |
|
---|
7 | export default function MapControls({ onZoomIn, onZoomOut, onFloorChange }) {
|
---|
8 | const [currentFloor, setCurrentFloor] = useState(1); // Starting floor
|
---|
9 |
|
---|
10 | // Handle floor selection
|
---|
11 | const handleFloorChange = (newFloor) => {
|
---|
12 | setCurrentFloor(newFloor);
|
---|
13 | if (onFloorChange) {
|
---|
14 | onFloorChange(newFloor);
|
---|
15 | }
|
---|
16 | };
|
---|
17 |
|
---|
18 | return (
|
---|
19 | <div className={styles.mapControl}>
|
---|
20 | {/* Zoom Controls */}
|
---|
21 | <div className={styles.zoomControls}>
|
---|
22 | <button onClick={onZoomIn} className={styles.zoomButton}>
|
---|
23 | <img src={plusIcon} alt="Zoom In" />
|
---|
24 | </button>
|
---|
25 | <button onClick={onZoomOut} className={styles.zoomButton}>
|
---|
26 | <img src={minusIcon} alt="Zoom Out" />
|
---|
27 | </button>
|
---|
28 | </div>
|
---|
29 |
|
---|
30 | {/* Floor Selector */}
|
---|
31 | <div className={styles.floorSelector}>
|
---|
32 | <img src={floorIcon} alt="Floor Icon" className={styles.floorIcon} />
|
---|
33 | <select
|
---|
34 | value={currentFloor}
|
---|
35 | onChange={(e) => handleFloorChange(parseInt(e.target.value, 10))}
|
---|
36 | className={styles.floorDropdown}
|
---|
37 | >
|
---|
38 | <option value={1}>1F</option>
|
---|
39 | <option value={2}>2F</option>
|
---|
40 | <option value={3}>3F</option>
|
---|
41 | <option value={4}>4F</option>
|
---|
42 | </select>
|
---|
43 | </div>
|
---|
44 | </div>
|
---|
45 | );
|
---|
46 | }
|
---|