ปลั๊กอิน Fullscreen HTML5 สำหรับใบปลิว
เพื่อให้ปุ่มสำหรับการสลับและปิดหน้าจอเต็มหน้าจอ:
// Create a new map with a fullscreen button:
var map = new L . Map ( 'map' , {
fullscreenControl : true ,
// OR
fullscreenControl : {
pseudoFullscreen : false // if true, fullscreen to page width and height
}
} ) ;
// or, add to an existing map:
map . addControl ( new L . Control . Fullscreen ( ) ) ;
ปลั๊กอินยังเพิ่มวิธีการหลายวิธีใน L.Map
ซึ่งมีอยู่เสมอแม้ว่าคุณจะเลือกที่จะไม่ใช้ปุ่มเต็มหน้าจอ:
map . isFullscreen ( ) // Is the map fullscreen?
map . toggleFullscreen ( ) // Either go fullscreen, or cancel the existing fullscreen.
// `fullscreenchange` Event that's fired when entering or exiting fullscreen.
map . on ( 'fullscreenchange' , function ( ) {
if ( map . isFullscreen ( ) ) {
console . log ( 'entered fullscreen' ) ;
} else {
console . log ( 'exited fullscreen' ) ;
}
} ) ;
เพื่อเปลี่ยนข้อความควบคุมแบบเต็มหน้าจอ:
map . addControl ( new L . Control . Fullscreen ( {
title : {
'false' : 'View Fullscreen' ,
'true' : 'Exit Fullscreen'
}
} ) ) ;
leaflet.fullscreen มีให้บริการผ่าน Mapbox Plugin CDN - เพียงคัดลอกสิ่งนี้รวมถึง:
< script src =' https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js ' > </ script >
< link href =' https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css ' rel =' stylesheet ' />
npm install && make
Protip คุณอาจต้องการติดตั้ง watch
เพื่อให้คุณสามารถเรียกใช้ watch make
ได้โดยไม่จำเป็นต้องดำเนินการในการเปลี่ยนแปลงทุกครั้ง
รองรับใบปลิว 1.0 และหลังจากนั้น รุ่นก่อนหน้าอาจใช้งานได้ แต่ไม่ได้ทดสอบ