It appears the behavior for center aligning the skeleton in a multiline label with padding is not properly aligned.
I am updating from 1.9 and noticed a slight regression. I started trying to come up with a fix to submit a PR but am not sure I have the right solution and am out of time to investigate for now.
What type of issue is this?
- enhancement (feature request)
- documentation related
- I've read and understood the Contributing guidelines and have done my best effort to follow them.
- I've read and agree to the Code of Conduct.
- I've searched for any related issues and avoided creating a duplicate issue.
SkeletonView version: 1.26.0 Xcode version: 12.5.1 Swift version: 5.4.2
Steps to reproduce:
- Make a multiline skeletonable label
multilineLastLineFillPercentnot be 100%
- Add left and right padding to
Last line in label should be center aligned, respecting the padding.
Last line in label is offset and not properly centered.
1.9 Behavior: Just showing what I am upgrading from. I like it now being centered (since thats how I have this label configured) but will stay on this version for the moment due to this bug.
1.26.0 Bug: You can see the label is not in the middle of the other lines.
func alignLayerFrame(_ rect: CGRect, alignment: NSTextAlignment, isRTL: Bool) -> CGRect function, I changed center to
newRect.origin.x = ((superlayer?.bounds.width ?? 0) / 2) - (rect.width / 2) for the above screenshot. I don't know if this is 100% the correct fix– in my example my left and right padding is equal so I can just shove it in the middle of the
superlayer's bounds since the size is already taking the last multiline line length into account.
Thanks for maintaining this awesome library! I'd be happy to open a PR to fix, I think I just need some guidance on what you would like and need to make sure I am not missing any other edge cases with different paddings for the left and right.