浏览代码

Merge pull request #25953 from nekomatata/fix-radial-texture-progress

Fixed TextureProgress in Radial Mode when using center offset
Rémi Verschelde 6 年之前
父节点
当前提交
a034cac583
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      scene/gui/texture_progress.cpp

+ 8 - 4
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)