Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Majicpanda on January 22, 2014, 10:54:38 PM

Title: Draggable Panel map with zoom feature?
Post by: Majicpanda on January 22, 2014, 10:54:38 PM
I have a world map in 2d which has a draggable panel on it.  Everything works great, you can grab it and drag it around and it correctly stops at a bounds I specify.

What I want to do is implement a zoom feature.  There are tons of items that are clickable as a child of the map.  Resizing the UIRoot to double size creates the "zoom" out I want.  How do you accomplish this in code?  Also, if I double the res it makes it so there's a bunch of extra room to drag around to which I didn't account for.  The pink area needs to collapse to meet the zoomed out effect... is this possible?
Title: Re: Draggable Panel map with zoom feature?
Post by: ArenMook on January 23, 2014, 05:56:06 AM
Change the orthographic size of the camera. It's at 1 by default.
Title: Re: Draggable Panel map with zoom feature?
Post by: Majicpanda on January 23, 2014, 10:27:33 PM
How do you resolve the issue where the drag area is now creating blank space beyond the original intended bounds behind the map?
Title: Re: Draggable Panel map with zoom feature?
Post by: ArenMook on January 24, 2014, 10:41:50 AM
I'm not sure what you mean. Also you know that "draggable panel" doesn't exist anymore, right?
Title: Re: Draggable Panel map with zoom feature?
Post by: Majicpanda on January 24, 2014, 12:49:04 PM
Yes but currently unable to upgrade due to font issues and our UI being size 144 as described in the other thread.

Aside from that, my clip size is 1000x550.

If I change the camera ortho size to 2 to create a zoom feature, the new clip size needs to scale down (to about 600 x 350 or so) so that the player cannot slide the map anymore.  Technically zoom ortho 2 means the entire map is now visible.  We "could" just add a ton of extra water around the outside of the map, but I was hoping to lock the map in instead.
Title: Re: Draggable Panel map with zoom feature?
Post by: ArenMook on January 24, 2014, 11:59:37 PM
If you want to zoom the contents of the scroll view, then scale the object under the scroll view.

Scroll View
- Game object (scale this transform)
-- Actual content -- your map sprite, or anything you want