binarymax / floodfill.js

HTML5 Canvas Floodfill via JavaScript
MIT License
57 stars 14 forks source link

typeof CanvasRenderingContext2D in iPhone safari is 'object' #12

Closed 0x5e closed 7 years ago

0x5e commented 7 years ago

Hello, when I try to fillFlood, I get this error:

[Error] TypeError: ctx.fillFlood is not a function. (In 'ctx.fillFlood(offsetX, offsetY, 32)', 'ctx.fillFlood' is undefined)

< CanvasRenderingContext2D {webkitLineDash: [], strokeStyle: "#000000", fillStyle: "#000000", globalAlpha: 1, globalCompositeOperation: "source-over", …}
> typeof CanvasRenderingContext2D
< "object"
if (typeof CanvasRenderingContext2D === 'function') {
    CanvasRenderingContext2D.prototype.fillFlood = fillContext;
};

Tested on iPhone6, iOS 9.3.3

binarymax commented 7 years ago

Hi @0x5e thanks for the fix! Very much appreciated.

0x5e commented 7 years ago

@binarymax thank you too, this project really solved my problem :)