|
@@ -22,9 +22,7 @@ class BFSubtitleSettingView: UIView {
|
|
|
var lastSelectStyleBtn: UIButton = UIButton()
|
|
|
// 最后一次选择的位置 BTN
|
|
|
var lastSelectPointBtn: UIButton = UIButton()
|
|
|
- // 最后一次选择的字号的 BTN
|
|
|
- var lastSelectwordSizeBtn: UIButton = UIButton()
|
|
|
-
|
|
|
+
|
|
|
var subtitleSettingCallBack: SubtitleSettingCallBack?
|
|
|
|
|
|
var subtitle: PQEditSubTitleModel = PQEditSubTitleModel()
|
|
@@ -34,6 +32,12 @@ class BFSubtitleSettingView: UIView {
|
|
|
|
|
|
//操作板背景
|
|
|
let backView = UIButton()
|
|
|
+
|
|
|
+ //设置字号配置位置
|
|
|
+ var wordSizeIndex:Int = 3
|
|
|
+
|
|
|
+ var wordSizeBtnXiao:UIButton?
|
|
|
+ var wordSizeBtnDa:UIButton?
|
|
|
|
|
|
override init(frame: CGRect) {
|
|
|
super.init(frame: frame)
|
|
@@ -51,14 +55,16 @@ class BFSubtitleSettingView: UIView {
|
|
|
make.height.equalTo(220)
|
|
|
}
|
|
|
backView.setNeedsUpdateConstraints()
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- styleConfig = [0: ["fontColor": UIColor.hexColor(hexadecimal: "#FFCF53"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0],
|
|
|
- 1: ["fontColor": UIColor.hexColor(hexadecimal: "#FF9292"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0],
|
|
|
- 2: ["fontColor": UIColor.hexColor(hexadecimal: "#80C2FF"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0],
|
|
|
- 3: ["fontColor": UIColor.hexColor(hexadecimal: "#80E4AB"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0],
|
|
|
- 4: ["fontColor": UIColor.hexColor(hexadecimal: "#FFFFFF"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0],
|
|
|
- 5: ["fontColor": UIColor.hexColor(hexadecimal: "#000000"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.white, "backgroundAlpha": 0.0],
|
|
|
- 6: ["fontColor": UIColor.hexColor(hexadecimal: "#FFFFFF"), "backgroundColor":UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.6), "strokeColor": UIColor.clear, "backgroundAlpha": 0.6]]
|
|
|
+ styleConfig = [0: ["fontColor": UIColor.hexColor(hexadecimal: "#FFFFFF"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0,"strokeWidth":3.7,"subtitleSize":40],
|
|
|
+ 1: ["fontColor": UIColor.hexColor(hexadecimal: "#FF9292"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0,"strokeWidth":4.3,"subtitleSize":49],
|
|
|
+ 2: ["fontColor": UIColor.hexColor(hexadecimal: "#80C2FF"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0,"strokeWidth":5.2,"subtitleSize":60],
|
|
|
+ 3: ["fontColor": UIColor.hexColor(hexadecimal: "#80E4AB"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0,"strokeWidth":5.8,"subtitleSize":69],
|
|
|
+ 4: ["fontColor": UIColor.hexColor(hexadecimal: "#FFCF53"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.black, "backgroundAlpha": 0.0,"strokeWidth":7.2,"subtitleSize":81],
|
|
|
+ 5: ["fontColor": UIColor.hexColor(hexadecimal: "#000000"), "backgroundColor": UIColor.clear, "strokeColor": UIColor.white, "backgroundAlpha": 0.0,"strokeWidth":8.7,"subtitleSize":101],
|
|
|
+ 6: ["fontColor": UIColor.hexColor(hexadecimal: "#FFFFFF"), "backgroundColor":UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.6), "strokeColor": UIColor.clear, "backgroundAlpha": 0.6,"strokeWidth":10.1,"subtitleSize":121]]
|
|
|
|
|
|
// 字体样式
|
|
|
for i in 0...6 {
|
|
@@ -143,6 +149,11 @@ class BFSubtitleSettingView: UIView {
|
|
|
wordSizeBtn.addTarget(self, action: #selector(wordSizeSetting(sender:)), for: .touchUpInside)
|
|
|
backView.addSubview(wordSizeBtn)
|
|
|
wordSizeBtn.tag = i
|
|
|
+ if(i == 0){
|
|
|
+ wordSizeBtnXiao = wordSizeBtn
|
|
|
+ }else{
|
|
|
+ wordSizeBtnDa = wordSizeBtn
|
|
|
+ }
|
|
|
|
|
|
wordSizeBtn.setBackgroundImage(imageInRecordScreenKit(by: i == 0 ? "wordSizeSetting-_h" : "wordSizeSetting+_h"), for: .normal)
|
|
|
|
|
@@ -223,6 +234,7 @@ class BFSubtitleSettingView: UIView {
|
|
|
subtitle.setting.backgroundColor = config?["backgroundColor"] as! UIColor
|
|
|
subtitle.setting.backgroundAlpha = Float(config?["backgroundAlpha"] as! Double)
|
|
|
subtitle.setting.strokeColor = config?["strokeColor"] as! UIColor
|
|
|
+ subtitle.setting.strokeWidth = CGFloat(config?["strokeWidth"] as! Double)
|
|
|
|
|
|
if subtitleSettingCallBack != nil {
|
|
|
subtitleSettingCallBack!(subtitle)
|
|
@@ -247,46 +259,37 @@ class BFSubtitleSettingView: UIView {
|
|
|
}
|
|
|
|
|
|
@objc func wordSizeSetting(sender: UIButton) {
|
|
|
-
|
|
|
if(sender.tag == 0){
|
|
|
- if(subtitle.setting.subtitleSize > 40){
|
|
|
- if(subtitle.setting.subtitleSize > 80){
|
|
|
- subtitle.setting.subtitleSize -= 20
|
|
|
- }else{
|
|
|
- subtitle.setting.subtitleSize -= 10
|
|
|
- }
|
|
|
+ if(wordSizeIndex == 0){
|
|
|
+ BFLog(2, message: "已经到边界最小")
|
|
|
+ return
|
|
|
}
|
|
|
- BFLog(message: "subtitle.setting.subtitleSize - is\(subtitle.setting.subtitleSize )")
|
|
|
- if(subtitle.setting.subtitleSize > 40){
|
|
|
- lastSelectwordSizeBtn.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_h"), for: .normal)
|
|
|
-
|
|
|
- sender.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_h"), for: .normal)
|
|
|
- }else{
|
|
|
- sender.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_n"), for: .normal)
|
|
|
- }
|
|
|
-
|
|
|
+ wordSizeIndex -= 1
|
|
|
}else if(sender.tag == 1){
|
|
|
- if(subtitle.setting.subtitleSize < 120){
|
|
|
- if(subtitle.setting.subtitleSize >= 80){
|
|
|
- subtitle.setting.subtitleSize += 20
|
|
|
- }else{
|
|
|
- subtitle.setting.subtitleSize += 10
|
|
|
- }
|
|
|
-
|
|
|
+ if(wordSizeIndex == 6){
|
|
|
+ BFLog(2, message: "已经到边界最大")
|
|
|
+ return
|
|
|
}
|
|
|
- BFLog(message: "subtitle.setting.subtitleSize + is\(subtitle.setting.subtitleSize )")
|
|
|
-
|
|
|
- if(subtitle.setting.subtitleSize < 120){
|
|
|
- sender.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_h"), for: .normal)
|
|
|
- lastSelectwordSizeBtn.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_h"), for: .normal)
|
|
|
- }else{
|
|
|
- sender.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_n"), for: .normal)
|
|
|
- }
|
|
|
-
|
|
|
+ wordSizeIndex += 1
|
|
|
}
|
|
|
-
|
|
|
- lastSelectwordSizeBtn = sender
|
|
|
+ BFLog(2, message: "wordSizeIndex is\(wordSizeIndex)")
|
|
|
+ if(wordSizeIndex == 0){
|
|
|
+ wordSizeBtnDa?.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_h"), for: .normal)
|
|
|
|
|
|
+ wordSizeBtnXiao?.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_n"), for: .normal)
|
|
|
+ }else if(wordSizeIndex == 6){
|
|
|
+ wordSizeBtnXiao?.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_h"), for: .normal)
|
|
|
+
|
|
|
+ wordSizeBtnDa?.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_n"), for: .normal)
|
|
|
+ }else{
|
|
|
+
|
|
|
+ wordSizeBtnXiao?.setImage(imageInRecordScreenKit(by: "wordSizeSetting-_h"), for: .normal)
|
|
|
+
|
|
|
+ wordSizeBtnDa?.setImage(imageInRecordScreenKit(by: "wordSizeSetting+_h"), for: .normal)
|
|
|
+ }
|
|
|
+
|
|
|
+ let config = styleConfig[wordSizeIndex]
|
|
|
+ subtitle.setting.subtitleSize = config?["subtitleSize"] as! Int
|
|
|
if subtitleSettingCallBack != nil {
|
|
|
subtitleSettingCallBack!(subtitle)
|
|
|
}
|