Browse Source

Tweaks.

pull/101/head
Abhishek 3 years ago
parent
commit
c8ef3981f5
  1. 25
      Clocker/Panel/ParentPanelController+ModernSlider.swift
  2. 9
      Clocker/Panel/ParentPanelController.swift

25
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -22,8 +22,8 @@ extension ParentPanelController {
let changedOrigin = contentView.documentVisibleRect.origin
let newPoint = NSPoint(x: changedOrigin.x + contentView.frame.width / 2, y: changedOrigin.y)
let indexPath = modernSlider.indexPathForItem(at: newPoint)
if let correctIndexPath = indexPath?.item, let item = modernSlider.item(at: correctIndexPath) as? HourMarkerViewItem {
modernSliderLabel.stringValue = item.timeRepresentation
if let correctIndexPath = indexPath?.item {
modernSliderLabel.stringValue = modernSliderDataSource[correctIndexPath]
// setTimezoneDatasourceSlider(sliderValue: item.indexTag * 15)
// mainTableView.reloadData()
}
@ -47,29 +47,22 @@ extension ParentPanelController {
public func forward15Minutes() -> [String] {
let defaultParameters = minuteFromCalendar()
let hourQuarterDate = Calendar.current.nextDate(after: defaultParameters.0, matching: DateComponents(minute: defaultParameters.1), matchingPolicy: .strict, repeatedTimePolicy: .first, direction: .forward)!
var backwards = hourQuarterDate
var forwards = hourQuarterDate
var hourQuarterDate = Calendar.current.nextDate(after: defaultParameters.0, matching: DateComponents(minute: defaultParameters.1), matchingPolicy: .strict, repeatedTimePolicy: .first, direction: .forward)!
var hourQuarters = [String]()
for _ in 1 ... 96 {
backwards = Calendar.current.date(byAdding: .minute, value: -15, to: backwards)!
hourQuarters.append(timezoneFormattedStringRepresentation(backwards))
}
hourQuarters.append(timezoneFormattedStringRepresentation(forwards))
for _ in 1 ... 96 {
forwards = Calendar.current.date(byAdding: .minute, value: 15, to: forwards)!
hourQuarters.append(timezoneFormattedStringRepresentation(forwards))
hourQuarters.append(timezoneFormattedStringRepresentation(hourQuarterDate))
for _ in 1 ... 288 {
hourQuarterDate = Calendar.current.date(byAdding: .minute, value: 15, to: hourQuarterDate)!
hourQuarters.append(timezoneFormattedStringRepresentation(hourQuarterDate))
}
return hourQuarters
}
public func backward15Minutes() -> [String] {
let defaultParameters = minuteFromCalendar()
var hourQuarterDate = Calendar.current.nextDate(after: defaultParameters.0, matching: DateComponents(minute: defaultParameters.1), matchingPolicy: .strict, repeatedTimePolicy: .first, direction: .forward)!
var hourQuarterDate = Calendar.current.nextDate(after: defaultParameters.0, matching: DateComponents(minute: defaultParameters.1), matchingPolicy: .strict, repeatedTimePolicy: .first, direction: .backward)!
var hourQuarters = [String]()
for _ in 1 ... 96 {
for _ in 1 ... 288 {
hourQuarterDate = Calendar.current.date(byAdding: .minute, value: -15, to: hourQuarterDate)!
hourQuarters.append(timezoneFormattedStringRepresentation(hourQuarterDate))
}

9
Clocker/Panel/ParentPanelController.swift

@ -198,11 +198,10 @@ class ParentPanelController: NSWindowController {
}
if modernSlider != nil {
// var backwards = backward15Minutes()
// backwards.reverse()
// let forwards = forward15Minutes()
modernSliderDataSource = forward15Minutes()
print(modernSliderDataSource)
var backwards = backward15Minutes()
backwards.reverse()
let forwards = forward15Minutes()
modernSliderDataSource = backwards + forwards
modernSlider.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 100, right: 0)
modernSlider.delegate = self

Loading…
Cancel
Save