Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Thunder0ne on May 13, 2014, 03:43:26 AM

Title: Scroll View content zoom
Post by: Thunder0ne on May 13, 2014, 03:43:26 AM
Hi all,
I have set up a scroll view following the tutorial and it is working fine.
the objects that are managing this are
1) scroll view scroller. components: a UIPanel with a collider which only scrolls the UIPanel with the scroll view component (no clipping)
2) the scroll view. components: UIPanel with clipping area, and a scroll view.
They are both children of the same parent object which is a simple UIPanel without clipping.

I would like to know what is the suggested way to implement a zoom function which would magnify the content of the scroll view without altering its global clipping area.
(I have tried changing the scale of the scroll view object but the clipping area is , of course, altered and it moves when I drag the panel's content)

Many thanks.
Title: Re: Scroll View content zoom
Post by: ArenMook on May 13, 2014, 08:57:25 AM
Scroll View
- Content (scale this)
-- Item 1
-- Item 2
-- Item 3
Title: Re: Scroll View content zoom
Post by: Thunder0ne on May 14, 2014, 06:02:31 AM
Hi,
many thanks for the suggestion.
Actually I needed to zoom pivoting on the center of the clipping panel.
I have done it by anchoring an empty widget on the view center and then I scale the positions of the elements of the scroll view (and their local scale as well).
Is there a way to retrieve the world position of the center of the clipping panel?

Many thanks.
Title: Re: Scroll View content zoom
Post by: ArenMook on May 14, 2014, 06:59:47 AM
  1. Vector3[] corners = panel.worldCorners;
  2. Vector3 center = Vector3.Lerp(corners[0], corners[2], 0.5f);
Title: Re: Scroll View content zoom
Post by: Thunder0ne on May 16, 2014, 04:36:02 AM
Many thanks it works.