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

Improve TextureRegionEditor #61429

Merged
merged 1 commit into from
May 26, 2022
Merged

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented May 26, 2022

Follow-up to #61342

  • decrease the default popup size by 37.5%
  • on popup: center the view on the texture
  • draw a slight border around the texture
  • add some missing header initialization

image

hscroll->set_value((hscroll->get_min() + hscroll->get_max() - hscroll->get_page()) / 2);
vscroll->set_value((vscroll->get_min() + vscroll->get_max() - vscroll->get_page()) / 2);
// This ensures that the view is updated correctly.
callable_bind(callable_mp(this, &TextureRegionEditor::_pan_callback), Vector2(1, 0)).call_deferred(nullptr, 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't believe centering on the texture was so difficult. I resorted to this hack, anything better would require some bigger rewrite of the scroll logic.

One of the problems was that the scrollbars are initialized to their final value after a second update, hence the hscroll->get_min() < 0 part.

@reduz
Copy link
Member

reduz commented May 26, 2022

looks great to me!

@fabriceci
Copy link
Contributor

Is there a reason not to always use the percentage rather than the relative unit for zooming?

@akien-mga akien-mga merged commit 155c6e9 into godotengine:master May 26, 2022
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the texturegion branch May 26, 2022 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants