← คอมโพเนนต์ทั้งหมด

ปุ่มควบคุม

ซูม เข็มทิศ ตำแหน่งของฉัน เต็มจอ และสลับธีม สร้างจากปุ่มของ 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>

พร็อพ

พร็อพชนิดค่าเริ่มต้นคำอธิบาย
positioncorner"top-right"Corner of the map: top-left, top-right, bottom-left or bottom-right.
zoombooleantrueZoom in and out buttons.
compassbooleantrueCompass that resets bearing and pitch.
locatebooleanfalseButton that flies to the visitor's location.
fullscreenbooleanfalseFullscreen toggle for the whole map.
styleSwitcherbooleanfalseMenu that swaps the basemap theme without remounting.

คีย์

แผนที่ การค้นหาที่อยู่ และรายละเอียดสถานที่ใช้คีย์ pk_ ที่ปลอดภัยบนเบราว์เซอร์ ส่วนเส้นทางและ isochrone ต้องใช้คีย์ลับ sk_ จึงต้องผ่านเส้นทางพร็อกซีบนเซิร์ฟเวอร์ของแอปคุณ