From 34ee4510f1df8be7e1ff4091b2e43db24a73293d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=BDdila?= Date: Fri, 1 Sep 2023 20:00:22 +0200 Subject: [PATCH] improved examples --- examples/leaflet/AppLeaflet.svelte | 7 +++++-- examples/openlayers/AppOpenLayers.svelte | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/leaflet/AppLeaflet.svelte b/examples/leaflet/AppLeaflet.svelte index 2d8c313..343a145 100644 --- a/examples/leaflet/AppLeaflet.svelte +++ b/examples/leaflet/AppLeaflet.svelte @@ -17,7 +17,10 @@ } onMount(() => { - const map = L.map(containerElement).setView([51.505, -0.09], 13); + const map = L.map(containerElement).fitBounds([ + [-65, -160], + [65, 160], + ]); const scale = devicePixelRatio > 1.5 ? "@2x" : ""; @@ -32,7 +35,7 @@ '© MapTiler, ' + '© OpenStreetMap contributors', crossOrigin: true, - } + }, ).addTo(map); new GeocodingControl({ diff --git a/examples/openlayers/AppOpenLayers.svelte b/examples/openlayers/AppOpenLayers.svelte index 28c301d..690a4e2 100644 --- a/examples/openlayers/AppOpenLayers.svelte +++ b/examples/openlayers/AppOpenLayers.svelte @@ -20,15 +20,15 @@ throw new Error(errMsg); } + const scale = devicePixelRatio > 1.5 ? "@2x" : ""; + onMount(() => { new Map({ target: containerElement, layers: [ new TileLayer({ source: new XYZ({ - url: - "https://api.maptiler.com/maps/basic-v2/{z}/{x}/{y}@2x.png?key=" + - apiKey, + url: `https://api.maptiler.com/maps/basic-v2/{z}/{x}/{y}${scale}.png?key=${apiKey}`, tileSize: 512, attributions: [ '© MapTiler', @@ -39,7 +39,7 @@ ], view: new View({ center: [0, 0], - zoom: 2, + zoom: 0, }), controls: defaultControls().extend([ new GeocodingControl({