Преглед изворни кода

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);