Fixed: on-screen widget default border alpha issue

This commit is contained in:
TrueZhuanjia
2025-10-20 19:45:33 +08:00
parent 94a8caa5df
commit b7ad4d3562
2 changed files with 7 additions and 6 deletions
@@ -83,7 +83,7 @@
self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"];
self.backgroundAlpha = [decoder containsValueForKey:@"backgroundAlpha"] ? [decoder decodeFloatForKey:@"backgroundAlpha"] : 0.5;
self.labelAlpha = [decoder containsValueForKey:@"labelAlpha"] ? [decoder decodeFloatForKey:@"labelAlpha"] : 0.82;
self.borderAlpha = [decoder containsValueForKey:@"borderAlpha"] ? [decoder decodeFloatForKey:@"borderAlpha"] : self.labelAlpha*1.01;
self.borderAlpha = [decoder containsValueForKey:@"borderAlpha"] ? [decoder decodeFloatForKey:@"borderAlpha"] : 0.19;
self.borderWidth = [decoder decodeFloatForKey:@"borderWidth"];
self.widgetShape = [decoder decodeObjectForKey:@"widgetShape"];
self.minStickOffset = [decoder decodeFloatForKey:@"minStickOffset"];
+6 -5
View File
@@ -74,7 +74,7 @@ import UIKit
@objc public var borderWidth: CGFloat = 0.0
@objc public var backgroundAlpha: CGFloat = 0.5
@objc public var labelAlpha: CGFloat = 0.82
@objc public var borderAlpha: CGFloat = 0.82 * 1.01
@objc public var borderAlpha: CGFloat = 0.19
@objc public var vibrationStyle: Int = 6
@objc public var latestTouchLocation: CGPoint
@objc public var selfViewOnTheRight: Bool = false
@@ -467,13 +467,14 @@ import UIKit
let realBackgroundAlpha = self.backgroundAlpha - 0.18 // offset to be consistent with legacy onScreen controller layer opacity
self.backgroundColor = UIColor(white: 0.2, alpha: realBackgroundAlpha) // offset to be consistent with legacy onScreen controller layer opacity
borderAlpha = tweakBorderAlpha ? realBackgroundAlpha * 1.01 : borderAlpha
defaultBorderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
self.layer.borderColor = defaultBorderColor
if tweakBorderAlpha {
borderAlpha = realBackgroundAlpha * 1.01
defaultBorderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
self.layer.borderColor = defaultBorderColor
}
if widgetType == WidgetTypeEnum.touchPad {
self.backgroundColor = UIColor.clear // make touchPad transparent
self.layer.borderColor = UIColor(white: 0.2, alpha: borderAlpha - 0.15).cgColor // reduced border alpha for touchPad
}
}