Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
139 stars 2 forks source link

UIX: per-element scaling #1987

Open 5H4D0W-X opened 6 months ago

5H4D0W-X commented 6 months ago

Is your feature request related to a problem? Please describe.

UIX does not allow simple scaling of items, instead requiring nested canvases or elaborate setups with lots of ValueGradientDrivers to achieve a similar effect. This also does not allow non-uniform scaling

Describe the solution you'd like

A float2 scaling multiplier on the RectTransform that affects the scale of the item it’s on and its children.

Describe alternatives you've considered

Nested canvases, which add complexity and performance costs

Additional Context

Related to #1516

Requesters

ShadowX

JackTheFoxOtter commented 6 months ago

I'm not quite sure what you mean, but you can already use the AnchorMin & AnchorMax of a RectTransform to scale it, if it's not used in a layout. That also works non-uniformly, I've done that plenty of times in the past.

5H4D0W-X commented 6 months ago

By "scaling" I don't mean just the size of the rect, I am talking about the relative size compared to the base canvas. Imagine a slot hierarchy, where if a slot is scaled to 0.5 then all children will inherit that scale and rendered objects such as meshes or text will also be smaller. Changing the bounds of a rect transforms may transfer those to its children, but it's not the same effect as scale on a slot.

Frooxius commented 6 months ago

What kind of effect/use-case are you trying to achieve here? Can you provide some images / sketches so we can better understand the problem?

5H4D0W-X commented 6 months ago

I made this crude graphic to explain what I mean: image

Essentially, I want a UIX version of slot scale

Frooxius commented 6 months ago

What are the typical use-cases for something like this?

I'm trying to see how we could approach something like this. The UIX transforms work a bit different from Slots, so the concepts don't map 1:1.

I assume the scaling will not change the "actual" rects in this case - the amount of "space" doesn't change? Or should it fill in the remaining space?

E.g. if you have 400x200 units Rect and you scale it, will the content still behave as if it's 400x200? If you scale it big, will it just overlap over existing things?

Or do you expect it to be re-adjusted to fit, so if you scale it to be twice as big, then the actual rect will be 200x100 and fit less content?

5H4D0W-X commented 6 months ago

I thought about that and to start, I think the best approach is to just make the rect smaller or have it overlap things when scaled bigger (i.e. it stays the same size from the perspective of its content). Maybe there could be some sort of component to make it adjust to its original size (like RectTransformLerp) but as with the rotation, having it not affect layout flow would be easiest to implement and understand as a user.

Modals and toasts are probably a relevant use-case, since many in-dash modals expand from a horizontal line to their final size. Scale animation is also very common for buttons and modern operating systems in general.

Kisara-Azure commented 1 month ago

20240920022037_1