I take it you see the angle get out of sync: after each revolution, it is one degree too small.
I posted a quick fix to the inbox, MorphicExtras-dcorking.75. I made SectorMorph#angle revert to zero when it reaches 360. On reflection, I think my change will do more harm than good.
If a learner makes an automated pie chart, it is perfectly reasonable for a sector to grow to 100% or 360 degrees. The user will expect the sector to become a full circle, and my 'fix' breaks that. Therefore I think Richo's original code: modulo 361 - is reasonable.
Perhaps we can provide a more subtle fix? Can we use this hack? angle := aNumber \ 360.000000000001. It still gets out of sync, but much more slowly.
David
What if we change SectorMorph>>#angle: to work like this?
angle: aNumber angle = aNumber ifTrue: [^ self]. angle := aNumber \ 360. (angle = 0 and: [aNumber ~= 0]) ifTrue: [angle := 360]. self update
I think this would allow showing a full circle when the angle is 360 degrees and it won't get out of sync.
Cheers, Richo
On Sat, Dec 8, 2012 at 5:01 PM, David Corking lists@dcorking.com wrote:
I take it you see the angle get out of sync: after each revolution, it is one degree too small.
I posted a quick fix to the inbox, MorphicExtras-dcorking.75. I made SectorMorph#angle revert to zero when it reaches 360. On reflection, I think my change will do more harm than good.
If a learner makes an automated pie chart, it is perfectly reasonable for a sector to grow to 100% or 360 degrees. The user will expect the sector to become a full circle, and my 'fix' breaks that. Therefore I think Richo's original code: modulo 361 - is reasonable.
Perhaps we can provide a more subtle fix? Can we use this hack? angle := aNumber \ 360.000000000001. It still gets out of sync, but much more slowly.
David _______________________________________________ etoys-dev mailing list etoys-dev@squeakland.org http://lists.squeakland.org/mailman/listinfo/etoys-dev
Richo,
That fixes it and does show full circle at 360.
Thanks, Stephen
On Sun, Dec 9, 2012 at 2:08 PM, Ricardo Moran richi.moran@gmail.com wrote:
What if we change SectorMorph>>#angle: to work like this?
angle: aNumber angle = aNumber ifTrue: [^ self]. angle := aNumber \ 360. (angle = 0 and: [aNumber ~= 0]) ifTrue: [angle := 360]. self update
I think this would allow showing a full circle when the angle is 360 degrees and it won't get out of sync.
Cheers, Richo
On Sat, Dec 8, 2012 at 5:01 PM, David Corking lists@dcorking.com wrote:
I take it you see the angle get out of sync: after each revolution, it is one degree too small.
I posted a quick fix to the inbox, MorphicExtras-dcorking.75. I made SectorMorph#angle revert to zero when it reaches 360. On reflection, I think my change will do more harm than good.
If a learner makes an automated pie chart, it is perfectly reasonable for a sector to grow to 100% or 360 degrees. The user will expect the sector to become a full circle, and my 'fix' breaks that. Therefore I think Richo's original code: modulo 361 - is reasonable.
Perhaps we can provide a more subtle fix? Can we use this hack? angle := aNumber \ 360.000000000001. It still gets out of sync, but much more slowly.
David _______________________________________________ etoys-dev mailing list etoys-dev@squeakland.org http://lists.squeakland.org/mailman/listinfo/etoys-dev
etoys-dev mailing list etoys-dev@squeakland.org http://lists.squeakland.org/mailman/listinfo/etoys-dev
etoys-dev@lists.squeakfoundation.org