3 Commits 19920c6a0a ... e733ab45ae

Autor SHA1 Mensagem Data
  zhongbaojian e733ab45ae Merge branch 'develop' of http://svn.ouj.com:3000/duowan_iOS/SuperShow into develop 5 anos atrás
  zhongbaojian 6182ffb34b 优化字幕小字体模糊问题 5 anos atrás
  zhongbaojian be16b40f70 fix: 下载模板页编辑状态进入详情页问题 5 anos atrás

+ 1 - 1
SuperShow/Tool/WSSUIViewExtension.swift

@@ -81,7 +81,7 @@ public extension UIView {
         isShoting = true
         let bounds = self.bounds
 
-        UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.main.scale)
+        UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0.0)
 
         let context = UIGraphicsGetCurrentContext()
         context?.saveGState()

+ 8 - 1
SuperShow/UI/CoolVoice/Views/CoreTextLabel/WSSCoolVoicePasterView.swift

@@ -38,6 +38,7 @@ class WSSCoolVoicePasterView: WSSPasterBaseView {
     var subtitleLabel: WSSCoolVoiceTextLabel?
     var currentFontSize: CGFloat = WSSCoolVoiceTextLabelViewModel.kDefaultFontSize
     var isSubtitleDragging: Bool = false
+    private var scale: CGFloat = 1.0
 
     fileprivate var boxView: UIImageView = {
         let box = UIImageView()
@@ -96,11 +97,17 @@ class WSSCoolVoicePasterView: WSSPasterBaseView {
         }
     }
 
+    func scaleFontSize(_ fontSize: CGFloat, scale: CGFloat) {
+        subtitleLabel?.scale = scale
+        self.scale = scale
+        changeFontSize(fontSize)
+    }
+
     func refreshLayout() {
         if var subtitleSize = self.subtitleLabel?.size {
             let oldCenter: CGPoint = center
 
-            let maxWidth: CGFloat = kOJSScreenWidth - OJAStyle.LRCommonMargin * 2.0
+            let maxWidth: CGFloat = (kOJSScreenWidth - OJAStyle.LRCommonMargin * 2.0) * scale
             if subtitleSize.width >= maxWidth {
                 subtitleSize.width = maxWidth
             } else {

+ 4 - 1
SuperShow/UI/CoolVoice/Views/CoreTextLabel/WSSCoolVoiceTextLabel.swift

@@ -10,6 +10,9 @@ import OJASwiftKit
 import UIKit
 
 class WSSCoolVoiceTextLabel: YYLabel {
+    
+    var scale:CGFloat = 1.0
+    
     var viewModel: WSSCoolVoiceTextLabelViewModel? {
         didSet {
             if let newModel = viewModel {
@@ -52,7 +55,7 @@ class WSSCoolVoiceTextLabel: YYLabel {
     }
 
     func refreshHeight() {
-        let maxWidth: CGFloat = kOJSScreenWidth - OJAStyle.LRCommonMargin * 2.0
+        let maxWidth: CGFloat = (kOJSScreenWidth - OJAStyle.LRCommonMargin * 2.0) * self.scale
         var newSize: CGSize = sizeThatFits(CGSize(width: maxWidth, height: CGFloat.greatestFiniteMagnitude))
 
         if newSize.width > maxWidth {

+ 9 - 5
SuperShow/UI/CoolVoice/WSSCoolVoiceSubtitleController.swift

@@ -1154,10 +1154,8 @@ fileprivate extension WSSCoolVoiceSubtitleController {
         let centerYPercent: CGFloat = centerPoint.y / overlaySize.height
         let covertCenter: CGPoint = CGPoint(x: centerXPercent * rect.size.width, y: centerYPercent * rect.size.height)
 
-//        WSSSimpleLog("🥞🥞🥞: \(centerXPercent) + \(centerYPercent) + \(covertCenter) ++ \(rect)")
-
         for subtitleModel in currentShowingSubtitleInfos {
-            if let textModel = subtitleModel.fontViewModel {
+            if let textModel = subtitleModel.fontViewModel?.deepCopy() {
                 let tmpPasterView = WSSCoolVoicePasterView.createPasterView(withCenter: centerPoint, vm: textModel)
 
                 let sizeWidthPercent: CGFloat = tmpPasterView.size.width / overlaySize.width
@@ -1167,9 +1165,15 @@ fileprivate extension WSSCoolVoiceSubtitleController {
                 tmpPasterView.bounds = covertBounds
                 tmpPasterView.center = covertCenter
 
-//                    WSSSimpleLog("🥞🥞🥞aaa: \(sizeWidthPercent) + \(sizeHeightPercent) + \(covertBounds) ")
-
                 let vertex = calculateVertex(withPaster: tmpPasterView, targetView: placeholer).map({ NSNumber(value: Float($0)) })
+
+                // 为了提高小字体的字体清晰度
+                let needScaleFontSize: CGFloat = 24.0
+                if textModel.fontSize < needScaleFontSize {
+                    let scale: CGFloat = needScaleFontSize / textModel.fontSize
+                    tmpPasterView.scaleFontSize(needScaleFontSize, scale: scale)
+                }
+
                 if let image = tmpPasterView.subtitleLabel?.wss_screenShot() {
                     guard let input = setupInput(textImage: image, vertex: vertex) else { return }
                     let pasterData: (XunFeiSDKTool.MSCResultModel, OJAPasterFrameInput) = (subtitleModel, input)

+ 6 - 0
SuperShow/UI/Profile/Collection/WSSProfileMyTemplateViewController.swift

@@ -316,6 +316,12 @@ extension WSSProfileMyTemplateViewController: UICollectionViewDelegate {
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         guard let model = dataArray.safeObject(atIndex: indexPath.item) else { return }
         if model.isPublish {
+            
+            if self.mode == true && self.isEditingMode == true {
+                // 如果当前是下载模板列表页,并且处于编辑状态,则不进入详情页
+                return;
+            }
+            
             OJAJumpManager.jumpToTemplateDetail(withTemplateID: model.templateId)
         } else {
             let alert = WSSNormalAlert(msg: "该模板正在回炉改造,敬请期待", buttonTitle: "好的") {