Author Topic: Anchoring not lining up as expected on 3.0.0x  (Read 2314 times)

6foot3foot

  • Guest
Anchoring not lining up as expected on 3.0.0x
« on: September 24, 2013, 04:05:01 PM »
I've tried with a,b,c,d the anchoring of my labels doesn't not line up at all with the widget parent.

A simple case is having a sprite background, and a label on top.  Setting the anchor to centre puts the image off to the far side, or sometimes the middle of the screen (yes the widget is set).  Tried with many different shapes / anchor types, maybe the changes in anchoring in 3.0 is more than I thought.  But I'd think if I anchor Widget A to Widget B and tell it to be 'right' it would neighbor up (setting the pivots correctly of course).  Or even have it center pivot, and then center within the other widget.  I'm just not seeing those results, leaving me to hand position everything, which is hard when supporting XXTeen resolutions for mobile.

6foot3foot

  • Guest
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #1 on: September 24, 2013, 04:11:51 PM »
As what I'm saying is probably hard to understand from reading.  Here's a simple way I can reproduce it.

Have a Sprite Widget, and a Label Widget.

1) Set Sprite pos to 0,0,0 Label somewhere else.
2) Add the anchor to the label, and have the sprite be the container widget.
3) Center the label to the sprite using the pivot / center anchor ( should work as expected)
4) Now, Move the sprite in a X or Y movement
--- This is where I see the issue, the label doesn't stay centered in the sprite container anymore, it pretty much stays still.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #2 on: September 24, 2013, 06:03:00 PM »
The widgets need to be siblings for them to anchor properly. I mention that in the video tutorial.

6foot3foot

  • Guest
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #3 on: September 24, 2013, 08:05:40 PM »
Correct, unless I'm 'sibling' them wrong.  But the label is a child.  I've attached screenshots to show the problem I see, it's that after I anchor and move the parent the child loses it's connection.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #4 on: September 24, 2013, 08:28:15 PM »
Sibling = next to each other in the hierarchy. A child is not a sibling. :P

Corwar

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #5 on: September 25, 2013, 05:32:51 PM »
6foot3foot, I was having the same troubles and even the sibling doesnt work correctly. Still with your label as a child of the sprite. With your steps above, just place a panel on your sprite and you should be set.

6foot3foot

  • Guest
Re: Anchoring not lining up as expected on 3.0.0x
« Reply #6 on: September 26, 2013, 04:00:06 PM »
Ok, I've tried with them not as children, and just lined up in the hierarchy, but will keep mucking with it. 

Corwar: Setting it as a panel does work, the problem is we are introducing new draw calls for each panel added (as far as I am able to understand how the panels / draws work), so when I have 100 table items it becomes expensive.  with 2.x the anchoring seemed to work as expected, but I'm sure the overhaul has just changed a lot of workflows, i'll revisit the new videos and spend time chasing this down.