Skip to content

Commit 9b185ca

Browse files
Fixed issue #69
Multiple commits caused math issues by modifying the positioning equations. Copied the original equations back in, and re-modified them to keep build time low
1 parent 18db06b commit 9b185ca

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

M13Checkbox.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "M13Checkbox"
3-
s.version = "2.2.5"
3+
s.version = "2.2.6"
44
s.summary = "A beautiful, customizable, extendable, animated checkbox for iOS."
55

66
s.description = <<-DESC
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
2626

2727
s.platform = :ios, '8.0'
2828

29-
s.source = { :git => "https://github.com/Marxon13/M13Checkbox.git", :tag => "2.2.5"}
29+
s.source = { :git => "https://github.com/Marxon13/M13Checkbox.git", :tag => "2.2.6"}
3030

3131
s.source_files = 'Sources/**/*'
3232

Sources/M13CheckboxPathPresets.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ internal class M13CheckboxPathPresets {
106106
// On the corner
107107
let cos2Theta: CGFloat = cos(2.0 * theta)
108108
let sin2Theta: CGFloat = sin(2.0 * theta)
109-
let sqrtV: CGFloat = sqrt(((4.0 * cornerRadius) - size) * size)
110-
let powV: CGFloat = pow((2.0 * cornerRadius) + size, 2.0)
109+
let powC: CGFloat = pow((-2.0 * cornerRadius) + size, 2.0)
111110

112111
let a: CGFloat = size * (3.0 + cos2Theta + sin2Theta)
113112
let b: CGFloat = -2.0 * cornerRadius * (cos(theta) + sin(theta))
114-
let c: CGFloat = sqrtV + (powV * sin2Theta)
113+
let c: CGFloat = (((4.0 * cornerRadius) - size) * size) + (powC * sin2Theta)
115114
let d: CGFloat = size * cos(theta) * (cos(theta) - sin(theta))
116115
let e: CGFloat = 2.0 * cornerRadius * sin(theta) * (cos(theta) + sin(theta))
117116

118-
let x: CGFloat = 0.25 * (a + (2.0 * (b + c) * cos(theta))) + (boxLineWidth / 2.0)
119-
let y: CGFloat = 0.5 * (d + e - (c * sin(theta))) + (boxLineWidth / 2.0)
117+
let x: CGFloat = 0.25 * (a + (2.0 * (b + sqrt(c)) * cos(theta))) - boxLineWidth
118+
let y: CGFloat = 0.50 * (d + e - (sqrt(c) * sin(theta))) + boxLineWidth
119+
120120

121121
return CGPoint(x: x, y: y)
122122
}

0 commit comments

Comments
 (0)