jodhman / react-eyedrop

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

Feature/improvement fix limitation #64

Closed chanatorns closed 5 months ago

chanatorns commented 1 year ago

Hello, thank you for your work. I used this library and found some issues and I want to help improve it. This is what've change in this PR.

  1. Add support to pick color from svg element
  2. Fix memory leak problem when pick color on website that consist of high amount of DOM, this lead to browser freeze and crash. I creates an area to reproduce on example page, you can try with previous version of library on this example page by keep clicking it repeatedly.
  3. Add awaiting state on cursor by change cursor to loading icon when extracting is not finish yet. This help give a better user experience in the case that picking color process is taking long time than usual on the site consist of high amount of DOM.
  4. Add 2 ways to use image in example page, by uploading or by use local image for a quicker try.
  5. Add more element to example page to try out for various cases.
  6. Fix failed unit testing, to make functionality back to work as expected.
  7. Add support for development on Windows.
  8. Add package-lock into repository as recommended by npm.

There's a thing I found but leave it be the same.

  1. When picking color on image with transparent pixels it will unable to pick the color from background on transparent pixel, I decided to leave it like it was because it's like a trade-off for performance when picking color from image element.

This is my first time in contributing to the community I hope this is useful :)

jodhman commented 5 months ago

Hey @chanatorns! This is quite the contribution, your effort is very much appreciated. I have had the chance of going through the changes in detail today and everything looks good to me! :-) I will merge and publish a new version to npm within the next few days - I'll let you know once it's done <3

jodhman commented 5 months ago

Version 5.5.0 on npm now contains the contents of this PR. Thank you for your contribution to this library. :rocket:

chanatorns commented 5 months ago

@jodhman Thankyou so much! I'm very appreciate to contribute to this library. Unfortunately, I found some more issue to solve, I created PR here, please take a look. https://github.com/jodhman/react-eyedrop/pull/65