From 39dd4bdb759aa38547b7da4a95dae2540ce0aee9 Mon Sep 17 00:00:00 2001 From: Caleb Evans Date: Thu, 19 Jul 2012 13:00:00 -0700 Subject: [PATCH] Added a supposed fix for working with patterns in IE9 --- jcanvas.js | 3 +++ jcanvas.min.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jcanvas.js b/jcanvas.js index a108172..fa888bf 100755 --- a/jcanvas.js +++ b/jcanvas.js @@ -978,6 +978,8 @@ $.fn.pattern = function(args) { onload(); } else { img.onload = onload; + // Image onload fix for IE9 + img.src = img.src; } } @@ -1242,6 +1244,7 @@ $.fn.removeLayerGroup = function(name) { // Remove layer if group name matches if (layers[l].group === name) { layers.splice(l, 1); + // Ensure no layers are skipped when one is removed l -= 1; } } diff --git a/jcanvas.min.js b/jcanvas.min.js index 9c82dbc..9079a4a 100644 --- a/jcanvas.min.js +++ b/jcanvas.min.js @@ -24,11 +24,11 @@ e=s(this[k])){D(this[k],a,o);C(e,h);e.textBaseline=h.baseline;e.textAlign=h.alig f.sWidth===a&&f.width!==a&&(k.sWidth=f.sWidth=q.width),f.sHeight===a&&f.height!==a&&(k.sHeight=f.sHeight=q.height),f.sx===a&&(f.sx=f.cropFromCenter?q.width/2:0),f.sy===a&&(f.sy=f.cropFromCenter?q.height/2:0),f.cropFromCenter||(f.sx+=f.sWidth/2,f.sy+=f.sHeight/2),f.sx+f.sWidth/2>q.width&&(f.sx=q.width-f.sWidth/2),0>f.sx-f.sWidth/2&&(f.sx=f.sWidth/2),0>f.sy-f.sHeight/2&&(f.sy=f.sHeight/2),f.sy+f.sHeight/2>q.height&&(f.sy=q.height-f.sHeight/2),f.width!==a&&f.height===a)?k.height=f.height=f.width/y:f.width=== a&&f.height!==a?k.width=f.width=f.height*y:f.width===a&&f.height===a&&(k.width=f.width=q.width,k.height=f.height=q.height));G(g,i,f,f.width,f.height);i.drawImage(q,f.sx-f.sWidth/2,f.sy-f.sHeight/2,f.sWidth,f.sHeight,f.x-f.width/2,f.y-f.height/2,f.width,f.height);f._event?(i.beginPath(),i.rect(f.x-f.width/2,f.y-f.height/2,f.width,f.height),i.restore(),F(b[g],i,k),i.closePath()):i.restore();f.load&&f.load.call(e,k)}}var b=this,i,l,g,f=u(new x,k),q,t,y;t=f.source.getContext;f.source.src||t?(q=f.source, f.width=q.width,f.height=q.height):f.source&&(q=new Q,q.src=f.source);for(l=0;ll&&(e[f]=e[g])}else e[g]===a&&(t+=1,e[g]=i+t*((l-i)/q));k.addColorStop(e[g],b["c"+(g+1)])}}else k=a;return k};b.fn.setPixels=function k(b){var h,i,l,g=u(new x,b),f={},q,t,y,v;for(i=0;il&&(e[f]=e[g])}else e[g]===a&&(t+=1,e[g]=i+t*((l-i)/q));k.addColorStop(e[g],b["c"+(g+1)])}}else k=a;return k};b.fn.setPixels=function k(b){var h,i,l,g=u(new x,b),f={},q,t,y,v;for(i=0;i