Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iris.Image, Iris.ImageButton #45

Open
Michael-48 opened this issue Mar 1, 2024 · 1 comment
Open

Iris.Image, Iris.ImageButton #45

Michael-48 opened this issue Mar 1, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@Michael-48
Copy link
Owner

No description provided.

@Michael-48 Michael-48 added the enhancement New feature or request label Mar 1, 2024
@Michael-48 Michael-48 added this to the v2.3.0 milestone Mar 1, 2024
@SirMallard
Copy link
Collaborator

I've added in the Iris.Image widget to the image branch, but I wasn't sure about the best way to deal with the arguments. Looking at the Dear ImGui Image API, it has the arguments of image, the image size, a UV min and max argument and then tint and border colours:

IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));

These are a few arguments which I think can be compacted in various ways:

  • The size property is currently a Vector2 which is converted into a UDim2, because there's not a reason I can see for wanting full width or height images, but I might be proven wrong.
  • Roblox ImageLabels support RectOffset and RectSize properties, which is equivalent to the uv0 and uv1 Dear ImGui arguments. However, Roblox also has a Rect datatype which seems like and obvious candidate which would turn two arguments into one.
  • The tinting seems equivalent to the ImageColor and ImageTransparency properties, and for now I've just used the Text style from the config. This means you can just push and pop the style if you need to change the image and makes sense in my opinion.
  • The padding seems slightly unusual and from what I can tell uses the FramePadding style to control. I haven't included this yet, and I don't know whether there would be a better way of controlling this, such as through another border style.
  • Roblox ImageLabels provide multiple rendering and scaling styles, which I want to support but they include a bunch of extra proeprties which would need to be optional arguments since not all of them are used. Supporting 9-slice images would be helpful, alongside changing the scaling mode to prevent stretching but bloat the arguments.

These are the issues and questions I have from making the first version and I would like some input on how to go forwards with the Image widgets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants