Author Topic: Drag and drop not centering on new content  (Read 3883 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Drag and drop not centering on new content
« on: May 30, 2015, 12:47:28 PM »
Using the containers from Example 11. If I start with one empty and one with content, and drag content to the empty grid, the dropped item disappears out of view. I have to scroll the grid once the content has been added. Setting it after add to offset == 0 fixes this.

Is there a fix for this so grids centre correctly on content?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag and drop not centering on new content
« Reply #1 on: June 01, 2015, 08:45:37 PM »
I don't quite understand what you mean...

If I open up example 11, delete all entries from one drag & drop list, hit Play and drag an item from the other, it ends up in the grid's 0 position, as expected. It's not out of view for me, but then again my screen size is quite large. Are you expecting it to be in the middle of the scroll view instead?

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: Drag and drop not centering on new content
« Reply #2 on: June 02, 2015, 05:05:49 AM »
Start example 11. Remove all items from Right Container grid. Play. Drag one item from left to right. The item is added at the top of the Right grid out of view. Set Content origin to centre. Item becomes centred. Stop.

Set scrollview Content Origin to Centre. Play. Drag one item. The item is added at the top out of view. Stop.

Add one item to the right grid and play. It appears at the top regardless of Content Origin setting. If I change Content Origin while playing, it corrects the content position. Stop.

After playing with one item present, I can change Content Origin in the editor and the grid behaves itself.

It appears some changes aren't being applied at start.

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: Drag and drop not centering on new content
« Reply #3 on: June 04, 2015, 08:07:40 AM »
Another issue is content not centring properly on start. If I click an item in the list, it nudges the list slightly to the side.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag and drop not centering on new content
« Reply #4 on: June 07, 2015, 12:42:01 PM »
The item is added wherever the grid object resides. It doesn't matter what the grid origin is set to -- all that does is adjusts the position of children after the fact, but with one child it will be the same regardless.

If you want it to appear in the middle, move the grid object's transform to the middle.