Permalink
Browse files

Merge pull request #112 from diddledan/master

UIColorPicker fix to select the _correct_ colour.
  • Loading branch information...
2 parents f1f09f7 + cb5a1a3 commit 22e161063257769897d2a2ca99779e0841e46c21 @prime31 prime31 committed May 24, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 Assets/Plugins/UIToolkit/UIElements/UIColorPicker.cs
@@ -84,11 +84,11 @@ public override void onTouchMoved( Touch touch, Vector2 touchPos )
private Vector2 getTouchTextureCoords( Vector2 touchPos )
{
float xChange = touchPos.x - position.x;
- xChange = Mathf.Clamp( xChange, 0, width - 1 );
+ xChange = Mathf.Clamp( xChange + (0.5f * width), 0, width - 1 );
float xPos = textureCoords.x + xChange;
- float yChange = touchPos.y - -1 * ( position.y );
- yChange = Mathf.Clamp( yChange, 1, height );
+ float yChange = touchPos.y - ( -1 * position.y );
+ yChange = Mathf.Clamp( yChange + (0.5f * height), 1, height );
float yPos = manager.textureSize.y - ( textureCoords.y + yChange );
return new Vector2( xPos, yPos );

0 comments on commit 22e1610

Please sign in to comment.