olsn / Collision-Detection-for-EaselJS

Pixel Perfect and BoundingBox Collision Detector for EaselJS Bitmaps and BitmapAnimations
170 stars 53 forks source link

Check if the intersection is less than a pixel high or wide #11

Open djipco opened 4 years ago

djipco commented 4 years ago

If the intersection is less than a pixel high or wide, getImageData() will (rightfully) throw the following error:

Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source height is 0.

I guess getImageData() does an implicit Math.floor() on the width and height parameters to make sure there is actual data to return.