Custom UIGridLayout for Inventory

I’m looking for help figuring out how to make a system that seems a little complex to me.

I’m trying to make a GUI inventory, and the items are placed in a frame. I usually use a GridLayout to arrange my items, but in this case, the items are all different sizes. I want to arrange them as in GridLayout with an offset, but I have to adapt each item in relation to the others. I have included an image to explain what I am looking for because it is difficult to describe.

How would you go about it?

This is complex enough you should just not use a grid layout. Keep a table with each index pointing to a table that represents an item, and use the table to query if placement is possible or handle moving logic.

Then just place the items directly in their parent grid location with their size per object and that will naturally get you what you want. You can even just leave them alone so long as the size doesn’t change of the parent. Otherwise you’ll need to reposition/resize every time something changes.