mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-26 01:21:58 -04:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user