Skip to content

Commit

Permalink
Added gapBetweenThumbs to avoid overlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
William Archimede committed Jan 22, 2015
1 parent 4f2dacf commit c857bd1
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 6 deletions.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified RangeSlider.xcodeproj/project.pbxproj
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified RangeSlider/AppDelegate.swift
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions RangeSlider/Base.lproj/Main.storyboard
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6206.9" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7026.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand Down
Empty file modified RangeSlider/Images.xcassets/AppIcon.appiconset/Contents.json
100644 → 100755
Empty file.
Empty file.
Empty file modified RangeSlider/Info.plist
100644 → 100755
Empty file.
10 changes: 6 additions & 4 deletions RangeSlider/RangeSlider.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class RangeSlider: UIControl {
}
}

var gapBetweenThumbs: Double {
return Double(thumbWidth)*(maximumValue - minimumValue) / Double(bounds.width)
}

var trackTintColor: UIColor = UIColor(white: 0.9, alpha: 1.0) {
didSet {
trackLayer.setNeedsDisplay()
Expand Down Expand Up @@ -232,11 +236,9 @@ class RangeSlider: UIControl {

// Update the values
if lowerThumbLayer.highlighted {
lowerValue += deltaValue
lowerValue = boundValue(lowerValue, toLowerValue: minimumValue, upperValue: upperValue)
lowerValue = boundValue(lowerValue + deltaValue, toLowerValue: minimumValue, upperValue: upperValue - gapBetweenThumbs)
} else if upperThumbLayer.highlighted {
upperValue += deltaValue
upperValue = boundValue(upperValue, toLowerValue: lowerValue, upperValue: maximumValue)
upperValue = boundValue(upperValue + deltaValue, toLowerValue: lowerValue + gapBetweenThumbs, upperValue: maximumValue)
}

sendActionsForControlEvents(.ValueChanged)
Expand Down
Empty file modified RangeSlider/ViewController.swift
100644 → 100755
Empty file.
Empty file modified RangeSliderTests/Info.plist
100644 → 100755
Empty file.
Empty file modified RangeSliderTests/RangeSliderTests.swift
100644 → 100755
Empty file.
Empty file modified Screenshot.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c857bd1

Please sign in to comment.