@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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -137,7 +137,7 @@ function applyMedianBlurAlongPath(ctx, features, lineWidth, tileSize, maskCanvas
|
|
|
137
137
|
if (!maskCanvas || maskCanvas.width !== tileSize || maskCanvas.height !== tileSize) {
|
|
138
138
|
maskCanvas = new OffscreenCanvas(tileSize, tileSize);
|
|
139
139
|
}
|
|
140
|
-
const maskCtx = maskCanvas.getContext('2d');
|
|
140
|
+
const maskCtx = maskCanvas.getContext('2d', { willReadFrequently: true });
|
|
141
141
|
maskCtx.fillStyle = 'black';
|
|
142
142
|
maskCtx.fillRect(0, 0, tileSize, tileSize);
|
|
143
143
|
|
|
@@ -420,9 +420,12 @@ export class BoundaryCorrector {
|
|
|
420
420
|
const addLayerName = useOsm ? 'to-add-osm' : 'to-add-ne';
|
|
421
421
|
const delLayerName = useOsm ? 'to-del-osm' : 'to-del-ne';
|
|
422
422
|
|
|
423
|
-
//
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
// Get or create reusable main canvas
|
|
424
|
+
if (!this._canvas || this._canvas.width !== tileSize) {
|
|
425
|
+
this._canvas = new OffscreenCanvas(tileSize, tileSize);
|
|
426
|
+
}
|
|
427
|
+
const canvas = this._canvas;
|
|
428
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
426
429
|
|
|
427
430
|
// Draw original raster tile
|
|
428
431
|
const blob = new Blob([rasterTile]);
|