buberdds / angular-bootstrap-colorpicker

Native AngularJS colorpicker directive. No dependency on jQuery or jQuery plugin is required.
MIT License
419 stars 226 forks source link

Colors leak between colorpicker instances when model is updated from other sources #65

Closed ProdigySim closed 8 years ago

ProdigySim commented 9 years ago

I've built a mostly stripped-down codepen example where two colorpicker-enabled inputs sit on a page. The first input is just a normal colorpicker input. The second has its model color updated every second by a $interval callback.

I can produce "bleed" issues in two different ways on this page.

First:

  1. Load the page and wait for the color of the second input to change automatically.
  2. Click inside the first input to open colorpicker and note that the displayed color is not "pink".
  3. Click outside the input and back in again to reopen colorpicker, and note that the color changes each time this is done.

Second:

  1. Click inside the first input box to open colorpicker.
  2. Hold down click in the colorpicker to slowly pick a color.
  3. Keeping the mouse button held down, you will notice that every second the displayed color changes.
buberdds commented 9 years ago

Hey @ProdigySim,

ad1) $scope.hexPicker = { color: 'pink' };

'pink' is not a valid hex value?

ad2) if you gonna use proper values it's fine second input is using rgba -> you are setting 'blue' and then assing hex values to rbga

ProdigySim commented 9 years ago

Ah, I thought the different picker modes were just about formatting their output. That's a little disappointing if they can't accept arbitrary input. I've updated the codepen example to use proper values, though: http://codepen.io/anon/pen/ZYYJYW

The first issue does not repro anymore (colorpicker showing random colors each time its opened).

However, the second issue I mentioned still exists on the updated codepen. Let me know if I've missed something else this time.

  1. Click inside the first input box to open colorpicker.
  2. Hold down click in the colorpicker to slowly pick a color.
  3. Keeping the mouse button held down, you will notice that every second the displayed color changes.
buberdds commented 9 years ago

what a crap, I'll try to look into this at the weekend.

reymarx commented 9 years ago

Hi @buberdds I'm curious what's the status on this.

We want to be able to use multiple colorpickers in the same view.

thanks