Author Topic: Scroll View's inside item's alignment problem.  (Read 2390 times)

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
Scroll View's inside item's alignment problem.
« on: January 27, 2015, 02:21:58 AM »
Hi.
As you can see in this short video,

http://youtu.be/T61Jd5pbDD8

First 2 cards at left corner of scrollview stacked(overlapped). Of course this is not intended, I don't want them stacked.

Why this occur and how to fix?
(This occur when I draw more than 4 cards for initial draw number)


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #1 on: January 27, 2015, 04:45:51 AM »
I'm not sure what I'm supposed to be seeing in that video. Stacked? Overlapped? I'm not seeing any overlap... you started a drag operation set to clone the object, then you dropped this cloned object into the scroll view. By default NGUI's drag & drop example script will destroy the clone when this happens, but you don't seem to be doing that, so it just adds this clone to the list, duplicating the object.

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #2 on: January 27, 2015, 10:45:18 PM »
Most left positioned card (drawing is Red Ball likely) actually stacked with other card. So it looks like 4 cards there, but actually there are 5 cards.

So I dragged that stacked card to outside and drop, it went to its intended position. (drawing is fire bolt likely)


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #3 on: January 28, 2015, 02:30:56 AM »
Did you call the grid's Reposition() function after adding your content? If you don't do it, the content won't be moved to its proper place.

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #4 on: January 28, 2015, 08:28:29 PM »
Did you call the grid's Reposition() function after adding your content? If you don't do it, the content won't be moved to its proper place.

Yes I did handGrid.Reposition();  after every card draw and final draw step's done.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #5 on: January 29, 2015, 12:55:26 PM »
After every card draw? That doesn't make sense to me...  add your all cards at once, then call Reposition().

leegod

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Scroll View's inside item's alignment problem.
« Reply #6 on: January 31, 2015, 08:10:55 PM »
After every card draw? That doesn't make sense to me...  add your all cards at once, then call Reposition().

Thank much!! This solves problem!