|
@@ -15,6 +15,8 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
|
|
|
var imageViews = [BFThumImageView]()
|
|
|
|
|
|
+ var newRecord = false
|
|
|
+
|
|
|
lazy var progressView: BFAutolayoutScrollView = {
|
|
|
let sv = BFAutolayoutScrollView()
|
|
|
sv.bounces = false
|
|
@@ -64,12 +66,16 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
|
|
|
if let lastiv = wself.imageViews.last {
|
|
|
iv.frame = CGRect(x: lastiv.rightX, y: lastiv.y, width: 0, height: 50)
|
|
|
- lastiv.isHiddenBord = false
|
|
|
+ if wself.newRecord {
|
|
|
+ lastiv.isHiddenBord = false
|
|
|
+ wself.newRecord = false
|
|
|
+ }
|
|
|
+ BFLog(1, message: "frame: \(lastiv.viewWithTag(12333)!.convert(lastiv.viewWithTag(12333)!.bounds , to: wself.progressView.contentView)), \(iv.frame)")
|
|
|
}else{
|
|
|
iv.frame = CGRect(x: cScreenWidth / 2.0, y: 0, width: 0, height: 50)
|
|
|
}
|
|
|
wself.imageViews.append(iv)
|
|
|
- BFLog(1, message: "\(wself.imageViews.count), if frame : \(iv.frame)")
|
|
|
+
|
|
|
wself.progressView.setNeedsLayout()
|
|
|
wself.progressView.layoutIfNeeded()
|
|
|
}
|
|
@@ -93,17 +99,18 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
iv.image = img
|
|
|
iv.contentMode = .scaleAspectFill
|
|
|
iv.clipsToBounds = true
|
|
|
- iv.isHiddenBord = false
|
|
|
+ iv.isHiddenBord = true
|
|
|
progressView.contentView.addSubview(iv)
|
|
|
imageViews.append(iv)
|
|
|
|
|
|
// 计算iv的宽和偏移量
|
|
|
- let wid = (sticker.timelineCMOut - sticker.timelineCMIn).seconds.truncatingRemainder(dividingBy: 5.0) * 70.0 / 5.0
|
|
|
+ let wid = sticker.timelineCMOut.seconds * 70.0 / 5.0 - (leftah - cScreenWidth / 2.0)
|
|
|
let wid0 = (ind < (thumimgs.count - 1)) ? 70 : floor(wid * UIScreen.main.scale) / UIScreen.main.scale
|
|
|
- let x = CGFloat(ind) * 70.0
|
|
|
- iv.frame = CGRect(x: leftah + x, y: 0.0, width: wid0, height: 50.0)
|
|
|
+// let x = (sticker.timelineCMIn.seconds + Double(ind) * 5.0) * 70.0 / 5.0
|
|
|
+ iv.frame = CGRect(x: leftah, y: 0.0, width: wid0, height: 50.0)
|
|
|
+ leftah = iv.rightX
|
|
|
}
|
|
|
- leftah = imageViews.last?.rightX ?? 0.0
|
|
|
+ (progressView.contentView.subviews.last as? BFThumImageView)?.isHiddenBord = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -112,7 +119,7 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
lastiv.isHiddenBord = true
|
|
|
}
|
|
|
|
|
|
- let p = CGPoint(x: leftah - cScreenWidth / 2.0, y: 0)
|
|
|
+ let p = CGPoint(x: (imageViews.last?.rightX ?? 0.0) - cScreenWidth / 2.0, y: 0)
|
|
|
|
|
|
progressView.contentOffset = p
|
|
|
progressView.contentSize = CGSize(width: p.x + cScreenWidth, height: 50)
|
|
@@ -122,11 +129,12 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
if let sticker = recordItem?.videoStickers.first(where: { mod in
|
|
|
CMTimeCompare(mod.timelineCMIn, progress) <= 0 && CMTimeCompare(mod.timelineCMOut, progress) >= 0
|
|
|
}) {
|
|
|
- let wid = (sticker.timelineCMOut - sticker.timelineCMIn).seconds.truncatingRemainder(dividingBy: 5.0) * 70.0 / 5.0
|
|
|
- let wid0 = floor(wid * UIScreen.main.scale) / UIScreen.main.scale
|
|
|
if index < imageViews.count{
|
|
|
let lastiv = imageViews[index]
|
|
|
- if wid0 <= lastiv.width {
|
|
|
+ let wid = progress.seconds * 70.0 / 5.0 - (lastiv.x - cScreenWidth / 2.0)
|
|
|
+ let wid0 = floor(wid * UIScreen.main.scale) / UIScreen.main.scale
|
|
|
+
|
|
|
+ if wid0 <= lastiv.width || wid0 > 70{
|
|
|
return
|
|
|
}
|
|
|
var frame = lastiv.frame
|
|
@@ -137,9 +145,13 @@ class BFCameraProgressView: BFProgressBaseView {
|
|
|
let p = CGPoint(x: progress.seconds * 70 / 5.0, y: 0)
|
|
|
progressView.contentOffset = p
|
|
|
progressView.contentSize = CGSize(width: p.x + cScreenWidth, height: 50)
|
|
|
-// BFLog(1, message: "contentSize: \(progressView.contentSize)")
|
|
|
+ BFLog(1, message: "contentSize: \(progressView.contentSize)")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ func changeSepline(img:UIImage){
|
|
|
+ newRecord = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension BFCameraProgressView: UIScrollViewDelegate {
|