PixelPreciseCollapsibleSlider() public static method

public static PixelPreciseCollapsibleSlider ( int id, Rect position, float value, float min, float max, bool &expanded ) : float
id int
position UnityEngine.Rect
value float
min float
max float
expanded bool
return float
Exemplo n.º 1
0
        public float ResizeHandle(Rect windowPosition, float minSize, float minRemainingSize, float resizerHeight, Rect dragRect)
        {
            if (Mathf.Abs(this.m_CachedPref) < minSize)
            {
                this.m_CachedPref = minSize * Mathf.Sign(this.m_CachedPref);
            }
            float num      = windowPosition.height - minRemainingSize;
            bool  flag     = GUIUtility.hotControl == this.id;
            float num2     = (!flag) ? Mathf.Max(0f, this.m_CachedPref) : PreviewResizer.s_DraggedPreviewSize;
            bool  flag2    = this.m_CachedPref > 0f;
            float num3     = Mathf.Abs(this.m_CachedPref);
            Rect  position = new Rect(0f, windowPosition.height - num2 - resizerHeight, windowPosition.width, resizerHeight);

            if (dragRect.width != 0f)
            {
                position.x     = dragRect.x;
                position.width = dragRect.width;
            }
            bool flag3 = flag2;

            num2 = -PreviewResizer.PixelPreciseCollapsibleSlider(this.id, position, -num2, -num, 0f, ref flag2);
            num2 = Mathf.Min(num2, num);
            flag = (GUIUtility.hotControl == this.id);
            if (flag)
            {
                PreviewResizer.s_DraggedPreviewSize = num2;
            }
            if (num2 < minSize)
            {
                num2 = ((num2 >= minSize * 0.5f) ? minSize : 0f);
            }
            if (flag2 != flag3)
            {
                num2 = ((!flag2) ? 0f : num3);
            }
            flag2 = (num2 >= minSize / 2f);
            if (GUIUtility.hotControl == 0)
            {
                if (num2 > 0f)
                {
                    num3 = num2;
                }
                float num4 = num3 * (float)((!flag2) ? -1 : 1);
                if (num4 != this.m_CachedPref)
                {
                    this.m_CachedPref = num4;
                    EditorPrefs.SetFloat(this.m_PrefName, this.m_CachedPref);
                }
            }
            PreviewResizer.s_CachedPreviewSizeWhileDragging = num2;
            return(num2);
        }
Exemplo n.º 2
0
        public float ResizeHandle(Rect windowPosition, float minSize, float minRemainingSize, float resizerHeight, Rect dragRect)
        {
            if ((double)Mathf.Abs(this.m_CachedPref) < (double)minSize)
            {
                this.m_CachedPref = minSize * Mathf.Sign(this.m_CachedPref);
            }
            float b        = windowPosition.height - minRemainingSize;
            float num1     = GUIUtility.hotControl != this.id ? Mathf.Max(0.0f, this.m_CachedPref) : PreviewResizer.s_DraggedPreviewSize;
            bool  expanded = (double)this.m_CachedPref > 0.0;
            float num2     = Mathf.Abs(this.m_CachedPref);
            Rect  position = new Rect(0.0f, windowPosition.height - num1 - resizerHeight, windowPosition.width, resizerHeight);

            if ((double)dragRect.width != 0.0)
            {
                position.x     = dragRect.x;
                position.width = dragRect.width;
            }
            bool  flag1 = expanded;
            float num3  = Mathf.Min(-PreviewResizer.PixelPreciseCollapsibleSlider(this.id, position, -num1, -b, 0.0f, ref expanded), b);

            if (GUIUtility.hotControl == this.id)
            {
                PreviewResizer.s_DraggedPreviewSize = num3;
            }
            if ((double)num3 < (double)minSize)
            {
                num3 = (double)num3 >= (double)minSize * 0.5 ? minSize : 0.0f;
            }
            if (expanded != flag1)
            {
                num3 = !expanded ? 0.0f : num2;
            }
            bool flag2 = (double)num3 >= (double)minSize / 2.0;

            if (GUIUtility.hotControl == 0)
            {
                if ((double)num3 > 0.0)
                {
                    num2 = num3;
                }
                float num4 = num2 * (!flag2 ? -1f : 1f);
                if ((double)num4 != (double)this.m_CachedPref)
                {
                    this.m_CachedPref = num4;
                    EditorPrefs.SetFloat(this.m_PrefName, this.m_CachedPref);
                }
            }
            PreviewResizer.s_CachedPreviewSizeWhileDragging = num3;
            return(num3);
        }