psychopy icon indicating copy to clipboard operation
psychopy copied to clipboard

Fix setting color has no effect

Open jakobchwastek opened this issue 2 years ago • 2 comments

Only setting the color parameter which should set both the 'fillColor' and 'lineColor' has no effect since 'Polygon' parameter 'fillColor' is 'white'. BaseShapeStim then would draw the default white color instead of the color handed over to Polygon as argument.

jakobchwastek avatar Jun 20 '22 22:06 jakobchwastek

I can see the logic here - in theory, BaseShapeStim should handle this kind of stuff, but as you point out Polygon having a default fillColor of "white" kind of messes with that as undefined fillColor is no longer False... I wonder if a better solution is maybe to have the default fillColor for Polygon also be False, and instead have the end of the if else statement handling fillColor in BaseShapeStim set it to "white" rather than None; as setting fillColor to False when color is defined means that color overrides fillColor, which is the opposite of how all other BaseShapeStim-derived classes work.

TEParsons avatar Jun 23 '22 10:06 TEParsons

It's not often I'll admit JS does it better, but distinguishing between None (aka transparent) and undefined would actually be very useful here :')

TEParsons avatar Jun 23 '22 10:06 TEParsons

Thanks so much @jakobchwastek and sorry for delay pulling this in but you're quite right about the bug and the fix :-) We're looking at whether we can make this more intuitive than it currently is so that this won't confuse people (including us) in the future, and that took some time but I think it's time to pull in your fix as a good start and work through any refactoring separately in the future

thanks again

peircej avatar Oct 14 '22 14:10 peircej