PDA

View Full Version : Bug (I think) discovered about gradients



bovello
23 Jan 2012, 4:17 AM
Hi,
I think I faced a bug about gradients, in particolar in method Ext.draw.engine.Canvas.createGradient, that didn't allow me to use more that 2 gradients.



...
for (stop in stops) {
if (stops.hasOwnProperty(stop)) {
canvasGradient.addColorStop(stop, stops[stop].color || '#000');
}
}
....


that I changed in



for (stop in stops) {
if (stops.hasOwnProperty(stop)) {
//consider validation of stops[stop].offset / 100
canvasGradient.addColorStop(stops[stop].offset / 100, stops[stop].color || '#000');
}
}


now I can use wonderfull raimbow gradients ;)
bye,
Marco

mitchellsimoens
23 Jan 2012, 9:20 AM
Not really a bug... just different implementation

bovello
23 Jan 2012, 11:34 AM
ok, but with standard implementation it's not possible to add more then 2 gradients.
there was any reason for this behaviour like performance problems?
thanks for your answer,

Marco

mitchellsimoens
23 Jan 2012, 11:36 AM
ok, but with standard implementation it's not possible to add more then 2 gradients.
there was any reason for this behaviour like performance problems?
thanks for your answer,

Marco

I can't speak for the devs that worked on the charts but I'm sure the thought of a use case for more stops wasn't much of a concern if at all a thought. But you showed it's an easy fix!

Naga
2 Feb 2012, 2:23 AM
Yes bug in the current release of sencha touch .... have posted a patch here
http://www.sencha.com/forum/showthread.php?162233-Bug-Fix-Charts-1.-Could-not-apply-gt-2-stops-to-gradient-and-angle-not-respected&p=692723#post692723