jodhman / react-eyedrop

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

Color selection is offset #21

Closed kevinhaas closed 4 years ago

kevinhaas commented 4 years ago

I set up a basic example in both storybook and my own app, but both seem to have trouble grabbing colors. I tested HTML elements, a .jpg, and an .svg in multiple scenarios and the accuracy is always off. Tried in latest FF/Chrome.

I found this issue which was closed but the reporter still seemed to be having trouble. Can you please confirm that the library is working?

jodhman commented 4 years ago

Hi there, @kevinhaas! Sorry for a delayed reply. Been rather busy settling in a new country, Copenhagen. I'm sorry to hear that it isn't working as intended for you. Could you possibly do me the favor of creating a minimal usage example, and share the code with me? It would be very helpful in solving the issue. I'll make sure to have it sorted asap for you. :-)

kevinhaas commented 4 years ago

Hey @jodhman

I can actually see it happening in your own example. If I upload an image and click outside the image, it randomly grabs colors from the image when it should only be grabbing that dark blue outer color.

In my own testing, all I did was create a few 15x15 divs with different colors and it is always offset. I have to click "outside" of the element to pick that color. Just load up the dropper with the snippet below and try to pick the colors from the divs.


  const colors = [
    '#D0021B',
    '#F5A623',
    '#F8E71C',
    '#8B572A',
    '#7ED321',
    '#417505',
    '#BD10E0',
    '#9013FE',
    '#4A90E2',
    '#50E3C2',
    '#B8E986',
    '#000000',
    '#4A4A4A',
    '#9B9B9B',
    '#FFFFFF',
  ];

  return (
    <div
      style={{
        alignItems: 'center',
        display: 'flex',
        flexDirection: 'row',
      }}
    >
      {colors.map((color) => (
        <div
          key={color}
          style={{ backgroundColor: color, height: 15, width: 15 }}
        />
      ))}
    </div>
  );
};
jodhman commented 4 years ago

I understand, @kevinhaas. I'm taking a look as we speak. Let me get back to you shortly.

jodhman commented 4 years ago

Alrighty, @kevinhaas! Go ahead and try with the latest release 4.1.3. I believe the issue you're experiencing is gone.

Let me know if the issue persists, or if there is anything else! :smiley:

kevinhaas commented 4 years ago

Thank you! I'll test this tomorrow.

jodhman commented 4 years ago

I presume the issue has been "eliminated". :smile: Thank you for reporting this. Have a great day!

kevinhaas commented 4 years ago

Sorry, I just got to this. It works perfect so far in my testing, thank you very much!