Browse Source

Scroller is here.

pull/101/head
Abhishek 3 years ago
parent
commit
4cecdbc40d
  1. 4
      Clocker/Clocker/en.lproj/Panel.xib
  2. 4
      Clocker/Panel/ParentPanelController+ModernSlider.swift
  3. 2
      Clocker/Panel/ParentPanelController.swift
  4. 10
      Clocker/Panel/Rate Controller/UpcomingEventView.swift

4
Clocker/Clocker/en.lproj/Panel.xib

@ -42,7 +42,7 @@
<windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES" ignoresCycle="YES"/> <windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES" ignoresCycle="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="1000" y="379" width="350" height="460"/> <rect key="contentRect" x="1000" y="379" width="350" height="460"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/> <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
<view key="contentView" focusRingType="none" misplaced="YES" id="6" customClass="BackgroundPanelView" customModule="Clocker" customModuleProvider="target"> <view key="contentView" focusRingType="none" misplaced="YES" id="6" customClass="BackgroundPanelView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="350" height="460"/> <rect key="frame" x="0.0" y="0.0" width="350" height="460"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -334,7 +334,7 @@
</subviews> </subviews>
<color key="backgroundColor" name="systemIndigoColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="systemIndigoColor" catalog="System" colorSpace="catalog"/>
</clipView> </clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="8II-oP-xbd"> <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="8II-oP-xbd" customClass="ThinScroller" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="-100" y="-100" width="340" height="16"/> <rect key="frame" x="-100" y="-100" width="340" height="16"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</scroller> </scroller>

4
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -25,7 +25,9 @@ extension ParentPanelController {
} }
private func navigateModernSliderToSpecificIndex(_ index: Int) { private func navigateModernSliderToSpecificIndex(_ index: Int) {
let contentView = modernSlider.superview as! NSClipView guard let contentView = modernSlider.superview as? NSClipView else {
return
}
let changedOrigin = contentView.documentVisibleRect.origin let changedOrigin = contentView.documentVisibleRect.origin
let newPoint = NSPoint(x: changedOrigin.x + contentView.frame.width / 2, y: changedOrigin.y) let newPoint = NSPoint(x: changedOrigin.x + contentView.frame.width / 2, y: changedOrigin.y)
if let indexPath = modernSlider.indexPathForItem(at: newPoint) { if let indexPath = modernSlider.indexPathForItem(at: newPoint) {

2
Clocker/Panel/ParentPanelController.swift

@ -200,7 +200,7 @@ class ParentPanelController: NSWindowController {
} }
if modernSlider != nil { if modernSlider != nil {
modernSlider.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 100, right: 0) modernSlider.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
modernSlider.enclosingScrollView?.backgroundColor = NSColor.clear modernSlider.enclosingScrollView?.backgroundColor = NSColor.clear
modernSlider.postsBoundsChangedNotifications = true modernSlider.postsBoundsChangedNotifications = true
NotificationCenter.default.addObserver(self, NotificationCenter.default.addObserver(self,

10
Clocker/Panel/Rate Controller/UpcomingEventView.swift

@ -60,3 +60,13 @@ class ModernSliderContainerView: NSView {
addTrackingArea(trackingArea) addTrackingArea(trackingArea)
} }
} }
class ThinScroller: NSScroller {
override class func scrollerWidth(for _: NSControl.ControlSize, scrollerStyle _: NSScroller.Style) -> CGFloat {
return 15
}
override func drawKnobSlot(in _: NSRect, highlight _: Bool) {
// Leaving this empty to prevent background drawing
}
}

Loading…
Cancel
Save