Pārlūkot izejas kodu

1,修改色值 2, 修改返回参数

jsonwang 3 gadi atpakaļ
vecāks
revīzija
ad4a020198

+ 7 - 4
BFRecordScreenKit/Classes/RecordScreen/View/BFMusicCutView.swift

@@ -20,7 +20,7 @@ public enum MusiceCutActionType: Int {
 class BFMusicCutView: UIView, UIGestureRecognizerDelegate {
     var waveLayers: [CAShapeLayer] = Array<CAShapeLayer>.init()
     // 裁剪时间回调
-    var cutTimeHandle: ((_ startTime: Float64, _ endTime: Float64, _ bgmData: PQVoiceModel?) -> Void)?
+    var cutTimeHandle: ((_ isCancel: Bool, _ endTime: Float64, _ bgmData: PQVoiceModel?) -> Void)?
 
     let normalMargin: CGFloat = cDefaultMargin * 2
 
@@ -306,7 +306,7 @@ class BFMusicCutView: UIView, UIGestureRecognizerDelegate {
                 if index < Int(startTotal) {
                     (progressImage.layer.sublayers?[index] as? CAShapeLayer)?.strokeColor = UIColor.hexColor(hexadecimal: "#202020").cgColor
                 } else {
-                    (progressImage.layer.sublayers?[index] as? CAShapeLayer)?.strokeColor = UIColor.white.cgColor
+                    (progressImage.layer.sublayers?[index] as? CAShapeLayer)?.strokeColor = UIColor.hexColor(hexadecimal: "#505050").cgColor
                 }
                 (progressImage.layer.sublayers?[totalCount - index - 1] as? CAShapeLayer)?.setNeedsDisplay()
             }
@@ -334,7 +334,7 @@ class BFMusicCutView: UIView, UIGestureRecognizerDelegate {
                     if tempIndex >= totalCount - 1 {
                         tempIndex = totalCount - 1
                     }
-                    (progressImage.layer.sublayers?[tempIndex] as? CAShapeLayer)?.strokeColor = UIColor.hexColor(hexadecimal: "#389AFF").cgColor
+                    (progressImage.layer.sublayers?[tempIndex] as? CAShapeLayer)?.strokeColor = UIColor.hexColor(hexadecimal: "#1B5692").cgColor
                     (progressImage.layer.sublayers?[tempIndex] as? CAShapeLayer)?.setNeedsDisplay()
                 }
             }
@@ -352,6 +352,9 @@ class BFMusicCutView: UIView, UIGestureRecognizerDelegate {
 
     @objc func cancelAction() {
         hidden()
+        if cutTimeHandle != nil, bgmData != nil {
+            cutTimeHandle!(true, 0, bgmData)
+        }
     }
 
     @objc func okBtnAction() {
@@ -362,7 +365,7 @@ class BFMusicCutView: UIView, UIGestureRecognizerDelegate {
         BFLog(message: "最后设置的开始时间是\(bgmData?.startCMTime.seconds ?? 0.0)")
 
         if cutTimeHandle != nil, bgmData != nil {
-            cutTimeHandle!(0, 0, bgmData)
+            cutTimeHandle!(false, 0, bgmData)
         }
     }
 }