Fixed document ref in hitdetect

fixed lint
This commit is contained in:
AndersVittrup
2021-05-13 15:09:06 +02:00
parent fdfdc500aa
commit aa61c47fc4
6 changed files with 82 additions and 9 deletions

View File

@@ -91,10 +91,13 @@ export function createHitDetectionImageData(
continue;
}
const img = document.createElement('canvas');
img.width = imgSize[0];
img.height = imgSize[1];
const imgContext = img.getContext('2d', {alpha: false});
const imgContext = createCanvasContext2D(
imgSize[0],
imgSize[1],
undefined,
{alpha: false}
);
const img = imgContext.canvas;
imgContext.fillStyle = color;
imgContext.fillRect(0, 0, img.width, img.height);
style.setImage(