void PlaceCursor(PointerEventData eventData) { var pos = new Vector2(eventData.position.x - picker.hsvImage.rectTransform.position.x, picker.hsvImage.rectTransform.rect.height * picker.hsvImage.transform.lossyScale.y - (picker.hsvImage.rectTransform.position.y - eventData.position.y)); // Debug.Log(pos); pos.x /= picker.hsvImage.rectTransform.rect.width * picker.hsvImage.transform.lossyScale.x; pos.y /= picker.hsvImage.rectTransform.rect.height * picker.hsvImage.transform.lossyScale.y; pos.x = Mathf.Clamp(pos.x, 0, .9999f); //1 is the same as 0 pos.y = Mathf.Clamp(pos.y, 0, .9999f); //Debug.Log(pos); picker.MoveCursor(pos.x, pos.y); }
static public int MoveCursor(IntPtr l) { try { UnityEngine.UI.Extensions.HSVPicker self = (UnityEngine.UI.Extensions.HSVPicker)checkSelf(l); System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); System.Boolean a3; checkType(l, 4, out a3); var ret = self.MoveCursor(a1, a2, a3); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }