MapEvents - onstyleload #259
-
|
As of today, the list of
How would it be possible to implement this example https://maplibre.org/maplibre-gl-js/docs/examples/globe-vector-tiles/ ? I've tried but I don't see any "impact" on the projection of the map, as if the If not possible, what could be a workaround ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
I might need to update the MapLibre component to instantiate children before the load event happens. I originally came from Leaflet where that was necessary but I don’t think so in this case. Would need some testing though to make sure that everything still works properly.
…On Tue Mar 18, 2025, 10:19 AM GMT, BenOnTrack ***@***.***> wrote:
As of today, the list of MapEvents defined and customizable is:
- onclick?: (e: maplibregl.MapMouseEvent) => void;
- ondblclick?: (e: maplibregl.MapMouseEvent) => void;
- oncontextmenu?: (e: maplibregl.MapMouseEvent) => void;
- onmovestart?: (e: MapMoveEvent) => void;
- onmoveend?: (e: MapMoveEvent) => void;
- onzoomstart?: (e: maplibregl.MapLibreZoomEvent) => void;
- onzoom?: (e: maplibregl.MapLibreZoomEvent) => void;
- onzoomend?: (e: maplibregl.MapLibreZoomEvent) => void;
- onpitch?: (e: maplibregl.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => void;
- onrotate?: (e: maplibregl.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => void;
- onwheel?: (e: maplibregl.MapWheelEvent) => void;
- ondata?: (e: maplibregl.MapDataEvent) => void;
- onstyledata?: (e: maplibregl.MapStyleDataEvent) => void;
- onidle?: (e: maplibregl.MapLibreEvent) => void;
How would it be possible to implement this example https://maplibre.org/maplibre-gl-js/docs/examples/globe-vector-tiles/ <https://maplibre.org/maplibre-gl-js/docs/examples/globe-vector-tiles/> ?
I've tried
// MapOnStyleLoad.svelte const { map } = $derived(getMapContext()); $effect(() => { map.on("style.load", () => { map.setProjection({ type: "globe", // Set projection to globe }); }); }); // Map <MapLibre .... (with all the parameters > <MapOnStyleLoad /> </MapLibre>
but I don't see any "impact" on the projection of the map, as if the style.load event could not be overwritten (or already has triggerd by the time it reaches this component)
If not possible, what could be a workaround ?
—
Reply to this email directly, view it on GitHub <#259>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAKOLVVPMWNFY23BK73OCGD2U7XJ5AVCNFSM6AAAAABZHXMII6VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYGA4TONBVGM>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Unless |
Beta Was this translation helpful? Give feedback.
-
|
Yeah that seems like a good idea.
…On Wed Mar 19, 2025, 01:27 AM GMT, BenOnTrack ***@***.***> wrote:
Unless projection could be a new parameter set at the instantiation of the map (similar to zoom, pitch, bearing, ..)
Would that make sense ?
—
Reply to this email directly, view it on GitHub <#259 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAKOLVXMARQIKRJEBF5XEUD2VDBZRAVCNFSM6AAAAABZHXMII6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENJUGUZTIMA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
v1.0.0-next.13 has these changes:
|
Beta Was this translation helpful? Give feedback.
v1.0.0-next.13 has these changes:
projectionparameter to the MapLibre componentonstyleloadevent handler to the MapLibre component