summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-02-16 21:02:29 +0100
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-02-16 21:02:29 +0100
commit1974f6995f6942b09dd4eea4e20585c6d9aad646 (patch)
treea941bfc16d9ecc8051a2c21f291a989c0115d59a /scene/gui
parentf5477ee36f2d34a5d6db0ee3e1516e9c12be28d5 (diff)
Fixed radial progress with center offset by taking distance to edge into account in uv calculation
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/texture_progress.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 778d86d546..bf6a5d30bf 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -160,23 +160,27 @@ Point2 TextureProgress::unit_val_to_uv(float val) {
if (edge == 0) {
if (dir.x > 0)
continue;
- cp = -dir.x;
cq = -(edgeLeft - p.x);
+ dir.x *= 2.0 * cq;
+ cp = -dir.x;
} else if (edge == 1) {
if (dir.x < 0)
continue;
- cp = dir.x;
cq = (edgeRight - p.x);
+ dir.x *= 2.0 * cq;
+ cp = dir.x;
} else if (edge == 2) {
if (dir.y > 0)
continue;
- cp = -dir.y;
cq = -(edgeBottom - p.y);
+ dir.y *= 2.0 * cq;
+ cp = -dir.y;
} else if (edge == 3) {
if (dir.y < 0)
continue;
- cp = dir.y;
cq = (edgeTop - p.y);
+ dir.y *= 2.0 * cq;
+ cp = dir.y;
}
cr = cq / cp;
if (cr >= 0 && cr < t1)