Skip to content

Commit

Permalink
[Slider#204] Added func resetValue for minValue / maxValue updates
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBorleeAdevinta committed Jan 10, 2024
1 parent 5106c4a commit 21c1f51
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/Sources/Components/Slider/View/SliderUIControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public final class SliderUIControl: UIControl {
get { return self.viewModel.minimumValue }
set {
self.viewModel.minimumValue = min(self.maximumValue, newValue)
self.setValue(self.value)
self.resetValue()
}
}

Expand All @@ -54,7 +54,7 @@ public final class SliderUIControl: UIControl {
get { return self.viewModel.maximumValue }
set {
self.viewModel.maximumValue = max(self.minimumValue, newValue)
self.setValue(self.value)
self.resetValue()
}
}

Expand Down Expand Up @@ -181,6 +181,10 @@ public final class SliderUIControl: UIControl {
}
}

private func resetValue() {
self.viewModel.setAbsoluteValue(self.value)
}

private func setupBar() {
self.indicatorView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMinXMaxYCorner] // Left
self.addSubview(self.indicatorView)
Expand Down

0 comments on commit 21c1f51

Please sign in to comment.