peter-kish / gloot

A universal inventory system for the Godot game engine.
MIT License
640 stars 28 forks source link

Feature Request: expand_icon option for ItemSlot #154

Closed LeeWannacott closed 8 months ago

LeeWannacott commented 9 months ago

Howdy again,

Any chance you could add a property on ItemSlot like what a Button node has called "expand_icon" (under Icon Behavior) . Where it would resize the items image/icon equipped in the ItemSlot down (or up) to fit the ItemSlots size whilst maintaining the aspect ratio. Currently the item-slot gets its size from the image; which is hell if you have different sized .pngs because you have to resize/scale manually to try and make the size of multiple slots the same.

Cheers.

peter-kish commented 8 months ago

That would make sense. Currently there's the icon_scaling property which you can adjust, but that's not always easy to get right. Scaling the icons the same way built-in controls do would make it also more intuitive to use.

LeeWannacott commented 8 months ago

That would make sense. Currently there's the icon_scaling property which you can adjust, but that's not always easy to get right. Scaling the icons the same way built-in controls do would make it also more intuitive to use.

Yeah, I played around with icon_scaling, however it scales the image inside the container so realistically you would most likely always want icon_scaling be 1 (and scale the control instead) maybe smaller like 0.8 if you wanted to have a margin around the image but currently I don't think you can center the icon? (you could possibly yoink the other icon behavior for centering as well :thinking: ). You could possibly use the text behavior for the label on it as well.

peter-kish commented 8 months ago

More customizable icon and text behavior has been added in https://github.com/peter-kish/gloot/commit/ecaf16ee0b3ed648dfd4c851e07861bc1de6f274.

Screenshot_20240224_132623