Sfoglia il codice sorgente

修改颜色滑块,阻止触摸区域外的颜色调节

100Years 3 mesi fa
parent
commit
db3544d43c
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      Girly/Common/ThirdParty/ColorSlider/ColorSlider.swift

+ 8 - 2
Girly/Common/ThirdParty/ColorSlider/ColorSlider.swift

@@ -276,8 +276,14 @@ fileprivate extension ColorSlider {
 	/// - parameter touch: The touch that triggered the update.
 	/// - parameter touchInside: Whether the touch that triggered the update was inside the control when the event occurred.
 	func update(touch: UITouch, touchInside: Bool) {
-		internalColor = gradientView.color(from: internalColor, after: touch, insideSlider: touchInside)
-		previewView?.colorChanged(to: color)
+        //这里会根据触摸在滑块外,决定颜色的饱和度和亮度
+        if touchInside == true {
+            internalColor = gradientView.color(from: internalColor, after: touch, insideSlider: true)
+            previewView?.colorChanged(to: color)
+        }
+        
+//		internalColor = gradientView.color(from: internalColor, after: touch, insideSlider: touchInside)
+//		previewView?.colorChanged(to: color)
 	}
 }