Ver código fonte

fix 音乐选择框对齐问题

huzhiqiang 3 anos atrás
pai
commit
00c8c4e062

+ 5 - 7
BFFramework/Classes/Stuckpoint/View/PQStuckPointCuttingView.swift

@@ -174,8 +174,8 @@ class PQStuckPointCuttingView: UIView {
         addSubview(leftMaskView)
         addSubview(rightMaskView)
         videoCropView.addSubview(tatalTimeLabel)
- 
         addData()
+        videoCropView.frame = CGRect(x: (cScreenWidth - cropViewWidth) / 2, y: 0, width: cropViewWidth, height: 80)
 
         tatalTimeLabel.snp.remakeConstraints { make in
             make.width.equalTo(40)
@@ -241,9 +241,9 @@ class PQStuckPointCuttingView: UIView {
         // 整倍数
         let waveTotalCount = Int(wavTotalCount) / cFrequency.count
         // 余多少个未画的
-        var remainder = Int(ceil(CGFloat(wavTotalCount) - CGFloat(waveTotalCount * cFrequency.count)))
+        var remainder = Int(wavTotalCount % cFrequency.count)
         var totalWave: [CGFloat] = Array<CGFloat>.init()
-        // 1,先画整倍数个竖线
+//         1,先画整倍数个竖线
         for _ in 0 ..< waveTotalCount {
             totalWave = totalWave + cFrequency
         }
@@ -252,7 +252,7 @@ class PQStuckPointCuttingView: UIView {
         }
         // 1,再画余数个竖线
         if remainder > 0 {
-            totalWave = totalWave + cFrequency[0 ... remainder]
+            totalWave = totalWave + cFrequency[0 ... (remainder - 1)]
         }
 
         createWave(waveArr: totalWave)
@@ -267,9 +267,7 @@ class PQStuckPointCuttingView: UIView {
             return
         }
         let startIndex = scrollView.contentOffset.x / (frequencyWidth + frequencyMargin)
-        
-//        HHZPrint("startIndex is:\(startIndex) stuckPointStartTime is: \(stuckPointStartTime)")
-        let selectIndex = Int(ceil(startIndex + progress * CGFloat(wavSelectCount)))
+        let selectIndex = Int(floor(startIndex + progress * CGFloat(wavSelectCount)))
         if(selectIndex < lineLayerArray.count){
             let drawLayer:CAShapeLayer = lineLayerArray[selectIndex]
             BFLog(message: "progress is \(progress) i \(selectIndex) 命中的位置:\(CGFloat(selectIndex) * oneMarginTime)")