Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Aleksandr

Pages: [1]
1
NGUI 3 Support / Re: Bug in Scroll bar with Scroll view
« on: March 26, 2014, 11:19:58 PM »
What will be the final decision on this issue ?

2
NGUI 3 Support / Re: Bug in Scroll bar with Scroll view
« on: March 26, 2014, 04:47:56 AM »
Аpparently I did not quite understand the whole situation.

 if (contentPadding < 0.001f) contentPadding = 0f;
    else if (contentPadding > 0.999f) contentPadding = 1f;
 sb.barSize = 1f - contentPadding;

 Delta 0.001f is too small. If element count < 3 (example 11) is the ability to move elements by scroll bar.
 So works better :)
            var sb = slider as UIScrollBar;
            if (sb != null)
            {
                if (contentPadding < 0.1f) contentPadding = 0f;
                else if (contentPadding > 0.999f) contentPadding = 1f;
                sb.barSize = 1f - contentPadding;
            }

3
NGUI 3 Support / Re: Bug in Scroll bar with Scroll view
« on: March 26, 2014, 03:22:16 AM »
@ArenMook:
I test code   
 if (contentPadding < 0.001f) contentPadding = 0f;
 else if (contentPadding > 0.999f) contentPadding = 1f;
 sb.barSize = 1f - contentPadding;
Incorrect behavior is present. (size was <1)

рow to check the condition  (else if (contentPadding > 0.999f) contentPadding = 1f;)?
In my version, I changed the value of the constant 0.01 to 0.1. And it works perfectly.

 protected void UpdateScrollbars(UIProgressBar slider, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted)
    {
        if (slider == null)
            return;

        mIgnoreCallbacks = true;
        if (viewSize < contentSize)
        {
            contentMin = Mathf.Clamp01(contentMin / contentSize);
            contentMax = Mathf.Clamp01(contentMax / contentSize);

            var contentPadding = contentMin + contentMax;
            slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) :
                                      ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f);

            var sb = slider as UIScrollBar;
            if (sb != null) sb.barSize = 1f - contentPadding;
        }
        else
        {
            contentMin = Mathf.Clamp01(-contentMin / contentSize);
            contentMax = Mathf.Clamp01(-contentMax / contentSize);

            var contentPadding = contentMin + contentMax;
            slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) :
                                      ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f);

            if (contentSize > 0)
            {
                contentMin = Mathf.Clamp01(contentMin / contentSize);
                contentMax = Mathf.Clamp01(contentMax / contentSize);
                contentPadding = contentMin + contentMax;
            }

            var sb = slider as UIScrollBar;
            if (sb != null)
            {
                contentPadding = (contentPadding < 0.1f) ? 0 : 1;
                sb.barSize = 1f - contentPadding;
            }

        }
        mIgnoreCallbacks = false;
    }




4
NGUI 3 Support / Re: Bug in Scroll bar with Scroll view
« on: March 25, 2014, 02:38:42 AM »
Thanks.
I found incorrect behavior if viewSize >= contentSize. (Test by Example 11)
If elements in left column < 4 then scrollbar.size = 0.995025.
Which makes it possible to move items. As version i fix that as:

 protected void UpdateScrollbars (UIProgressBar slider, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted)
    {
        if (slider == null) return;

        mIgnoreCallbacks = true;
        {
            if (viewSize < contentSize)
            {
                contentMin = Mathf.Clamp01(contentMin / contentSize);
                contentMax = Mathf.Clamp01(contentMax / contentSize);

                float contentPadding = contentMin + contentMax;
                slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) :
                    ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f);

                UIScrollBar sb = slider as UIScrollBar;
                if (sb != null) sb.barSize = 1f - contentPadding;
            }
            else
            {
                contentMin = Mathf.Clamp01(-contentMin / contentSize);
                contentMax = Mathf.Clamp01(-contentMax / contentSize);

                float contentPadding = contentMin + contentMax;
                slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) :
                    ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f);

                if (contentSize > 0)
                {
                    contentMin = Mathf.Clamp01(contentMin / contentSize);
                    contentMax = Mathf.Clamp01(contentMax / contentSize);
                    contentPadding = contentMin + contentMax;
                }

                UIScrollBar sb = slider as UIScrollBar;
                if (sb != null)
                {
                    contentPadding = (contentPadding < 0.01f) ? 0 : 1;
                    sb.barSize = 1f - contentPadding;
                }

            }
        }
        mIgnoreCallbacks = false;
    }

5
Utility.GetChildren(transform); not found

6
NGUI 3 Support / Bug in Scroll bar with Scroll view
« on: March 24, 2014, 05:32:26 AM »
When ScrollView.showCondition == Always
If a element amount less than the maximum amount of elements in the visible container.
Then scroll bar foreground calculated not correctly. Is size < 1.
Further reducing the number of elements leads to a reduction in size, although it should be equal to 1.
It can easily be played on a standard Example 11 - Drag & Drop.

Pages: [1]