@@ -42,45 +42,8 @@ - (void)initializeDurationProperties {
42
42
43
43
- (void )setMaxDuration : (NSInteger )maxDuration {
44
44
_maxDuration = maxDuration;
45
- [self recalculateSliderIntervals ];
46
- }
47
-
48
- - (void )recalculateSliderIntervals {
49
45
[self setMinValue: 1 ]; // never start a block shorter than 1 minute
50
46
[self setMaxValue: self .maxDuration];
51
-
52
- // how many tick marks should we have? it's based on the max block duration
53
- // TODO: can we make this work better with the start at 1-minute (vs 0)? if not, should we just eliminate ticks?
54
- long tickInterval = 1 ;
55
- if (self.maxDuration >= 5256000 ) {
56
- // if max block duration is at least 10 years, tick marks are per-year
57
- tickInterval = 525600 ;
58
- } else if (self.maxDuration >= 525600 ) {
59
- // if max block duration is at least 1 year, tick marks are per-month
60
- tickInterval = 43800 ;
61
- } else if (self.maxDuration >= 131400 ) {
62
- // if max block duration is at least 3 months, tick marks are per-week
63
- tickInterval = 10080 ;
64
- } else if (self.maxDuration >= 10080 ) {
65
- // if max block duration is at least 1 week, tick marks are per-day
66
- tickInterval = 1440 ;
67
- } else if (self.maxDuration >= 5760 ) {
68
- // if max block duration is at least 4 days, tick marks are per 6 hours
69
- tickInterval = 360 ;
70
- } else if (self.maxDuration >= 1440 ) {
71
- // if max block duration is at least 1 day, tick marks are per hour
72
- tickInterval = 60 ;
73
- } else if (self.maxDuration >= 720 ) {
74
- // if max block duration is at least 12 hours, tick marks are per 30 minutes
75
- tickInterval = 30 ;
76
- } else if (self.maxDuration >= 60 ) {
77
- // if max block duration is at least 1 hour, tick marks are per minute
78
- tickInterval = 1 ;
79
- }
80
-
81
- // no more than 72 ticks max
82
- long numTicks = MIN (self.maxDuration / tickInterval, 72 ) + 1 ;
83
- [self setNumberOfTickMarks: numTicks];
84
47
}
85
48
86
49
- (void )registerMinutesValueTransformer {
0 commit comments