瀏覽代碼

UI: Fix spacing helpers when rotated and flipped

If the scene item was rotated greater than 45 degrees, and flipped
vertically or horizontally, the spacing helpers would be drawn
incorrectly. This fixes the issue by checking the scale before
the rotation, instead of after.
cg2121 2 年之前
父節點
當前提交
a3defd4f58
共有 1 個文件被更改,包括 17 次插入17 次删除
  1. 17 17
      UI/window-basic-preview.cpp

+ 17 - 17
UI/window-basic-preview.cpp

@@ -2506,6 +2506,23 @@ void OBSBasicPreview::DrawSpacingHelpers()
 				    groupOti.pos.x, groupOti.pos.y, 0.0f);
 	}
 
+	// Switch top/bottom or right/left if scale is negative
+	if (oti.scale.x < 0.0f) {
+		vec3 l = left;
+		vec3 r = right;
+
+		vec3_copy(&left, &r);
+		vec3_copy(&right, &l);
+	}
+
+	if (oti.scale.y < 0.0f) {
+		vec3 t = top;
+		vec3 b = bottom;
+
+		vec3_copy(&top, &b);
+		vec3_copy(&bottom, &t);
+	}
+
 	if (rot >= HELPER_ROT_BREAKPONT) {
 		for (float i = HELPER_ROT_BREAKPONT; i <= 360.0f; i += 90.0f) {
 			if (rot < i)
@@ -2539,23 +2556,6 @@ void OBSBasicPreview::DrawSpacingHelpers()
 		}
 	}
 
-	// Switch top/bottom or right/left if scale is negative
-	if (oti.scale.x < 0.0f) {
-		vec3 l = left;
-		vec3 r = right;
-
-		vec3_copy(&left, &r);
-		vec3_copy(&right, &l);
-	}
-
-	if (oti.scale.y < 0.0f) {
-		vec3 t = top;
-		vec3 b = bottom;
-
-		vec3_copy(&top, &b);
-		vec3_copy(&bottom, &t);
-	}
-
 	// Get sides of box transform
 	left = GetTransformedPos(left.x, left.y, boxTransform);
 	right = GetTransformedPos(right.x, right.y, boxTransform);