@india-boundary-corrector/tilefixer 0.0.1 → 0.0.2
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 +1 -1
- package/src/index.js +7 -4
package/dist/index.js
CHANGED
|
@@ -2290,7 +2290,7 @@ function applyMedianBlurAlongPath(ctx, features, lineWidth, tileSize, maskCanvas
|
|
|
2290
2290
|
if (!maskCanvas || maskCanvas.width !== tileSize || maskCanvas.height !== tileSize) {
|
|
2291
2291
|
maskCanvas = new OffscreenCanvas(tileSize, tileSize);
|
|
2292
2292
|
}
|
|
2293
|
-
const maskCtx = maskCanvas.getContext("2d");
|
|
2293
|
+
const maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true });
|
|
2294
2294
|
maskCtx.fillStyle = "black";
|
|
2295
2295
|
maskCtx.fillRect(0, 0, tileSize, tileSize);
|
|
2296
2296
|
maskCtx.strokeStyle = "white";
|
|
@@ -2492,8 +2492,11 @@ var BoundaryCorrector = class {
|
|
|
2492
2492
|
const useOsm = zoom >= zoomThreshold;
|
|
2493
2493
|
const addLayerName = useOsm ? "to-add-osm" : "to-add-ne";
|
|
2494
2494
|
const delLayerName = useOsm ? "to-del-osm" : "to-del-ne";
|
|
2495
|
-
|
|
2496
|
-
|
|
2495
|
+
if (!this._canvas || this._canvas.width !== tileSize) {
|
|
2496
|
+
this._canvas = new OffscreenCanvas(tileSize, tileSize);
|
|
2497
|
+
}
|
|
2498
|
+
const canvas = this._canvas;
|
|
2499
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
2497
2500
|
const blob = new Blob([rasterTile]);
|
|
2498
2501
|
const imageBitmap = await createImageBitmap(blob);
|
|
2499
2502
|
ctx.drawImage(imageBitmap, 0, 0, tileSize, tileSize);
|