Unity-Folder-Icons icon indicating copy to clipboard operation
Unity-Folder-Icons copied to clipboard

Side view offset causes folder texture placement not overlap perfectly

Open palasale opened this issue 2 years ago • 1 comments

Some folders do not overlap correctly.

image

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: image

Removing this offset entirely fixed the problem.

//Add small offset for correct placement
                if (!isSideView)
                    rect.x += 0f;
                }

image

What is the isSideView offset for?

Edit:

isSideView seems to be for - surprise- the side view in unity.

image

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.

palasale avatar Sep 27 '23 08:09 palasale

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: image

palasale avatar Sep 27 '23 08:09 palasale