123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- //
- // TSLightSolidColorVC.swift
- // Girly
- //
- // Created by 100Years on 2025/1/7.
- //
- import JXSegmentedView
- class TSLightSolidColorVC: TSBaseVC{
-
- lazy var currentColor:UIColor = {
- let color = TSConfig.ligntSolidDefaultColor
- return color
- }(){
- didSet{
- updateColorView()
- }
- }
-
- lazy var brightnessNum:CGFloat = {
- return 1.0
- }(){
- didSet{
- updateColorView()
- }
- }
-
- lazy var saturationNum:CGFloat = {
- return 1.0
- }(){
- didSet{
- updateColorView()
- }
- }
-
- lazy var colorPaletteView: TSLightColorPaletteView = {
- let colorPaletteView = TSLightColorPaletteView()
- colorPaletteView.changedBrightnessComplete = { [weak self] floatNum in
- guard let self = self else { return }
- brightnessNum = floatNum
- }
-
- colorPaletteView.changedSaturationComplete = { [weak self] floatNum in
- guard let self = self else { return }
- saturationNum = floatNum
- }
-
- return colorPaletteView
- }()
-
- lazy var topView: UIView = {
- let view = UIView()
- view.backgroundColor = currentColor
- view.cornerRadius = 22.0
-
- view.addSubview(colorPaletteView)
- colorPaletteView.snp.makeConstraints { make in
- make.leading.equalTo(12)
- make.trailing.equalTo(-12)
- make.height.equalTo(100.0)
- make.bottom.equalTo(-12)
- }
- let fullScreenBtn = UIButton.createButton(image: UIImage(named: "fullScreen"),backgroundColor: UIColor.fromHex("000000", alpha: 0.2),corner: 8.0) { [weak self] in
- guard let self = self else { return }
- kPresentModalVC(target: self, modelVC: TSFullScreenVC.creatSolidColorVC(color: topView.backgroundColor ?? .white),transitionStyle: .crossDissolve)
- }
- view.addSubview(fullScreenBtn)
- fullScreenBtn.snp.makeConstraints { make in
- make.top.equalTo(16)
- make.trailing.equalTo(-12)
- make.width.height.equalTo(36)
- }
-
- return view
- }()
-
- lazy var toolView: TSLightSolidColorToolView = {
- let toolView = TSLightSolidColorToolView()
- toolView.changedColorComplete = {[weak self] color in
- guard let self = self else { return }
-
- currentColor = color
-
- }
- return toolView
- }()
- override func createView() {
- setNavBarViewHidden(true)
- contentView.addSubview(topView)
- contentView.addSubview(toolView)
- topView.snp.makeConstraints { make in
- make.leading.equalTo(16)
- make.trailing.equalTo(-16)
- make.top.equalTo(kLightTop)
- make.bottom.equalTo(-172.0)
- }
- toolView.snp.makeConstraints { make in
- make.leading.equalTo(0)
- make.trailing.equalTo(0)
- make.height.equalTo(128.0)
- make.bottom.equalTo(0)
- }
- }
-
-
- func updateColorView(){
- topView.backgroundColor = currentColor.adjusted(brightness: brightnessNum,saturation: saturationNum)
- }
- }
- extension TSLightSolidColorVC: JXSegmentedListContainerViewListDelegate {
- func listView() -> UIView {
- return view
- }
- }
|