KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

fillColor broken on new browsers

Open mitsuhiko opened this issue 13 years ago • 9 comments

Hi,

Kinetic.js currently uses context.fill(context) wrongly. It should just be context.fill(). Apparently current browsers did not cause an exception there but with Firefox 21 there is now a parameter it takes so it errors out with "TypeError: Value '[object CanvasRenderingContext2D]' is not a valid value for enumeration CanvasWindingRule. @ http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.3.1.js:672"

Old:

    Kinetic.SceneCanvas.prototype = {
        _fillColor: function(shape) {
            var context = this.context, fill = shape.getFill();
            context.fillStyle = fill;
            context.fill(context);
        },

Fixed:

    Kinetic.SceneCanvas.prototype = {
        _fillColor: function(shape) {
            var context = this.context, fill = shape.getFill();
            context.fillStyle = fill;
            context.fill();
        },

mitsuhiko avatar Jan 22 '13 12:01 mitsuhiko

interesting thanks! I'll fix this up before the next release.

Thanks!

ericdrowell avatar Jan 22 '13 19:01 ericdrowell

Thanks! Fixed up now.

ericdrowell avatar Feb 03 '13 04:02 ericdrowell

Thanks for this. I was scratching my head for some time about this problem. Where can the fixed source be downloaded? I keep getting the old code when I download it from the main page (http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.3.1.js).

In the meantime, apart from line 672, the same correction should be applied in lines 691, 701, 711 and 796, in order to make it work on Chrome 26.0.1397.2 dev-m. It still works in Firefox 18 and IE9. Hope this helps.

macl avatar Feb 04 '13 06:02 macl

You have two options:

  1. fork the project and do a build
  2. wait and download the official release sometime this week (will be v4.3.2)

ericdrowell avatar Feb 04 '13 07:02 ericdrowell

OK, thanks. I thought it was already patched on the source. I'll stick with my corrections until next release. Thanks again.

macl avatar Feb 04 '13 07:02 macl

Thankyou mitsuhiko . You saved my day .. Gratitude

nirojsapkota avatar May 20 '13 09:05 nirojsapkota

np!

ericdrowell avatar May 20 '13 19:05 ericdrowell

Thank you so much @mitsuhiko , your solution saved me a lot of time !

hoangnhien137 avatar Jul 14 '13 08:07 hoangnhien137

Thanks mitsuhiko , it's working now, Really helpful.

SainiMukesh avatar Oct 03 '16 06:10 SainiMukesh