jvalen / pixel-art-react

Pixel art animation and drawing web app powered by React
https://www.pixelartcss.com/
MIT License
5.41k stars 305 forks source link

Drawing in black although first cell of palette is other color #25

Closed xgbuils closed 6 years ago

xgbuils commented 6 years ago

Steps to reproduce:

Expected behaviour: Cell is drawn with color #5599dd Current behaviour: Cell is drawn with color #000000

Possible solution:

Now we have:

I think there are redundant data that causes this kind of bugs when data is not well syncronized. I propose refactor the state to a List of colors and a cell active position. I think that in this case could be enough to represent the state of palette.

I'm working in converting the main reducer in a composition of subreducers that handles the different substates of aplication (palette, drawing tool, active grid, frames, etc) simplifying the relation between state and actions and allowing easier unit tests.

These are the branches where I'm working sequantially after #22 PR:

I could fix this issue after implementing palette reducer. I could be easier to fix.

Cheers!

jvalen commented 6 years ago

Nice catch! It sounds good, let me review the PR so you can resume the reducers refactor. Thank you!