yonat / MultiSlider

UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.
MIT License
494 stars 113 forks source link

Opposing Value Label Positions #97

Closed Hartistic closed 1 year ago

Hartistic commented 1 year ago

Description: For a horizontal layout, value labels can collide and cause overlap when valueLabelPosition is .top or .bottom. I've been using your library for 3+ years, it's been super solid and amazing. Thank you sooo very much! IMG_8542

Problems I encountered when trying to implement this myself: I didn't implement any changes because I am using SPM, but perhaps a boolean indicating the opposite of the valueLabelPosition, like:

/// Every other value label will show opposite of the value label position. If you set valueLabelPosition to .top, the second value label position would be bottom, if you set valueLabelPosition to .leading, the second value label position would be .trailing.

@IBInspectable open dynamic var inverseValueLabelPositioning: Bool = false { didSet { updateAllValueLabels() } }

or perhaps creating a valueLabelPositions array where they can be defined.

slider.valueLabelPositions = [.top, .bottom]

yonat commented 1 year ago

Nice idea!

I’m currently on vacation, but will take a shot at it in a couple of weeks.