mirror of
https://github.com/joncardasis/ChromaColorPicker.git
synced 2024-11-25 22:12:01 +03:00
Updated readme. Scaling handle made to inflate like a balloon.
This commit is contained in:
parent
5de59e1092
commit
d6c49a9d47
21
README.md
21
README.md
@ -30,24 +30,39 @@ colorPicker.connect(brightnessSlider) // or `brightnessSlider.connect(to: colorP
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Installation
|
||||
### Carthage
|
||||
```
|
||||
```bash
|
||||
github "joncardasis/ChromaColorPicker"
|
||||
```
|
||||
|
||||
### Cocoapods
|
||||
```
|
||||
```bash
|
||||
pod 'ChromaColorPicker'
|
||||
```
|
||||
### Manually
|
||||
Add all files from the `Source` folder to your project.
|
||||
|
||||
## Components
|
||||
## Usage
|
||||
### Multiple Handles
|
||||
```Swift
|
||||
// Add handles
|
||||
{TODO}
|
||||
|
||||
// Add a custom handle
|
||||
{TODO}
|
||||
|
||||
// Remove handles
|
||||
{TODO}
|
||||
```
|
||||
|
||||
## Components
|
||||
### ChromaColorPicker
|
||||
An HSB color picker with support for adding multiple color selection handles.
|
||||
|
||||
### ChromaBrightnessSlider
|
||||
[ChromaBrightnessSlider]() is a slider UIControl which can be attached to any `ChromaColorPicker` via the `connect(to:)` method. ChromaBrightnessSlider can also function as a stand-alone UIControl.
|
||||
|
||||
### Supported UIControlEvents
|
||||
| Event | Description |
|
||||
|
@ -221,8 +221,13 @@ public class ChromaColorPicker: UIControl, ChromaControlStylable {
|
||||
|
||||
internal func animateHandleScale(_ handle: ChromaColorHandle, shouldGrow: Bool) {
|
||||
if shouldGrow && handle.transform.d > 1 { return } // Already grown
|
||||
let scalar: CGFloat = 1.25
|
||||
|
||||
let transform = shouldGrow ? CGAffineTransform(scaleX: 1.25, y: 1.25) : CGAffineTransform(scaleX: 1, y: 1)
|
||||
var transform: CGAffineTransform = .identity
|
||||
if shouldGrow {
|
||||
let translateY = -handle.bounds.height * (scalar - 1) / 2
|
||||
transform = CGAffineTransform(scaleX: scalar, y: scalar).translatedBy(x: 0, y: translateY)
|
||||
}
|
||||
|
||||
UIView.animate(withDuration: 0.15, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.6, options: .curveEaseInOut, animations: {
|
||||
handle.transform = transform
|
||||
|
Loading…
Reference in New Issue
Block a user