Closed elgandoz closed 10 months ago
Hello @elgandoz , thanks for letting us know, I will look into it!
Hey, I just checked and it's actually there but a bit hidden. In the SDK there is a built-in control for fullscreen that you can add directly from the constructor, but if you do it this way, it's true that you cannot customise it or bind events to it. It's very possibly a point we are going to address in a near future, but in the mean time what I can propose is to set it manually:
import { Map, FullscreenControl } from "@maptiler/sdk";
const map = new Map({
container: "map-container",
})
map.on("load", (evt) => {
if (!map) return;
const fsc = new FullscreenControl();
map.addControl(fsc)
fsc.on("fullscreenstart", (e) => {
console.log("YEAH fullscreenstart !");
})
});
Please let me know if that helps.
Thanks for the snippet, works great!
MapLibre has introduced the events
fullscreenstart
andfullscreenend
since v3.0.0 (https://github.com/maplibre/maplibre-gl-js/pull/2128), but this 2 events do not trigger when using MapTiler SDK.