|
@@ -261,14 +261,14 @@ extension BFVideoThumbProgressView: UIScrollViewDelegate {
|
|
|
let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
|
|
|
if recordItem?.mediaType == .VIDEO {
|
|
|
if isDrag {
|
|
|
- dragScrollProgressHandle?(false, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
|
|
|
+ dragScrollProgressHandle?(false, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
|
|
|
}
|
|
|
} else if recordItem?.mediaType == .IMAGE {
|
|
|
if isDrag {
|
|
|
if scrollView.contentOffset.x > ((CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0) + 0.5) {
|
|
|
scrollView.contentOffset = CGPoint(x: (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0) + 0.5, y: 0)
|
|
|
}
|
|
|
- dragScrollProgressHandle?(false, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
|
|
|
+ dragScrollProgressHandle?(false, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -277,14 +277,14 @@ extension BFVideoThumbProgressView: UIScrollViewDelegate {
|
|
|
isDrag = true
|
|
|
let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
|
|
|
dragStartHandle?()
|
|
|
- dragScrollProgressHandle?(true, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
|
|
|
+ dragScrollProgressHandle?(true, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
|
|
|
}
|
|
|
|
|
|
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
|
|
if !decelerate {
|
|
|
let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
|
|
|
isDrag = false
|
|
|
- dragEndHandle?(totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
|
|
|
+ dragEndHandle?(totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
|
|
|
}
|
|
|
}
|
|
|
|