mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
@types/leaflet.fullscreen Update definitions to 1.6. Add missing fields to MapOptions and Map (#43180)
This commit is contained in:
parent
db21a0f0c0
commit
0928d72fb0
13
types/leaflet.fullscreen/index.d.ts
vendored
13
types/leaflet.fullscreen/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for Leaflet.fullscreen 1.3
|
||||
// Type definitions for Leaflet.fullscreen 1.6
|
||||
// Project: https://github.com/brunob/leaflet.fullscreen
|
||||
// Definitions by: William Comartin <https://github.com/wcomartin>
|
||||
// Dan Manastireanu <https://github.com/danmana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@ -21,6 +22,7 @@ declare module 'leaflet' {
|
||||
forceSeparateButton?: boolean;
|
||||
forcePseudoFullscreen?: boolean;
|
||||
pseudoFullscreen?: boolean;
|
||||
fullscreenElement?: false | HTMLElement;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,4 +32,13 @@ declare module 'leaflet' {
|
||||
*/
|
||||
function fullscreen(options?: Control.FullscreenOptions): Control.Fullscreen;
|
||||
}
|
||||
|
||||
interface MapOptions {
|
||||
fullscreenControl?: boolean;
|
||||
fullscreenControlOptions?: Control.FullscreenOptions;
|
||||
}
|
||||
|
||||
interface Map {
|
||||
toggleFullScreen(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,8 @@ const icon: L.Control.Fullscreen = L.control.fullscreen({
|
||||
title: 'Full Screen',
|
||||
titleCancel: 'Exit Full Screen',
|
||||
forceSeparateButton: false,
|
||||
forcePseudoFullscreen: false
|
||||
forcePseudoFullscreen: false,
|
||||
fullscreenElement: false
|
||||
});
|
||||
|
||||
icon.addTo(map);
|
||||
@ -20,3 +21,25 @@ L.control.fullscreen({
|
||||
content: '<i class="fa fa-arrows-alt"></i>',
|
||||
forceSeparateButton: true,
|
||||
}).addTo(map);
|
||||
|
||||
// MapOptions initHook
|
||||
L.map('map-container', {
|
||||
fullscreenControl: true,
|
||||
fullscreenControlOptions: {
|
||||
position: 'topleft',
|
||||
title: 'Full Screen',
|
||||
titleCancel: 'Exit Full Screen',
|
||||
forceSeparateButton: false,
|
||||
forcePseudoFullscreen: false,
|
||||
fullscreenElement: false
|
||||
}
|
||||
});
|
||||
|
||||
// configurable fullscreen element
|
||||
const htmlElement = map.getContainer();
|
||||
L.control.fullscreen({
|
||||
fullscreenElement: htmlElement
|
||||
});
|
||||
|
||||
// you can also toggle fullscreen from map object
|
||||
map.toggleFullScreen();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user