Author Topic: Scroll View content zoom  (Read 2704 times)

Thunder0ne

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Scroll View content zoom
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll View content zoom
« Reply #1 on: May 13, 2014, 08:57:25 AM »
Scroll View
- Content (scale this)
-- Item 1
-- Item 2
-- Item 3

Thunder0ne

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Scroll View content zoom
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll View content zoom
« Reply #3 on: May 14, 2014, 06:59:47 AM »
  1. Vector3[] corners = panel.worldCorners;
  2. Vector3 center = Vector3.Lerp(corners[0], corners[2], 0.5f);

Thunder0ne

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Scroll View content zoom
« Reply #4 on: May 16, 2014, 04:36:02 AM »
Many thanks it works.