Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu committed Oct 13, 2024
1 parent ae96a54 commit e02b834
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/cavnas.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let globaCanvas;
let globalCanvas;

export function getCanvas(tileSize = 256) {
if (!globaCanvas && OffscreenCanvas) {
globaCanvas = new OffscreenCanvas(1, 1);
if (!globalCanvas && OffscreenCanvas) {
globalCanvas = new OffscreenCanvas(1, 1);
}
if (globaCanvas) {
globaCanvas.width = globaCanvas.height = tileSize;
if (globalCanvas) {
globalCanvas.width = globalCanvas.height = tileSize;
}
return globaCanvas;
return globalCanvas;
}

function clearCanvas(ctx) {
Expand Down
6 changes: 3 additions & 3 deletions src/tileclip.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function isPolygon(feature) {
return type === 'Polygon' || type === 'MultiPolygon';
}

export function is3857(projection) {
export function isEPSG3857(projection) {
return projection === 'EPSG:3857';
}

Expand Down Expand Up @@ -48,7 +48,7 @@ function lnglat2Mercator(coordinates) {
}

function transformCoordinates(projection, coordinates) {
if (!is3857(projection)) {
if (!isEPSG3857(projection)) {
return coordinates;
} else {
const transformRing = (coord) => {
Expand Down Expand Up @@ -91,7 +91,7 @@ function transformPixels(projection, tileBBOX, tileSize, coordinates) {
}
return result;
};
if (is3857(projection)) {
if (isEPSG3857(projection)) {
const [mminx, mminy] = lnglat2Mercator([minx, miny]);
const [mmaxx, mmaxy] = lnglat2Mercator([maxx, maxy]);
const mTileBBOX = [mminx, mminy, mmaxx, mmaxy];
Expand Down
4 changes: 4 additions & 0 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const onmessage = function (message, postResponse) {
return;
}
postResponse(null, image, [image]);
return;
}
if (type === 'injectMask') {
const geojson = injectMask(data.maskId, data.geojsonFeature);
Expand All @@ -31,9 +32,12 @@ export const onmessage = function (message, postResponse) {
return;
}
postResponse();
return;
}
if (type === 'removeMask') {
removeMask(data.maskId);
postResponse();
return;
}
console.error('not support message type:', type);
};

0 comments on commit e02b834

Please sign in to comment.