ソースを参照

图片拼接卡点数据使用统一方法

jsonwang 3 年 前
コミット
6242f6de0e

+ 2 - 20
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -1498,31 +1498,13 @@ extension PQStuckPointEditerController {
             // lastCyclesSelectIndex != -1 已经设置过循环次数 应该是手动设置的值
             if lastCyclesSelectIndex != -1 {
                 // 纯图片时 已经默认添加一次循环 所以要用lastCyclesSelectIndex - 1
-                for i in 0 ..< lastCyclesSelectIndex {
-                    var pointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in
-                        (point == (finallyStuckPoints.last ?? 0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0)))
-                    })
-                    pointIndex = (pointIndex ?? 0) + 1
-                    for i in 0 ... selectedImageDataCount {
-                        let a = stuckPointsTemp[(i + Int(pointIndex ?? 0)) % stuckPointsTemp.count]
-                        let b = Float((i + Int(pointIndex ?? 0)) / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0)
-                        finallyStuckPoints.append(a + b)
-                    }
-                }
+                clipPoint(clipCount: selectedImageDataCount * lastCyclesSelectIndex - 1, oldPoints: stuckPointsTemp)
 
             } else {
                 lastCyclesSelectIndex = 0
                 while oneSelectImageDuration < 10 {
                     // 不够10S 时 一次加图片数量的卡点数
-                    var pointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in
-                        (point == (finallyStuckPoints.last ?? 0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0)))
-                    })
-                    pointIndex = (pointIndex ?? 0) + 1
-                    for i in 0 ... selectedImageDataCount {
-                        let a = stuckPointsTemp[(i + Int(pointIndex ?? 0)) % stuckPointsTemp.count]
-                        let b = Float((i + Int(pointIndex ?? 0)) / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0)
-                        finallyStuckPoints.append(a + b)
-                    }
+                    clipPoint(clipCount: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
                     oneSelectImageDuration = Float((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0)) + oneSelectImageDuration
 
                     lastCyclesSelectIndex = lastCyclesSelectIndex + 1