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

Maintain Aspect anchor #15252

Closed
ghost opened this issue Jan 1, 2018 · 6 comments · Fixed by #27559
Closed

Maintain Aspect anchor #15252

ghost opened this issue Jan 1, 2018 · 6 comments · Fixed by #27559

Comments

@ghost
Copy link

ghost commented Jan 1, 2018

I was looking for this earlier and couldn't find. What I mean is, if any Control-based node occupies 25% of the screen on 480p, it must also occupy 25% of the screen in 1080p. I know how do this manually, you have to set the anchors like this:

Anchor left: pos.x / screen_width
Anchor top: pos.y / screen_height
Anchor right: (pos.x + size.x) / screen_width
Anchor bottom: (pos.y + size.y) / screen_height

But if the UI changes, there's the need to recalculate those anchors. There should be a 'Maintain Aspect' anchor that calculates it automatically using the code above. Or if there is already something that does this, then it should be more visible.

I do know about viewport stretch on the project settings, but then it applies to everything

Godot 3.0 Beta 2

@volzhs
Copy link
Contributor

volzhs commented Jan 1, 2018

why did you remove issue template? your godot version?

screenshot from 2018-01-02 05-28-25
with godot 3.0, you can do it like above.

this will cover top 25% of the screen on whatever screen size.

@bojidar-bg
Copy link
Contributor

Maybe another dragging mode, in which it moves anchors instead of margins would help? Potentially it might be triggered by holding Ctrl/Shift/Alt.

@groud
Copy link
Member

groud commented Jan 2, 2018

I don't really get the problem.
You can drag the anchors using the dedicated helpers (the green pins, activated with the 'h' key).

Also, if you activate smart snapping, anchors can be snapped to the node side, which should solve your problem.

@groud
Copy link
Member

groud commented Jan 2, 2018

It's in "View"/"Show helpers".

@groud
Copy link
Member

groud commented Jan 2, 2018

Every control node when selected should show its anchor helpers, disregarding 'Show helpers' option.

When I implemented it @reduz told me it was better not to show them by default. But I'm personally not against the idea. This has to be discussed.

When changing only anchors the node will get strangely relocated, which interrupts workflow. (probably a bug)

Can you open an issue for this one ? With a screen capture if possible, I cannot reproduce. Edit: I managed to reproduce it, and fix it :)

Add a 'Maintain aspect' button to 'Layout' which sets the anchors to the node's boundaries.

Adding a "Set to the node's boundaries" option in "Layout" / "Anchors only", would make sense.
Maybe we can also have a modifier (ctrl, alt or shift) to keep the margin values when moving the anchors too.

@groud
Copy link
Member

groud commented Jan 12, 2018

When changing only anchors the node will get strangely relocated, which interrupts workflow. (probably a bug)

This is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants