react-native-color-wheel icon indicating copy to clipboard operation
react-native-color-wheel copied to clipboard

onColorChange returns negative hue value

Open pinpong opened this issue 6 years ago • 3 comments

react: 16.9.0 => 16.9.0 
react-native: 0.61.4 => 0.61.4

onColorChange returns a negative value for hue { color: { h: -77.86555987333482, s: 69.93991897257706, v: 100 } }

pinpong avatar Nov 14 '19 17:11 pinpong

Are you using the head git version or the npm version?

RickeyWard avatar Dec 03 '19 16:12 RickeyWard

I had to deal with this issue yesterday. You need to add 360 to the negative value to get it right

const fixedColor = { h: color.h >= 0 ? color.h : color.h + 360, s: color.s, v: color.v, };

robmim avatar Jul 15 '21 14:07 robmim

I would assume you would want to abs, not add 360 based on this line that sets that value. one would not normally use -180 here, but it's been that way for 4 years and it's unclear how many people it would trip up if it was changed now. deg: Math.atan2(dy, dx) * (-180 / Math.PI)

RickeyWard avatar Jul 18 '21 02:07 RickeyWard