@india-boundary-corrector/leaflet-layer 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/dist/index.js CHANGED
@@ -2650,7 +2650,7 @@ function applyMedianBlurAlongPath(ctx, features, lineWidth, tileSize, maskCanvas
2650
2650
  if (!maskCanvas || maskCanvas.width !== tileSize || maskCanvas.height !== tileSize) {
2651
2651
  maskCanvas = new OffscreenCanvas(tileSize, tileSize);
2652
2652
  }
2653
- const maskCtx = maskCanvas.getContext("2d");
2653
+ const maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true });
2654
2654
  maskCtx.fillStyle = "black";
2655
2655
  maskCtx.fillRect(0, 0, tileSize, tileSize);
2656
2656
  maskCtx.strokeStyle = "white";
@@ -2852,8 +2852,11 @@ var BoundaryCorrector = class {
2852
2852
  const useOsm = zoom >= zoomThreshold;
2853
2853
  const addLayerName = useOsm ? "to-add-osm" : "to-add-ne";
2854
2854
  const delLayerName = useOsm ? "to-del-osm" : "to-del-ne";
2855
- const canvas = new OffscreenCanvas(tileSize, tileSize);
2856
- const ctx = canvas.getContext("2d");
2855
+ if (!this._canvas || this._canvas.width !== tileSize) {
2856
+ this._canvas = new OffscreenCanvas(tileSize, tileSize);
2857
+ }
2858
+ const canvas = this._canvas;
2859
+ const ctx = canvas.getContext("2d", { willReadFrequently: true });
2857
2860
  const blob = new Blob([rasterTile]);
2858
2861
  const imageBitmap = await createImageBitmap(blob);
2859
2862
  ctx.drawImage(imageBitmap, 0, 0, tileSize, tileSize);