jodhman / react-eyedrop

Seamlessly integrate a static typed, fully-tested color-picking React component/hook!
24 stars 11 forks source link

Fix getColor issues #56

Closed paulm17 closed 1 year ago

paulm17 commented 1 year ago

There was an issue with getColor. If no radius was chosen, getCanvasPixelColor works fine. However, should a radius be chosen then calcAverageColor was not reporting back the correct colour.

I have changed the functions getCanvasBlockColors and calcAverageColor so that the correct colour returns.

I also have added an onChange event to the hook. This should complete the hook being 100% useable.

So far, I have only re-tested the example. This works fine. But I'd appreciate an npm push and then I will be able to confirm myself. Maybe an html example should be created as well?

Finally, I have amended the npm start method in the example, so that it works node 16+.