Skip to content

Commit

Permalink
use enum orientation for widthLarger
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxuan30 committed Mar 30, 2020
1 parent 571a45d commit c9cb9e2
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 @@ -166,6 +166,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 NSUIGraphicsGetCurrentContext() -> CGContext?
{
return UIGraphicsGetCurrentContext()
Expand Down

0 comments on commit c9cb9e2

Please sign in to comment.