Skip to content

Commit

Permalink
Fixed issue with folder icons being drawn over with background when c…
Browse files Browse the repository at this point in the history
…orresponding icon sprite is empty.
  • Loading branch information
h-sigma committed Feb 10, 2021
1 parent fbd9a13 commit 7fcde94
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions PvCustomizer/Editor/Scripts/PvCustomizerMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,19 @@ private void DrawFolderIcon(string path, Rect selectionRect, PvRuleItem rule, bo
IconSizeType sizeType = PvCustomizerUtility.GetSizeType(selectionRect);
Rect iconRect = PvCustomizerUtility.ItemRectToIconRect(selectionRect, sizeType == IconSizeType.TreeView);
Color tint = selected ? (Color) PvCustomizerGUI.ICON_SELECTED_TINT : Color.white;

if (rule.eraseDefaultFolder)
{
PvCustomizerGUI.DrawBackground(iconRect);
}


#region Icon Drawing

if (sizeType == IconSizeType.Small || sizeType == IconSizeType.TreeView && rule.smallIcon.sprite != null)
{
TryDrawIconBackground();
iconRect = PvCustomizerUtility.ItemRectToIconRect(selectionRect, true);
PvCustomizerGUI.DrawSprite(iconRect, rule.smallIcon.sprite, tint: tint,
scaleMode: PvScaleMode.ScaleToFit);
}
else if (sizeType == IconSizeType.Large && rule.largeIcon.sprite != null)
{
TryDrawIconBackground();
PvCustomizerGUI.DrawSprite(iconRect, rule.largeIcon.sprite, tint: tint,
scaleMode: PvScaleMode.ScaleToFit);
}
Expand Down Expand Up @@ -186,6 +183,14 @@ private void DrawFolderIcon(string path, Rect selectionRect, PvRuleItem rule, bo
}

#endregion

void TryDrawIconBackground()
{
if (rule.eraseDefaultFolder)
{
PvCustomizerGUI.DrawBackground(iconRect);
}
}
}

#endregion
Expand Down

0 comments on commit 7fcde94

Please sign in to comment.