Skip to content

Commit

Permalink
use enum orientation for widthLarger
Browse files Browse the repository at this point in the history
merge with master and solve conficts
  • Loading branch information
liuxuan30 committed Mar 30, 2020
1 parent 0fd0ef6 commit 219e67e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Charts/Charts/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ open class PieChartView: PieRadarChartViewBase
/// if width is larger than height
private var widthLarger: Bool
{
return _viewPortHandler.contentRect.size.width > _viewPortHandler.contentRect.size.height
return _viewPortHandler.contentRect.orientation == .landscape
}

/// adjusted radius. Use diameter when it's half pie and width is larger
Expand Down
15 changes: 15 additions & 0 deletions Source/Charts/Utils/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ extension UIScreen
}
}

enum Orientation
{
case portrait, landscape
}

extension CGSize
{
var orientation: Orientation { return width > height ? .landscape : .portrait }
}

extension CGRect
{
var orientation: Orientation { size.orientation }
}

func NSUIMainScreen() -> NSUIScreen?
{
return NSUIScreen.main
Expand Down

0 comments on commit 219e67e

Please sign in to comment.