Unity-Folder-Icons
Unity-Folder-Icons copied to clipboard
Side view offset causes folder texture placement not overlap perfectly
Some folders do not overlap correctly.
In FolderIcons.DrawTextures on line 76 I changed
//Add small offset for correct placement
if (!isSideView)
rect.x += 3f;
}
to
//Add small offset for correct placement
if (!isSideView)
rect.x += 10f;
}
This uncovered the issue:
Removing this offset entirely fixed the problem.
//Add small offset for correct placement
if (!isSideView)
rect.x += 0f;
}
What is the isSideView offset for?
Edit:
isSideView seems to be for - surprise- the side view in unity.
The code checking if folder is in side view or not is this:
/// <summary>
/// Check if the current rect is the side view of folders
/// </summary>
/// <param name="rect">Current rect</param>
public static bool IsSideView(Rect rect)
{
return rect.x == 44;
}
Unfortunately I dont have time to delve deeper into why.
After some tinkering I've come to the following code:
//Add small offset for correct placement
if (!isSideView)
{
rect.x += 0f;
rect.width += 1f;
}
The end result: