← คอมโพเนนต์ทั้งหมด
ปุ่มควบคุม
ซูม เข็มทิศ ตำแหน่งของฉัน เต็มจอ และสลับธีม สร้างจากปุ่มของ shadcn
ตัวอย่างทำงานบนคลังข้อมูลประเทศไทยสาธารณะของ MapScale
ติดตั้ง
npx shadcn@latest add https://mapscale.io/r/map-controls.jsonวิธีใช้
import { MapControls } from "@/components/mapscale/map-controls"
<Map>
<MapControls position="top-right" locate fullscreen styleSwitcher />
</Map>พร็อพ
| พร็อพ | ชนิด | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| position | corner | "top-right" | Corner of the map: top-left, top-right, bottom-left or bottom-right. |
| zoom | boolean | true | Zoom in and out buttons. |
| compass | boolean | true | Compass that resets bearing and pitch. |
| locate | boolean | false | Button that flies to the visitor's location. |
| fullscreen | boolean | false | Fullscreen toggle for the whole map. |
| styleSwitcher | boolean | false | Menu that swaps the basemap theme without remounting. |
คีย์
แผนที่ การค้นหาที่อยู่ และรายละเอียดสถานที่ใช้คีย์ pk_ ที่ปลอดภัยบนเบราว์เซอร์ ส่วนเส้นทางและ isochrone ต้องใช้คีย์ลับ sk_ จึงต้องผ่านเส้นทางพร็อกซีบนเซิร์ฟเวอร์ของแอปคุณ