diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-01 10:34:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 10:34:21 +0200 |
commit | e695ac6e7b70332fe88e37559f3aa345aace8b24 (patch) | |
tree | d594e5c12854839536fddc175f744c543af97eca /scene/gui | |
parent | d735ce80b969433ae388f64d29daeb6efa5484e2 (diff) | |
parent | 108068ab41364b291c7134594539752d4a3cf550 (diff) |
Merge pull request #32364 from Relintai/resizeable-texture-progress
TextureProgress: nine_patch_stretch property -> enable stretching for radial fills.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/texture_progress.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index c534df5cbe..9b60a9d1c3 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -344,6 +344,9 @@ void TextureProgress::_notification(int p_what) { case FILL_CLOCKWISE: case FILL_COUNTER_CLOCKWISE: case FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE: { + if (nine_patch_stretch) + s = get_size(); + float val = get_as_ratio() * rad_max_degrees / 360; if (val == 1) { Rect2 region = Rect2(Point2(), s); @@ -384,7 +387,13 @@ void TextureProgress::_notification(int p_what) { draw_polygon(points, colors, uvs, progress); } if (Engine::get_singleton()->is_editor_hint()) { - Point2 p = progress->get_size(); + Point2 p; + + if (nine_patch_stretch) + p = get_size(); + else + p = progress->get_size(); + p.x *= get_relative_center().x; p.y *= get_relative_center().y; p = p.floor(); |