|
@@ -82,23 +82,38 @@ class BFIndirectionProgressView: UIView {
|
|
/// - _:
|
|
/// - _:
|
|
/// - start: 开始录制的时间
|
|
/// - start: 开始录制的时间
|
|
/// - progress: 当前录制时长
|
|
/// - progress: 当前录制时长
|
|
- func setProgress(start: CMTime = .zero, progress: Float64) {
|
|
|
|
|
|
+ func setProgress(start: CMTime = .zero, progress: Float64, isInsert:Bool = false) {
|
|
if start.seconds * percenWidth >= frame.width {
|
|
if start.seconds * percenWidth >= frame.width {
|
|
frame.size.width = (superview as? UIScrollView)?.contentSize.width ?? 0
|
|
frame.size.width = (superview as? UIScrollView)?.contentSize.width ?? 0
|
|
}
|
|
}
|
|
|
|
|
|
detectionAndCreateItem(start: start, progress: progress)
|
|
detectionAndCreateItem(start: start, progress: progress)
|
|
- if let currentItem = currentItem {
|
|
|
|
- let oldwidth = currentItem.frame.width
|
|
|
|
- currentItem.frame.size.width = progress < 0 ? 0 : progress * percenWidth
|
|
|
|
- BFLog(message: "当前view:\(String(describing: currentItem))")
|
|
|
|
-
|
|
|
|
- // 插入后后边的视图后移
|
|
|
|
- subviews.forEach { subv in
|
|
|
|
- if currentItem.frame.maxX < subv.frame.maxX {
|
|
|
|
- subv.frame = subv.frame.offsetBy(dx: (currentItem.width) - oldwidth, dy: 0)
|
|
|
|
|
|
+
|
|
|
|
+ if isInsert {
|
|
|
|
+ if let currentItem = currentItem {
|
|
|
|
+ let oldwidth = currentItem.frame.width
|
|
|
|
+ currentItem.frame.size.width = progress < 0 ? 0 : progress * percenWidth
|
|
|
|
+ BFLog(message: "当前view:\(String(describing: currentItem))")
|
|
|
|
+
|
|
|
|
+ // 插入后后边的视图后移
|
|
|
|
+ subviews.forEach { subv in
|
|
|
|
+ if currentItem.frame.maxX < subv.frame.maxX {
|
|
|
|
+ subv.frame = subv.frame.offsetBy(dx: (currentItem.width) - oldwidth, dy: 0)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ // 视频录制
|
|
|
|
+ currentItem?.frame.size.width = progress < 0 ? 0 : progress * percenWidth
|
|
|
|
+ BFLog(message: "当前view:\(String(describing: currentItem))")
|
|
|
|
+ let vc = subviews.first { [weak self] sub in
|
|
|
|
+ (self?.currentItem?.frame.minX ?? 0) < sub.frame.minX && sub.frame.minX < (self?.currentItem?.frame.maxX ?? 0)
|
|
|
|
+ }
|
|
|
|
+ if vc != nil {
|
|
|
|
+ deletedView = vc
|
|
|
|
+ vc?.removeFromSuperview()
|
|
|
|
+ BFLog(message: "添加覆盖view-添加:deletedView = \(String(describing: deletedView))")
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -108,7 +123,7 @@ class BFIndirectionProgressView: UIView {
|
|
BFLog(message: "检测并创建item:\(start)")
|
|
BFLog(message: "检测并创建item:\(start)")
|
|
if currentItem == nil {
|
|
if currentItem == nil {
|
|
deletedView = nil
|
|
deletedView = nil
|
|
-// subviews[curr]
|
|
|
|
|
|
+
|
|
currentItem = createItemView(minX: start.seconds * percenWidth)
|
|
currentItem = createItemView(minX: start.seconds * percenWidth)
|
|
if subviews.count > 1 {
|
|
if subviews.count > 1 {
|
|
let vvs = subviews.sorted { v1, v2 in
|
|
let vvs = subviews.sorted { v1, v2 in
|
|
@@ -162,6 +177,10 @@ class BFIndirectionProgressView: UIView {
|
|
func resetCurrentItem(start: CGFloat, end: CGFloat) {
|
|
func resetCurrentItem(start: CGFloat, end: CGFloat) {
|
|
currentItem?.frame.origin.x = start * percenWidth
|
|
currentItem?.frame.origin.x = start * percenWidth
|
|
currentItem?.frame.size.width = (end - start) * percenWidth
|
|
currentItem?.frame.size.width = (end - start) * percenWidth
|
|
|
|
+
|
|
|
|
+ if subviews.max(by: {$0.rightX < $1.rightX}) == currentItem {
|
|
|
|
+ (currentItem as? BFThumImageView)?.isHiddenBord = true
|
|
|
|
+ }
|
|
currentItem = nil
|
|
currentItem = nil
|
|
BFLog(message: "重置currentItem:\(start)")
|
|
BFLog(message: "重置currentItem:\(start)")
|
|
}
|
|
}
|