Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d47f2f17b |
@@ -7,7 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
48A9BFBF20BED26800AC149A /* RAScrollablePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A9BFBE20BED26800AC149A /* RAScrollablePickerView.swift */; };
|
||||
48D1A6E921160D36007221D1 /* RAScrollablePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48D1A6E821160D36007221D1 /* RAScrollablePickerView.swift */; };
|
||||
6908F4291B500AE500A410E2 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6908F4281B500AE500A410E2 /* WindowController.swift */; };
|
||||
6908F42B1B500AE500A410E2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6908F42A1B500AE500A410E2 /* ViewController.swift */; };
|
||||
6908F42E1B500AE500A410E2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6908F42C1B500AE500A410E2 /* Main.storyboard */; };
|
||||
@@ -16,7 +16,7 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
48A9BFBE20BED26800AC149A /* RAScrollablePickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RAScrollablePickerView.swift; sourceTree = SOURCE_ROOT; };
|
||||
48D1A6E821160D36007221D1 /* RAScrollablePickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RAScrollablePickerView.swift; path = Framework/RAScrollablePickerView/RAScrollablePickerView/RAScrollablePickerView.swift; sourceTree = SOURCE_ROOT; };
|
||||
6908F4231B500AE500A410E2 /* ColorPickerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ColorPickerExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6908F4271B500AE500A410E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
6908F4281B500AE500A410E2 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = "<group>"; };
|
||||
@@ -57,7 +57,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6908F42A1B500AE500A410E2 /* ViewController.swift */,
|
||||
48A9BFBE20BED26800AC149A /* RAScrollablePickerView.swift */,
|
||||
48D1A6E821160D36007221D1 /* RAScrollablePickerView.swift */,
|
||||
6908F4261B500AE500A410E2 /* Supporting Files */,
|
||||
);
|
||||
path = ColorPickerExample;
|
||||
@@ -148,7 +148,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6908F42B1B500AE500A410E2 /* ViewController.swift in Sources */,
|
||||
48A9BFBF20BED26800AC149A /* RAScrollablePickerView.swift in Sources */,
|
||||
48D1A6E921160D36007221D1 /* RAScrollablePickerView.swift in Sources */,
|
||||
6908F4291B500AE500A410E2 /* WindowController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
BIN
Binary file not shown.
Framework/RAScrollablePickerView/Carthage/Build/iOS/E1A36868-6788-302C-99CF-7AD3859296EF.bcsymbolmap
Generated
Vendored
+276
File diff suppressed because one or more lines are too long
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
BIN
Binary file not shown.
+16
-12
@@ -57,31 +57,35 @@ public class RAScrollablePickerView: UIView {
|
||||
return UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:)))
|
||||
}()
|
||||
|
||||
private(set) var value: CGFloat = 0.5 {
|
||||
public var value: CGFloat {
|
||||
return pickerValue
|
||||
}
|
||||
|
||||
private var pickerValue: CGFloat = 0.5 {
|
||||
didSet {
|
||||
if type != .hue {
|
||||
if self.value > 1 {
|
||||
self.value = 1
|
||||
if self.pickerValue > 1 {
|
||||
self.pickerValue = 1
|
||||
}
|
||||
else if self.value < 0 {
|
||||
self.value = 0
|
||||
else if self.pickerValue < 0 {
|
||||
self.pickerValue = 0
|
||||
}
|
||||
else {
|
||||
setNeedsDisplay()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if self.value > 1 {
|
||||
self.value -= 1
|
||||
if self.pickerValue > 1 {
|
||||
self.pickerValue -= 1
|
||||
}
|
||||
else if self.value < 0 {
|
||||
self.value += 1
|
||||
else if self.pickerValue < 0 {
|
||||
self.pickerValue += 1
|
||||
}
|
||||
else {
|
||||
setNeedsDisplay()
|
||||
}
|
||||
}
|
||||
delegate?.valueChanged(self.value, type: type)
|
||||
delegate?.valueChanged(pickerValue, type: type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +147,7 @@ public class RAScrollablePickerView: UIView {
|
||||
}
|
||||
else if gesture.state == .changed {
|
||||
if let location = lastTouchLocation {
|
||||
value += (gesture.location(in: self).x - location.x) / frame.width
|
||||
pickerValue += (gesture.location(in: self).x - location.x) / frame.width
|
||||
}
|
||||
lastTouchLocation = gesture.location(in: self)
|
||||
}
|
||||
@@ -162,7 +166,7 @@ public class RAScrollablePickerView: UIView {
|
||||
return
|
||||
}
|
||||
|
||||
value += (decelerationSpeed * 0.025) / 100
|
||||
pickerValue += (decelerationSpeed * 0.025) / 100
|
||||
}
|
||||
|
||||
private func commonInit() {
|
||||
|
||||
Reference in New Issue
Block a user