Safe Zone preview bars disappear in editor when clicking on the "Flip Safe Zone" button

Summary

Safe Zone preview bars disappear in editor when clicking on the “Flip Safe Zone” button. This is because slate silently fail to render rectangles with a negative size
The fix is to flip the rectangle taking into account the width and the orientation or slate won’t render rectangles with a negative width

What Type of Bug are you experiencing?

Editor

Steps to Reproduce

Open any UMG Widget Blueprint or create a new one. Then from the Screen Size drop down select any mobile device that has safezones defined in their profile.
Press the Flip The Current Safe Zones button on the left of the drop down

Expected Result

The red bars representing the safezones defined for the phone should flip

Observed Result

The red bars disappear. They reappear if you flip them again.

Affects Versions

5.8
5.7
5.6
5.5
5.4

Platform(s)

Windows

Upload an image

Additional Notes

This is the fixed code for “SettingsClasses.cpp”

FMargin ULevelEditorPlaySettings::FlipCustomUnsafeZones(TArray<FVector2D>& CustomSafeZoneStarts, TArray<FVector2D>& CustomSafeZoneDimensions, FString& DeviceType, FVector2D PreviewSize)
{
	FMargin CustomSafeZoneOverride = CalculateCustomUnsafeZones(CustomSafeZoneStarts, CustomSafeZoneDimensions, DeviceType, PreviewSize);
// FIX BEGIN - Mirror each zone rect as a whole 
// to prevent producing negative-width rectangles that Slate silently refuses to draw
	for (int32 ZoneIndex = 0; ZoneIndex < CustomSafeZoneStarts.Num(); ++ZoneIndex)
	{
		CustomSafeZoneStarts[ZoneIndex].X = PreviewSize.X - CustomSafeZoneStarts[ZoneIndex].X - CustomSafeZoneDimensions[ZoneIndex].X;
	}
// FIX END - Mirror each zone rect as a whole 
// to prevent producing negative-width rectangles that Slate silently refuses to draw

	float Placeholder = CustomSafeZoneOverride.Left;
	CustomSafeZoneOverride.Left = CustomSafeZoneOverride.Right;
	CustomSafeZoneOverride.Right = Placeholder;
	return CustomSafeZoneOverride;
}