Browse Source

Move modern slider function to extension!

pull/101/head
Abhishek 3 years ago
parent
commit
213a063df3
  1. 15
      Clocker/Panel/ParentPanelController+ModernSlider.swift
  2. 13
      Clocker/Panel/ParentPanelController.swift

15
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -16,6 +16,21 @@ extension ParentPanelController: NSCollectionViewDataSource {
}
extension ParentPanelController {
func setupModernSliderIfNeccessary() {
if modernSlider != nil {
modernSlider.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
modernSlider.enclosingScrollView?.backgroundColor = NSColor.clear
modernSlider.postsBoundsChangedNotifications = true
NotificationCenter.default.addObserver(self,
selector: #selector(collectionViewDidScroll(_:)),
name: NSView.boundsDidChangeNotification,
object: modernSlider.superview)
closestQuarterTimeRepresentation = setModernLabel()
let indexPaths: Set<IndexPath> = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)])
modernSlider.scrollToItems(at: indexPaths, scrollPosition: .centeredHorizontally)
}
}
@IBAction func goForward(_: NSButton) {
navigateModernSliderToSpecificIndex(1)
}

13
Clocker/Panel/ParentPanelController.swift

@ -199,18 +199,7 @@ class ParentPanelController: NSWindowController {
mainTableView.style = .fullWidth
}
if modernSlider != nil {
modernSlider.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 100, right: 0)
modernSlider.enclosingScrollView?.backgroundColor = NSColor.clear
modernSlider.postsBoundsChangedNotifications = true
NotificationCenter.default.addObserver(self,
selector: #selector(collectionViewDidScroll(_:)),
name: NSView.boundsDidChangeNotification,
object: modernSlider.superview)
closestQuarterTimeRepresentation = setModernLabel()
let indexPaths: Set<IndexPath> = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)])
modernSlider.scrollToItems(at: indexPaths, scrollPosition: .centeredHorizontally)
}
setupModernSliderIfNeccessary()
if roundedDateView != nil {
setupRoundedDateView()

Loading…
Cancel
Save