From 270e5dee383b49b1ca2d9dcb9232e91496ef0c85 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Tue, 29 Jun 2021 10:34:48 -0500 Subject: [PATCH] =?UTF-8?q?Modern=20Slider=20=F0=9F=92=94Floating=20Window?= =?UTF-8?q?!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Clocker/Panel/ParentPanelController.swift | 31 ++++++++--- Clocker/Panel/UI/FloatingWindow.xib | 67 +---------------------- 2 files changed, 24 insertions(+), 74 deletions(-) diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index 974b87a..4c08da7 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -114,13 +114,22 @@ class ParentPanelController: NSWindowController { if let changedValue = change.newValue { if changedValue == 0 { self.futureSliderView.isHidden = true - self.modernContainerView.isHidden = false + if self.modernContainerView != nil { + self.modernContainerView.isHidden = false + } } else if changedValue == 1 { self.futureSliderView.isHidden = false - self.modernContainerView.isHidden = true + + if self.modernContainerView != nil { + self.modernContainerView.isHidden = true + } + } else { self.futureSliderView.isHidden = true - self.modernContainerView.isHidden = true + + if self.modernContainerView != nil { + self.modernContainerView.isHidden = true + } } } } @@ -179,10 +188,15 @@ class ParentPanelController: NSWindowController { } else if let value = DataStore.shared().retrieve(key: CLDisplayFutureSliderKey) as? NSNumber { if value.intValue == 1 { futureSliderView.isHidden = false - modernContainerView.isHidden = true + if modernContainerView != nil { + modernContainerView.isHidden = true + } } else if value.intValue == 0 { futureSliderView.isHidden = true - modernContainerView.isHidden = false + // Floating Window doesn't support modern slider yet! + if modernContainerView != nil { + modernContainerView.isHidden = false + } } } @@ -573,9 +587,10 @@ class ParentPanelController: NSWindowController { let preferences = store.timezones() if modernSlider != nil, modernSlider.isHidden == false, modernContainerView.currentlyInFocus == false { - setModernSliderLabel() - let indexPaths: Set = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)]) - modernSlider.animator().scrollToItems(at: indexPaths, scrollPosition: .centeredHorizontally) + if currentCenterIndexPath != -1, currentCenterIndexPath != modernSlider.numberOfItems(inSection: 0) / 2 { + // User is currently scrolling, return! + return + } } stride(from: 0, to: preferences.count, by: 1).forEach { diff --git a/Clocker/Panel/UI/FloatingWindow.xib b/Clocker/Panel/UI/FloatingWindow.xib index 5ead502..dc803ae 100644 --- a/Clocker/Panel/UI/FloatingWindow.xib +++ b/Clocker/Panel/UI/FloatingWindow.xib @@ -3,7 +3,6 @@ - @@ -16,9 +15,6 @@ - - - @@ -42,7 +38,7 @@ - + @@ -258,62 +254,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -590,7 +530,6 @@ - @@ -598,7 +537,6 @@ - @@ -626,8 +564,5 @@ - - -