@india-boundary-corrector/tilefixer 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/index.js +7 -4
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @india-boundary-corrector/tilefixer
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@india-boundary-corrector/tilefixer)
|
|
4
|
+
|
|
3
5
|
Core library for fetching and applying India boundary corrections to raster map tiles.
|
|
4
6
|
|
|
5
7
|
## Installation
|
package/dist/index.cjs
CHANGED
|
@@ -2318,7 +2318,7 @@ function applyMedianBlurAlongPath(ctx, features, lineWidth, tileSize, maskCanvas
|
|
|
2318
2318
|
if (!maskCanvas || maskCanvas.width !== tileSize || maskCanvas.height !== tileSize) {
|
|
2319
2319
|
maskCanvas = new OffscreenCanvas(tileSize, tileSize);
|
|
2320
2320
|
}
|
|
2321
|
-
const maskCtx = maskCanvas.getContext("2d");
|
|
2321
|
+
const maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true });
|
|
2322
2322
|
maskCtx.fillStyle = "black";
|
|
2323
2323
|
maskCtx.fillRect(0, 0, tileSize, tileSize);
|
|
2324
2324
|
maskCtx.strokeStyle = "white";
|
|
@@ -2520,8 +2520,11 @@ var BoundaryCorrector = class {
|
|
|
2520
2520
|
const useOsm = zoom >= zoomThreshold;
|
|
2521
2521
|
const addLayerName = useOsm ? "to-add-osm" : "to-add-ne";
|
|
2522
2522
|
const delLayerName = useOsm ? "to-del-osm" : "to-del-ne";
|
|
2523
|
-
|
|
2524
|
-
|
|
2523
|
+
if (!this._canvas || this._canvas.width !== tileSize) {
|
|
2524
|
+
this._canvas = new OffscreenCanvas(tileSize, tileSize);
|
|
2525
|
+
}
|
|
2526
|
+
const canvas = this._canvas;
|
|
2527
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
2525
2528
|
const blob = new Blob([rasterTile]);
|
|
2526
2529
|
const imageBitmap = await createImageBitmap(blob);
|
|
2527
2530
|
ctx.drawImage(imageBitmap, 0, 0, tileSize, tileSize);
|