Skip to content

Commit

Permalink
improved examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zdila committed Sep 1, 2023
1 parent 821a82a commit 34ee451
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions examples/leaflet/AppLeaflet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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" : "";
Expand All @@ -32,7 +35,7 @@
'<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a>, ' +
'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
crossOrigin: true,
}
},
).addTo(map);
new GeocodingControl({
Expand Down
8 changes: 4 additions & 4 deletions examples/openlayers/AppOpenLayers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
'<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a>',
Expand All @@ -39,7 +39,7 @@
],
view: new View({
center: [0, 0],
zoom: 2,
zoom: 0,
}),
controls: defaultControls().extend([
new GeocodingControl({
Expand Down

0 comments on commit 34ee451

Please sign in to comment.