fix leafletRasterLayer: empty tiles have display:none [#620] (#627)

This commit is contained in:
Brandon Liu
2025-12-26 16:02:20 +08:00
committed by GitHub
parent 5c84faafa3
commit 2fa87ea9bb
8 changed files with 12 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
4.3.2
* fix leafletRasterLayer empty images: set `display: none`
4.3.1 4.3.1
* fix leafletRasterLayer handling of empty tiles by @thisisaaronland [#620] * fix leafletRasterLayer handling of empty tiles by @thisisaaronland [#620]
* maplibre: properly abort requests using AbortController by @andrewda [#608] * maplibre: properly abort requests using AbortController by @andrewda [#608]

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.0/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.0/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.0/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.9.0/dist/leaflet.js"></script>
<script src="https://unpkg.com/pmtiles@4.3.1/dist/pmtiles.js"></script> <script src="https://unpkg.com/pmtiles@4.3.2/dist/pmtiles.js"></script>
<style> <style>
body, #map { body, #map {
height:100vh; height:100vh;

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous">
<script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script> <script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/pmtiles@4.3.1/dist/pmtiles.js"></script> <script src="https://unpkg.com/pmtiles@4.3.2/dist/pmtiles.js"></script>
<style> <style>
body { body {
margin: 0; margin: 0;

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous">
<script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script> <script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/pmtiles@4.3.1/dist/pmtiles.js"></script> <script src="https://unpkg.com/pmtiles@4.3.2/dist/pmtiles.js"></script>
<style> <style>
body { body {
margin: 0; margin: 0;

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.css" crossorigin="anonymous">
<script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script> <script src="https://unpkg.com/maplibre-gl@5.13.0/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/pmtiles@4.3.1/dist/pmtiles.js"></script> <script src="https://unpkg.com/pmtiles@4.3.2/dist/pmtiles.js"></script>
<style> <style>
body { body {
margin: 0; margin: 0;

4
js/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "pmtiles", "name": "pmtiles",
"version": "4.3.1", "version": "4.3.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pmtiles", "name": "pmtiles",
"version": "4.3.1", "version": "4.3.2",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"fflate": "^0.8.2" "fflate": "^0.8.2"

View File

@@ -1,6 +1,6 @@
{ {
"name": "pmtiles", "name": "pmtiles",
"version": "4.3.1", "version": "4.3.2",
"description": "PMTiles archive decoder for browsers", "description": "PMTiles archive decoder for browsers",
"type": "module", "type": "module",
"main": "dist/cjs/index.cjs", "main": "dist/cjs/index.cjs",

View File

@@ -56,6 +56,8 @@ export const leafletRasterLayer = (source: PMTiles, options: unknown) => {
const blob = new Blob([arr.data], { type: mimeType }); const blob = new Blob([arr.data], { type: mimeType });
const imageUrl = window.URL.createObjectURL(blob); const imageUrl = window.URL.createObjectURL(blob);
el.src = imageUrl; el.src = imageUrl;
} else {
el.style.display = "none";
} }
el.cancel = undefined; el.cancel = undefined;
done(undefined, el); done(undefined, el);