ruhley / angular-color-picker

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

Can't select color on mobile #77

Closed michellelim closed 8 years ago

michellelim commented 8 years ago

I'm using v1.1.2 and it works on desktop. However on mobile, the color picker defaults to #000000 when you click anywhere inside the color picker. The entire right side color picker doesn't work. I can see the picker moving along the bottom of the color square when trying to select a color, but alas, it is still black.

This is how I'm calling the color picker: <color-picker ng-model="color1" color-picker-format="'hex'"></color-picker>

ruhley commented 8 years ago

Can you please provide your device and browser. It works fine for me on Chrome and Firefox on Android.

michellelim commented 8 years ago

I'm using a Samsung Galaxy S7 (SM-G930T) running Android 6.0.1 in Chrome 50.0.2661.89. I also tried it on a Sony Xperia Z5 Compact (E5803) running Android 6.0 in Chrome 51.0.2704.81. Same result for both devices.

royvandam commented 8 years ago

I can confirm this behavior on a One Plus One running 6.0.1 in Chrome 50.0.2661.89.

lorenzo-dd commented 8 years ago

to fix the issue just comment these lines:

//hack for small chrome screens not position the clicks properly when the page is scrolled if (window.chrome && screen.width <= 768) { return { top: rect.top - docElem.clientTop, left: rect.left - docElem.clientLeft }; }

it seems that this hack is only causing issues with mobile devices

ruhley commented 8 years ago

I can confirm that I still need that code for Android 5, so I put in a hack to detect the android version. I don't really like it, but I don't know any other way around it.

Fixed in commit b61c286973316fa039fd6fec4c874da250577c08 and released in v1.1.3.

Please reopen if the problem persists