mirror of
https://github.com/ilyakooo0/huekit.git
synced 2024-11-28 21:22:09 +03:00
Make components open
This commit is contained in:
parent
bc3546c55b
commit
99d4f653f6
@ -10,7 +10,7 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
public class ColorBarPicker: UIControl {
|
||||
open class ColorBarPicker: UIControl {
|
||||
|
||||
private var isVertical: Bool = false {
|
||||
didSet {
|
||||
@ -33,7 +33,7 @@ public class ColorBarPicker: UIControl {
|
||||
private static let indicatorSizeActive = CGSize(width: 40.0, height: 40.0)
|
||||
|
||||
@IBInspectable
|
||||
public var hue: CGFloat {
|
||||
open var hue: CGFloat {
|
||||
get {
|
||||
if isVertical {
|
||||
return 1.0 - value
|
||||
@ -112,7 +112,7 @@ public class ColorBarPicker: UIControl {
|
||||
|
||||
// MARK: - Drawing
|
||||
|
||||
override public func layoutSubviews() {
|
||||
override open func layoutSubviews() {
|
||||
|
||||
if colorBarView.superview == nil {
|
||||
|
||||
@ -182,26 +182,26 @@ public class ColorBarPicker: UIControl {
|
||||
self.value = percent.pinned(between: 0, and: 1)
|
||||
}
|
||||
|
||||
override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
self.trackIndicator(with: touch)
|
||||
|
||||
growIndicator()
|
||||
return true
|
||||
}
|
||||
|
||||
override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
self.trackIndicator(with: touch)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
super.endTracking(touch, with: event)
|
||||
|
||||
shrinkIndicator()
|
||||
}
|
||||
|
||||
override public func cancelTracking(with event: UIEvent?) {
|
||||
override open func cancelTracking(with event: UIEvent?) {
|
||||
super.cancelTracking(with: event)
|
||||
|
||||
shrinkIndicator()
|
||||
@ -250,7 +250,7 @@ public class ColorBarPicker: UIControl {
|
||||
|
||||
private let accessibilityInterval: CGFloat = 0.05
|
||||
|
||||
public override var accessibilityTraits: UIAccessibilityTraits {
|
||||
open override var accessibilityTraits: UIAccessibilityTraits {
|
||||
get {
|
||||
var t = super.accessibilityTraits
|
||||
|
||||
@ -263,7 +263,7 @@ public class ColorBarPicker: UIControl {
|
||||
}
|
||||
}
|
||||
|
||||
public override func accessibilityIncrement() {
|
||||
open override func accessibilityIncrement() {
|
||||
|
||||
var newValue = self.value + accessibilityInterval
|
||||
|
||||
@ -274,7 +274,7 @@ public class ColorBarPicker: UIControl {
|
||||
self.value = newValue
|
||||
}
|
||||
|
||||
public override func accessibilityDecrement() {
|
||||
open override func accessibilityDecrement() {
|
||||
|
||||
var newValue = self.value - accessibilityInterval
|
||||
|
||||
@ -285,7 +285,7 @@ public class ColorBarPicker: UIControl {
|
||||
self.value = newValue
|
||||
}
|
||||
|
||||
public override var accessibilityValue: String? {
|
||||
open override var accessibilityValue: String? {
|
||||
get {
|
||||
return String(format: "%d degrees hue", (self.value * 360.0))
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class ColorBarView: UIView {
|
||||
open class ColorBarView: UIView {
|
||||
|
||||
private static func createContentImage() -> CGImage? {
|
||||
|
||||
@ -19,7 +19,7 @@ class ColorBarView: UIView {
|
||||
return HSBGen.createHSVBarContentImage(hsbComponent: .hue, hsv: hsv)
|
||||
}
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
override open func draw(_ rect: CGRect) {
|
||||
|
||||
guard let context = UIGraphicsGetCurrentContext() else {
|
||||
return
|
||||
|
@ -10,10 +10,10 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
public class ColorIndicatorView: UIView {
|
||||
open class ColorIndicatorView: UIView {
|
||||
|
||||
@IBInspectable
|
||||
public var color: UIColor = .black {
|
||||
open var color: UIColor = .black {
|
||||
didSet {
|
||||
|
||||
if oldValue != color {
|
||||
@ -35,7 +35,7 @@ public class ColorIndicatorView: UIView {
|
||||
|
||||
}
|
||||
|
||||
override public func draw(_ rect: CGRect) {
|
||||
override open func draw(_ rect: CGRect) {
|
||||
|
||||
guard let context = UIGraphicsGetCurrentContext() else {
|
||||
return
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
public class ColorSquarePicker: UIControl {
|
||||
open class ColorSquarePicker: UIControl {
|
||||
|
||||
private let contentInsetX: CGFloat = 20
|
||||
private let contentInsetY: CGFloat = 20
|
||||
@ -60,7 +60,7 @@ public class ColorSquarePicker: UIControl {
|
||||
indicator.color = color
|
||||
}
|
||||
|
||||
public override func layoutSubviews() {
|
||||
open override func layoutSubviews() {
|
||||
|
||||
if colorSquareView.superview == nil {
|
||||
|
||||
@ -104,7 +104,7 @@ public class ColorSquarePicker: UIControl {
|
||||
self.value = touchValue
|
||||
}
|
||||
|
||||
override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
|
||||
self.trackIndicator(with: touch)
|
||||
|
||||
@ -113,20 +113,20 @@ public class ColorSquarePicker: UIControl {
|
||||
return true
|
||||
}
|
||||
|
||||
override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
|
||||
self.trackIndicator(with: touch)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
super.endTracking(touch, with: event)
|
||||
|
||||
shrinkIndicator()
|
||||
}
|
||||
|
||||
override public func cancelTracking(with event: UIEvent?) {
|
||||
override open func cancelTracking(with event: UIEvent?) {
|
||||
super.cancelTracking(with: event)
|
||||
|
||||
shrinkIndicator()
|
||||
|
@ -9,12 +9,12 @@
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class ColorSquareView: UIImageView {
|
||||
open class ColorSquareView: UIImageView {
|
||||
|
||||
private var drawnHue: CGFloat = 0.0
|
||||
|
||||
@IBInspectable
|
||||
var hue: CGFloat = 0.0 {
|
||||
open var hue: CGFloat = 0.0 {
|
||||
didSet {
|
||||
|
||||
if self.image != nil && abs(drawnHue - hue) <= 1e-10 {
|
||||
|
@ -10,10 +10,10 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
public class SourceColorView: UIControl {
|
||||
open class SourceColorView: UIControl {
|
||||
|
||||
@IBInspectable
|
||||
public var isTrackingInside: Bool = false {
|
||||
open var isTrackingInside: Bool = false {
|
||||
didSet {
|
||||
if oldValue != isTrackingInside {
|
||||
self.setNeedsDisplay()
|
||||
@ -22,7 +22,7 @@ public class SourceColorView: UIControl {
|
||||
}
|
||||
|
||||
@IBInspectable
|
||||
public var dontShrinkWhenPressed: Bool = false {
|
||||
open var dontShrinkWhenPressed: Bool = false {
|
||||
didSet {
|
||||
if oldValue != dontShrinkWhenPressed {
|
||||
self.setNeedsDisplay()
|
||||
@ -30,7 +30,7 @@ public class SourceColorView: UIControl {
|
||||
}
|
||||
}
|
||||
|
||||
public override func draw(_ rect: CGRect) {
|
||||
open override func draw(_ rect: CGRect) {
|
||||
super.draw(rect)
|
||||
|
||||
guard isEnabled && isTrackingInside && !dontShrinkWhenPressed else {
|
||||
@ -52,7 +52,7 @@ public class SourceColorView: UIControl {
|
||||
|
||||
// MARK: - UIControl overrides
|
||||
|
||||
public override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
|
||||
guard self.isEnabled else {
|
||||
return false
|
||||
@ -63,7 +63,7 @@ public class SourceColorView: UIControl {
|
||||
return super.beginTracking(touch, with: event)
|
||||
}
|
||||
|
||||
public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
open override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
|
||||
let isTrackingInside = self.bounds.contains(touch.location(in: self))
|
||||
|
||||
@ -72,14 +72,14 @@ public class SourceColorView: UIControl {
|
||||
return super.continueTracking(touch, with: event)
|
||||
}
|
||||
|
||||
public override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
|
||||
self.isTrackingInside = false
|
||||
|
||||
super.endTracking(touch, with: event)
|
||||
}
|
||||
|
||||
public override func cancelTracking(with event: UIEvent?) {
|
||||
open override func cancelTracking(with event: UIEvent?) {
|
||||
|
||||
self.isTrackingInside = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user