Browse Source

Change FlowchartWindow Style caching

Now forces expended values into the cached style repeatedly. In newer Unity UI we were seeing missing alignment and colour during caching
master
Steve Halliwell 4 years ago
parent
commit
f9df103b98
  1. 35
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

35
Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

@ -286,38 +286,39 @@ namespace Fungus.EditorUtils
if (nodeStyle == null)
{
nodeStyle = new GUIStyle();
// All block nodes use the same GUIStyle, but with a different background
nodeStyle.border = new RectOffset(HorizontalPad, HorizontalPad, VerticalPad, VerticalPad);
nodeStyle.padding = nodeStyle.border;
nodeStyle.contentOffset = Vector2.zero;
nodeStyle.alignment = TextAnchor.MiddleCenter;
nodeStyle.wordWrap = true;
}
// All block nodes use the same GUIStyle, but with a different background
nodeStyle.border = new RectOffset(HorizontalPad, HorizontalPad, VerticalPad, VerticalPad);
nodeStyle.padding = nodeStyle.border;
nodeStyle.contentOffset = Vector2.zero;
nodeStyle.alignment = TextAnchor.MiddleCenter;
nodeStyle.wordWrap = true;
if (EditorStyles.helpBox != null && descriptionStyle == null)
{
descriptionStyle = new GUIStyle(EditorStyles.helpBox);
descriptionStyle.wordWrap = true;
}
descriptionStyle.wordWrap = true;
if (EditorStyles.whiteLabel != null && handlerStyle == null)
{
handlerStyle = new GUIStyle(EditorStyles.label);
handlerStyle.wordWrap = true;
handlerStyle.margin.top = 0;
handlerStyle.margin.bottom = 0;
handlerStyle.alignment = TextAnchor.MiddleCenter;
}
handlerStyle.wordWrap = true;
handlerStyle.margin.top = 0;
handlerStyle.margin.bottom = 0;
handlerStyle.alignment = TextAnchor.MiddleCenter;
if(blockSearchPopupNormalStyle == null || blockSearchPopupSelectedStyle == null)
if (blockSearchPopupNormalStyle == null || blockSearchPopupSelectedStyle == null)
{
blockSearchPopupNormalStyle = new GUIStyle(GUI.skin.FindStyle("MenuItem"));
blockSearchPopupNormalStyle.padding = new RectOffset(8, 0, 0, 0);
blockSearchPopupNormalStyle.imagePosition = ImagePosition.ImageLeft;
blockSearchPopupSelectedStyle = new GUIStyle(blockSearchPopupNormalStyle);
blockSearchPopupSelectedStyle.normal = blockSearchPopupSelectedStyle.hover;
blockSearchPopupNormalStyle.hover = blockSearchPopupNormalStyle.normal;
}
blockSearchPopupNormalStyle.padding = new RectOffset(8, 0, 0, 0);
blockSearchPopupNormalStyle.imagePosition = ImagePosition.ImageLeft;
blockSearchPopupSelectedStyle = new GUIStyle(blockSearchPopupNormalStyle);
blockSearchPopupSelectedStyle.normal = blockSearchPopupSelectedStyle.hover;
blockSearchPopupNormalStyle.hover = blockSearchPopupNormalStyle.normal;
}
protected virtual void OnDisable()

Loading…
Cancel
Save