Skip to content

Commit

Permalink
Fix restore value (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Feb 22, 2024
1 parent ba98224 commit 6a6d1cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/PrecisionLevelSlider/PrecisionLevelSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ open class PrecisionLevelSlider: UIControl {
open override func layoutSubviews() {
super.layoutSubviews()

let offset = valueToOffset(value: value)
scrollView.setContentOffset(offset, animated: false)

maskGradientLayer.frame = bounds

let contentSize = CGSize(
Expand All @@ -246,6 +243,9 @@ open class PrecisionLevelSlider: UIControl {

let inset = contentSize.width / 2 + (max(0, scrollView.bounds.width - contentSize.width) / 2)
scrollView.contentInset = UIEdgeInsets(top: 0, left: inset, bottom: 0, right: inset)

let offset = valueToOffset(value: value)
scrollView.setContentOffset(offset, animated: false)
}

open override var intrinsicContentSize: CGSize {
Expand Down

0 comments on commit 6a6d1cb

Please sign in to comment.