Skip to content

Commit

Permalink
Merge pull request #277 from fassko/UIBEZIERPATH_MACOS
Browse files Browse the repository at this point in the history
macOS doesn’t have UIBezierPath
  • Loading branch information
Daniil Manin authored Mar 19, 2018
2 parents 9e268ec + 5e2c412 commit 8ed98b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: objective-c
osx_image: xcode9
osx_image: xcode9.2

branches:
only:
- master

script:
set -o pipefail && xcodebuild test -project Macaw.xcodeproj -scheme 'Macaw iOS' -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.0' | xcpretty;
- set -o pipefail && xcodebuild test -project Macaw.xcodeproj -scheme 'Macaw iOS' -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | xcpretty;
- set -o pipefail && xcodebuild build -project Macaw.xcodeproj -scheme 'MacawOSX' ONLY_ACTIVE_ARCH=NO | xcpretty;
16 changes: 12 additions & 4 deletions Source/render/RenderUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,18 @@ class RenderUtils {
} else {
let maxSize = CGFloat(max(w, h))
let path = MBezierPath(arcCenter: CGPoint.zero, radius: maxSize / 2, startAngle: extent, endAngle: end, clockwise: arcAngle >= 0)
var transform = CGAffineTransform(translationX: cx, y: cy)
transform = transform.rotated(by: CGFloat(rotation))

path.apply(transform.scaledBy(x: CGFloat(w) / maxSize, y: CGFloat(h) / maxSize))

#if os(iOS)
var transform = CGAffineTransform(translationX: cx, y: cy)
transform = transform.rotated(by: CGFloat(rotation))
path.apply(transform.scaledBy(x: CGFloat(w) / maxSize, y: CGFloat(h) / maxSize))
#elseif os(OSX)
var transform = AffineTransform(translationByX: cx, byY: cy)
transform.rotate(byDegrees: CGFloat(rotation))
path.transform(using: transform)
#endif

bezierPath.append(path)
}
}

Expand Down

0 comments on commit 8ed98b1

Please sign in to comment.