-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong element sizing when using separator in TMConstrainedHorizontalBarLayout #569
Open
3 tasks done
Comments
Hi! How you change bg color for active button? |
@Alphacentaura by overriding the Button class used in the pager with something like this: class TabPagerButton: Tabman.TMBarButton {
override func update(for selectionState: TMBarButton.SelectionState) {
switch selectionState {
case .selected:
backgroundColor = .red
default:
backgroundColor = .clear
}
super.update(for: selectionState)
}
} |
Thanks! Tried to do this in tab button discription, but it is a bit dirty ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New Issue Checklist
Issue Description
With #564 I've corrected a bug in separators (#563) in bars where separators itself were constrained to a width equal to every button item.
To correct this, I've applied a constant negative value to the proportional width constraint of every button to take into account the separator width:
example: 5 elements in a bar would have a 20% parent width constraint minus the separator width.
This calculation is not 100% right, since we always have
n - 1
separators in a bar, wheren
is the total amount of buttons. Therefore, the offset applied to the constant should be(separatorWidth * (n - 1)) / n
It's something really not noticeable when using normal buttons: usually, separators are narrow and the practical result is having the last item wider than the others (by a pixel or two).
In my case, however, I'm applying a background color to the currently selected item: if this item is the last one, with a 1px separator, I'm seeing a small gap between the last button (with tinted background) and the bar. I'm using purple over white, so this is really noticeable and annoying.
I'll try to take care of this personally.
Cheers :)
The text was updated successfully, but these errors were encountered: