Skip to content

Commit

Permalink
Fixed issue where circular box would be misaligned.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marxon13 committed Sep 28, 2016
1 parent 9e07dc1 commit 9a63be8
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 42 deletions.
4 changes: 2 additions & 2 deletions Sources/M13CheckboxPathPresets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal class M13CheckboxPathPresets {

let x = (0.5 * (a1 + a2 + (0.5 * sqrt(subX1))) + (boxLineWidth / 2.0)) / f
let y = (g1 + g2 - (0.25 * sqrt(subY1)) + (boxLineWidth / 2.0)) / f

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

Expand Down Expand Up @@ -179,7 +179,7 @@ internal class M13CheckboxPathPresets {
func pathForCircle() -> UIBezierPath {
let radius = (size - boxLineWidth) / 2.0
// Create a circle that starts in the top right hand corner.
return UIBezierPath(arcCenter: CGPoint(x: radius, y: radius),
return UIBezierPath(arcCenter: CGPoint(x: size / 2.0, y: size / 2.0),
radius: radius,
startAngle: -checkmarkProperties.longArmBoxIntersectionAngle,
endAngle: CGFloat(2 * M_PI) - checkmarkProperties.longArmBoxIntersectionAngle,
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxBounceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@ internal class M13CheckboxBounceManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxDotManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,9 @@ internal class M13CheckboxDotManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = (paths as! M13CheckboxDotPathPresets).pathForDot().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxExpandManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@ internal class M13CheckboxExpandManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxFadeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@ internal class M13CheckboxFadeManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxFillManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,9 @@ internal class M13CheckboxFillManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxFlatManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,9 @@ internal class M13CheckboxFlatManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxSpiralManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,9 @@ internal class M13CheckboxSpiralManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down
8 changes: 3 additions & 5 deletions Sources/Managers/M13CheckboxStrokeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ internal class M13CheckboxStrokeManager: M13CheckboxManager {

override func layoutLayers() {
// Frames
let x: CGFloat = paths.boxLineWidth / 2.0
let y: CGFloat = paths.boxLineWidth / 2.0
unselectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: x, y: y, width: paths.size, height: paths.size)
unselectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
selectedBoxLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
markLayer.frame = CGRect(x: 0.0, y: 0.0, width: paths.size, height: paths.size)
// Paths
unselectedBoxLayer.path = paths.pathForBox().cgPath
selectedBoxLayer.path = paths.pathForBox().cgPath
Expand Down

0 comments on commit 9a63be8

Please sign in to comment.