Assets/FlexibleColorPicker/Scripts/FlexibleColorPicker.cs
/// <summary>
/// Get normalized position in the case of a screen space (overlay) 
/// type canvas render mode
/// </summary>
Get normalized position in the case of a screen space (overlay)
type canvas render mode
Get normalized position in the case of a screen space ( overlay ) type canvas render mode
private static Vector2 GetNormScreenSpace(RectTransform rect, BaseEventData e) {
        Vector2 screenPoint = ((PointerEventData)e).position;
        Vector2 localPos = rect.worldToLocalMatrix.MultiplyPoint(screenPoint);
        float x = Mathf.Clamp01((localPos.x / rect.rect.size.x) + rect.pivot.x);
        float y = Mathf.Clamp01((localPos.y / rect.rect.size.y) + rect.pivot.y);
        return new Vector2(x, y);
    }
private static Vector2 GetNormScreenSpace ( RectTransform rect , BaseEventData e ) { Vector2 screenPoint = ( ( PointerEventData ) e ) . position ; Vector2 localPos = rect . worldToLocalMatrix . MultiplyPoint ( screenPoint ) ; float x = Mathf . Clamp01 ( ( localPos . x / rect . rect . size . x ) + rect . pivot . x ) ; float y = Mathf . Clamp01 ( ( localPos . y / rect . rect . size . y ) + rect . pivot . y ) ; return new Vector2 ( x , y ) ; }
Get normalized position in the case of a screen space (overlay)
type canvas render mode
Get normalized position in the case of a screen space ( overlay ) type canvas render mode
rect
RectTransform
e
BaseEventData