Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d58b99

Browse files
authored
Fix black horizontal line on top of pulley on Mac Catalyst (#430)
The height and position of the pulley is rounded to nearest even number on Mac Catalyst. This will fix the horizontal ghost line.
1 parent31dc5d9 commit9d58b99

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

‎PulleyLib/PulleyViewController.swift

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
713713
}elseif currentDisplayMode==.drawer{
714714
height-= drawerTopInset
715715
}
716+
#if targetEnvironment(macCatalyst)
717+
height=roundToEven(height)
718+
#endif
716719

717720
return height
718721
}
@@ -926,14 +929,22 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
926929

927930
if supportedPositions.contains(.open)
928931
{
932+
vartopPos= drawerTopInset+ safeAreaTopInset
933+
#if targetEnvironment(macCatalyst)
934+
topPos=roundToEven(topPos)
935+
#endif
929936
// 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)
931938
}
932939
else
933940
{
934941
// Layout scrollview
935942
letadjustedTopInset: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+
vartopPos=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)
937948
}
938949

939950
drawerScrollView.addSubview(drawerShadowView)
@@ -1009,7 +1020,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
10091020
yOrigin=(panelCornerPlacement==.bottomLeft || panelCornerPlacement==.bottomRight)?(panelInsets.top+ safeAreaTopInset):(panelInsets.top+ safeAreaTopInset+ bounceOverflowMargin)
10101021

10111022
}
1012-
1023+
#if targetEnvironment(macCatalyst)
1024+
yOrigin=roundToEven(yOrigin)
1025+
#endif
10131026
if supportedPositions.contains(.open)
10141027
{
10151028
// Layout scrollview
@@ -1091,7 +1104,11 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
10911104
collapsedHeight= drawerVCCompliant.collapsedDrawerHeight?(bottomSafeArea: pulleySafeAreaInsets.bottom)?? kPulleyDefaultCollapsedHeight
10921105
partialRevealHeight= drawerVCCompliant.partialRevealDrawerHeight?(bottomSafeArea: pulleySafeAreaInsets.bottom)?? kPulleyDefaultPartialRevealHeight
10931106
}
1094-
1107+
#if targetEnvironment(macCatalyst)
1108+
collapsedHeight=roundToEven(collapsedHeight)
1109+
partialRevealHeight=roundToEven(partialRevealHeight)
1110+
#endif
1111+
10951112
if supportedPositions.contains(.collapsed)
10961113
{
10971114
drawerStops.append(collapsedHeight)
@@ -1104,7 +1121,11 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
11041121

11051122
if supportedPositions.contains(.open)
11061123
{
1107-
drawerStops.append((self.view.bounds.size.height- drawerTopInset- pulleySafeAreaInsets.top))
1124+
varvalue=(self.view.bounds.size.height- drawerTopInset- pulleySafeAreaInsets.top)
1125+
#if targetEnvironment(macCatalyst)
1126+
value=roundToEven(value)
1127+
#endif
1128+
drawerStops.append(value)
11081129
}
11091130

11101131
return drawerStops
@@ -1622,6 +1643,13 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
16221643
drawerVCCompliant.drawerChangedDistanceFromBottom?(drawer: drawer, distance: distance, bottomSafeArea: bottomSafeArea)
16231644
}
16241645
}
1646+
1647+
#if targetEnvironment(macCatalyst)
1648+
func roundToEven(_ number:CGFloat)->CGFloat{
1649+
letrounded= number.rounded()
1650+
return rounded.remainder(dividingBy:2)==0? rounded: rounded+1
1651+
}
1652+
#endif
16251653
}
16261654

16271655
extensionPulleyViewController:PulleyPassthroughScrollViewDelegate{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp