Skip to content

Commit

Permalink
Merge pull request #7 from markd2/md-map-all-the-things
Browse files Browse the repository at this point in the history
Removed cgFloatValue extension
  • Loading branch information
Mark Dalrymple committed May 5, 2015
2 parents 7f05a3d + ba34094 commit 42c4ee5
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions GrafDemo/BNRLinesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

import Cocoa

extension NSSlider {
func cgfloatValue() -> CGFloat {
return CGFloat(self.doubleValue)
}
}

public class BNRLinesWindowController: NSWindowController {
@IBOutlet weak var linesView: BNRLinesView!
@IBOutlet weak var swiftLinesView: LinesView!
Expand Down Expand Up @@ -54,8 +48,8 @@ public class BNRLinesWindowController: NSWindowController {

// Called by the line view prior to constructing and stroking the example path
public func setupContext (context: CGContext!) {
CGContextSetLineWidth (context, lineWidthSlider.cgfloatValue())
CGContextSetMiterLimit (context, miterLimitSlider.cgfloatValue())
CGContextSetLineWidth (context, CGFloat(lineWidthSlider.floatValue))
CGContextSetMiterLimit (context, CGFloat(miterLimitSlider.floatValue))
CGContextSetLineCap (context, CGLineCap(UInt32(endCapPopUp.indexOfSelectedItem)))
CGContextSetLineJoin (context, CGLineJoin(UInt32(lineJoinPopUp.indexOfSelectedItem)))

Expand All @@ -66,12 +60,12 @@ public class BNRLinesWindowController: NSWindowController {
}

if linePhaseBox.enabled {
let phase = linePhaseSlider.cgfloatValue()
let lengths: [CGFloat] = [
dash0Slider.cgfloatValue(), space0Slider.cgfloatValue(),
dash1Slider.cgfloatValue(), space1Slider.cgfloatValue(),
dash2Slider.cgfloatValue(), space2Slider.cgfloatValue()
]
let phase = CGFloat(linePhaseSlider.floatValue)
let lengths = [
dash0Slider.floatValue, space0Slider.floatValue,
dash1Slider.floatValue, space1Slider.floatValue,
dash2Slider.floatValue, space2Slider.floatValue
].map { CGFloat($0) }

CGContextSetLineDash (context, phase, lengths, lengths.count)
}
Expand Down

0 comments on commit 42c4ee5

Please sign in to comment.