|
@@ -184,7 +184,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
btn.setTitle("删除录制", for: .normal)
|
|
|
btn.adjustsImageWhenHighlighted = false
|
|
|
btn.addCorner(corner: 6)
|
|
|
- btn.addTarget(self, action: #selector(deleteRecorded), for: .touchUpInside)
|
|
|
+ btn.addTarget(self, action: #selector(deleteRecordAction), for: .touchUpInside)
|
|
|
btn.isHidden = true
|
|
|
return btn
|
|
|
}()
|
|
@@ -830,14 +830,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
var deleteTemp = [(PQEditSubTitleModel, Int)]()
|
|
|
|
|
|
for (index, title) in itemModels[currItemModelIndex].titleStickers.enumerated() {
|
|
|
- if title.timelineIn >= voiceModel.startTime, title.timelineOut <= voiceModel.endTime {
|
|
|
+ if title.audioFilePath == voiceModel.wavFilePath {
|
|
|
deleteTemp.append((title, index))
|
|
|
}
|
|
|
- // 从原数组中删除
|
|
|
- if let index = itemModels[currItemModelIndex].titleStickers.firstIndex(of: title) {
|
|
|
- itemModels[currItemModelIndex].titleStickers.remove(at: index)
|
|
|
+ }
|
|
|
+ // 从原数组中删除
|
|
|
+ let arr = itemModels[currItemModelIndex].titleStickers.filter { model in
|
|
|
+ return !deleteTemp.contains { tuple in
|
|
|
+ tuple.0.audioFilePath == model.audioFilePath
|
|
|
}
|
|
|
}
|
|
|
+ itemModels[currItemModelIndex].titleStickers = arr
|
|
|
BFLog(message: "itemModels[currItemModelIndex].titleStickers 删除后:\(itemModels[currItemModelIndex].titleStickers.count)")
|
|
|
|
|
|
// 清空字幕UI
|
|
@@ -847,7 +850,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
return deleteTemp
|
|
|
}
|
|
|
|
|
|
- @objc func deleteRecorded() {
|
|
|
+ @objc func deleteRecordAction() {
|
|
|
if !isDragingProgressSlder, isStopAtRecordRange != -1, isStopAtRecordRange < itemModels[currItemModelIndex].voiceStickers.count {
|
|
|
let model = itemModels[currItemModelIndex].voiceStickers[isStopAtRecordRange]
|
|
|
itemModels[currItemModelIndex].voiceStickers.remove(at: isStopAtRecordRange)
|
|
@@ -872,11 +875,13 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 重绘录音进度视图
|
|
|
indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: progressThumV.thumbImageWidth / 2.0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
}
|
|
|
- searchStopAtRecordRange()
|
|
|
-
|
|
|
+
|
|
|
var event = WithDrawModel(type: 3, timestamp: currentAssetProgress.seconds, deletedVoices: [(model, isStopAtRecordRange)])
|
|
|
event.deletedTittles = deleteTitles(voiceModel: model)
|
|
|
events.append(event)
|
|
|
+
|
|
|
+ searchStopAtRecordRange()
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|