@@ -713,6 +713,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
713
713
} else if currentDisplayMode== . drawer{
714
714
height-= drawerTopInset
715
715
}
716
+ #if targetEnvironment(macCatalyst)
717
+ height= roundToEven ( height)
718
+ #endif
716
719
717
720
return height
718
721
}
@@ -926,14 +929,22 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
926
929
927
930
if supportedPositions. contains ( . open)
928
931
{
932
+ var topPos = drawerTopInset+ safeAreaTopInset
933
+ #if targetEnvironment(macCatalyst)
934
+ topPos= roundToEven ( topPos)
935
+ #endif
929
936
// Layout scrollview
930
- drawerScrollView. frame= CGRect ( x: adjustedLeftSafeArea, y: drawerTopInset + safeAreaTopInset , width: self . view. bounds. width- adjustedLeftSafeArea- adjustedRightSafeArea, height: heightOfOpenDrawer)
937
+ drawerScrollView. frame= CGRect ( x: adjustedLeftSafeArea, y: topPos , width: self . view. bounds. width- adjustedLeftSafeArea- adjustedRightSafeArea, height: heightOfOpenDrawer)
931
938
}
932
939
else
933
940
{
934
941
// Layout scrollview
935
942
let adjustedTopInset : CGFloat = getStopList ( ) . max ( ) ?? 0.0
936
- drawerScrollView. frame= CGRect ( x: adjustedLeftSafeArea, y: self . view. bounds. height- adjustedTopInset, width: self . view. bounds. width- adjustedLeftSafeArea- adjustedRightSafeArea, height: adjustedTopInset)
943
+ var topPos = self . view. bounds. height- adjustedTopInset
944
+ #if targetEnvironment(macCatalyst)
945
+ topPos= roundToEven ( topPos)
946
+ #endif
947
+ drawerScrollView. frame= CGRect ( x: adjustedLeftSafeArea, y: topPos, width: self . view. bounds. width- adjustedLeftSafeArea- adjustedRightSafeArea, height: adjustedTopInset)
937
948
}
938
949
939
950
drawerScrollView. addSubview ( drawerShadowView)
@@ -1009,7 +1020,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
1009
1020
yOrigin= ( panelCornerPlacement== . bottomLeft || panelCornerPlacement== . bottomRight) ? ( panelInsets. top+ safeAreaTopInset) : ( panelInsets. top+ safeAreaTopInset+ bounceOverflowMargin)
1010
1021
1011
1022
}
1012
-
1023
+ #if targetEnvironment(macCatalyst)
1024
+ yOrigin= roundToEven ( yOrigin)
1025
+ #endif
1013
1026
if supportedPositions. contains ( . open)
1014
1027
{
1015
1028
// Layout scrollview
@@ -1091,7 +1104,11 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
1091
1104
collapsedHeight= drawerVCCompliant. collapsedDrawerHeight ? ( bottomSafeArea: pulleySafeAreaInsets. bottom) ?? kPulleyDefaultCollapsedHeight
1092
1105
partialRevealHeight= drawerVCCompliant. partialRevealDrawerHeight ? ( bottomSafeArea: pulleySafeAreaInsets. bottom) ?? kPulleyDefaultPartialRevealHeight
1093
1106
}
1094
-
1107
+ #if targetEnvironment(macCatalyst)
1108
+ collapsedHeight= roundToEven ( collapsedHeight)
1109
+ partialRevealHeight= roundToEven ( partialRevealHeight)
1110
+ #endif
1111
+
1095
1112
if supportedPositions. contains ( . collapsed)
1096
1113
{
1097
1114
drawerStops. append ( collapsedHeight)
@@ -1104,7 +1121,11 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
1104
1121
1105
1122
if supportedPositions. contains ( . open)
1106
1123
{
1107
- drawerStops. append ( ( self . view. bounds. size. height- drawerTopInset- pulleySafeAreaInsets. top) )
1124
+ var value = ( self . view. bounds. size. height- drawerTopInset- pulleySafeAreaInsets. top)
1125
+ #if targetEnvironment(macCatalyst)
1126
+ value= roundToEven ( value)
1127
+ #endif
1128
+ drawerStops. append ( value)
1108
1129
}
1109
1130
1110
1131
return drawerStops
@@ -1622,6 +1643,13 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
1622
1643
drawerVCCompliant. drawerChangedDistanceFromBottom ? ( drawer: drawer, distance: distance, bottomSafeArea: bottomSafeArea)
1623
1644
}
1624
1645
}
1646
+
1647
+ #if targetEnvironment(macCatalyst)
1648
+ func roundToEven( _ number: CGFloat ) -> CGFloat {
1649
+ let rounded = number. rounded ( )
1650
+ return rounded. remainder ( dividingBy: 2 ) == 0 ? rounded: rounded+ 1
1651
+ }
1652
+ #endif
1625
1653
}
1626
1654
1627
1655
extension PulleyViewController : PulleyPassthroughScrollViewDelegate {