Closed inickt closed 2 years ago
Hi @inickt 👋🏼
Sorry for the late response. I'm going to check it! Thanks 👍🏼
Thanks! If you need any help let me know, I'd be happy to dig in a bit more and open a PR but didn't have the bandwidth before.
Yes, if you want, feel free to dig in more, I'd really appreciate it 🙂
Description
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?
Requirements
Bug Report
SkeletonView Environment:
SkeletonView version: 1.26.0 Xcode version: 12.5.1 Swift version: 5.4.2
Steps to reproduce:
multilineLastLineFillPercent
not be 100%skeletonPaddingInsets
Expected result:
Last line in label should be center aligned, respecting the padding.
Actual result:
Last line in label is offset and not properly centered.
Attachments:
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.
1.26.0 "Fix":
In the
func alignLayerFrame(_ rect: CGRect, alignment: NSTextAlignment, isRTL: Bool) -> CGRect
function, I changed center tonewRect.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 thesuperlayer
'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.