public void OnDrag(PointerEventData eventData) { float hueValue = SetPickerPositionFromScreen(Input.mousePosition); ColorSBPicker.SetHue(hueValue); ColorPicker.SetTargetColor(); }
public static void SetColor(Color c) { HSBColor hsb = HSBColor.FromColor(c); ColorPicker.selectedColor = c; chp.SetPickerPositionFromHue(hsb.h); ColorSBPicker.SetHue(hsb.h); csbp.SetPickerPositionFromSB(hsb.s, hsb.b); }
// void Update() // { // if (Input.GetMouseButtonDown (0)) { // // inrect is set to return always false.. This is for later // if (inRect(Input.mousePosition)) { // float hueValue = SetPickerPositionFromScreen (Input.mousePosition); // ColorSBPicker.SetHue (hueValue); // } // } // } void Initialize() { bgTrans = HBackground.GetComponent <RectTransform> (); rectTrans = gameObject.GetComponent <RectTransform> (); width = bgTrans.rect.width; height = bgTrans.rect.height; Vector2 p = rectTrans.anchoredPosition; ColorSBPicker.SetHue(GetHueValueFromPoint((horizontalHueScale) ? p.x : p.y)); }
void Start() { ColorPicker.chp = gameObject.GetComponent <ColorHPicker> (); bgTrans = HBackground.GetComponent <RectTransform> (); rectTrans = gameObject.GetComponent <RectTransform> (); width = bgTrans.rect.width; height = bgTrans.rect.height; Vector2 p = rectTrans.anchoredPosition; shift = new Vector2(bgTrans.position.x, bgTrans.position.y); GameObject cp = GameObject.FindGameObjectWithTag("ColorWheel"); setShaderOrigin(cp.GetComponent <RectTransform>().anchoredPosition); float hue = circularScale ? width * (turnableScale ? 0.125f : -0.25f) : p.x; if (turnableScale) { Material m = HBackground.GetComponent <Shape> ().material; m.SetFloat("_Rotation", 0); } ColorSBPicker.SetHue(GetHueValueFromPoint(hue)); ColorPicker.SetTargetColor(); }