ruhley / angular-color-picker

Vanilla AngularJS Color Picker Directive with no requirement on jQuery
http://ruhley.github.io/angular-color-picker/
MIT License
166 stars 79 forks source link

Automatic adding closing parenthesis happens sometimes too early #61

Closed TooAngel closed 8 years ago

TooAngel commented 8 years ago

Using examples/01-simple.html and setting format to rgb. When deleting the last two parts with parenthesis (255, 255)), on adding new values like 3,2 the closing parenthesis is automatically added and the cursors is placed behind. This can be annoying if your color value is more than one digit.

ruhley commented 8 years ago

@TooAngel I have pushed a commit to try and fix this issue. I am not 100% sure about the fix, so would you be able to test with the latest master branch? The difference now is that the text can change when gaining focus on the input box again.

TooAngel commented 8 years ago

Hey, cool, this works better. The format is corrected as soon as I refocus the field.

When thinking how I would solve it, I also thought about just placing the cursor before the closing parenthesis. So if you are typing the parenthesis is added, but you can complete your typing.

But the current solution is also fine. Thanks :+1:

TooAngel commented 8 years ago

Is there anything I can do to speed up the release of the change?

ruhley commented 8 years ago

I wasn't quite happy with the solution above because ngModel was in the incorrect format and then that could be saved to the database.

So I tried to implement a solution with automatic cursor repositioning. But browser support is a large issue with that. And spaces could automatically be added, so we may not know exactly where to put the cursor.

I then went back to the above solution, but added a blur formatter. I feel this is currently the best solution.

Fixed in commit c606075c6f6dd3107cac6186178c29ea8fcadcc0 and released in v1.0.3

TooAngel commented 8 years ago

K, cool, thx