Browse Source

Fix unresponsive slider when forward button tapped on the first occasion. See details for desc.

More details in the original feedback:

"The +15 doesn’t change the time when you click it the first time. For example, the minute was 21. I clicked +15, the scrollbar moved, but the time did not change to the 30th minute. I clicked it again, and it jumped to the 45th minute. Going backwards (-15) works on first click. It’s just the initial +15 click that doesn’t change the time."
master
Abhishek Banthia 1 year ago
parent
commit
ef38f2b3da
  1. 2
      Clocker/Panel/ParentPanelController+ModernSlider.swift

2
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -134,7 +134,7 @@ extension ParentPanelController {
let futureSliderDayRange = (futureSliderDayPreference.intValue + 1) let futureSliderDayRange = (futureSliderDayPreference.intValue + 1)
let totalCount = (PanelConstants.modernSliderPointsInADay * futureSliderDayRange * 2) + 1 let totalCount = (PanelConstants.modernSliderPointsInADay * futureSliderDayRange * 2) + 1
let centerPoint = Int(ceil(Double(totalCount / 2))) let centerPoint = Int(ceil(Double(totalCount / 2)))
if index > (centerPoint + 1) { if index >= (centerPoint + 1) {
let remainder = (index % (centerPoint + 1)) let remainder = (index % (centerPoint + 1))
let nextDate = Calendar.current.date(byAdding: .minute, value: remainder * 15, to: closestQuarterTimeRepresentation ?? Date())! let nextDate = Calendar.current.date(byAdding: .minute, value: remainder * 15, to: closestQuarterTimeRepresentation ?? Date())!
modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(nextDate) modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(nextDate)

Loading…
Cancel
Save