- directionPad improvements
- feat: highlight alpha tweak
This commit is contained in:
@@ -170,6 +170,7 @@
|
||||
180345E02E819877004AF36F /* libopus-sim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libopus-sim.a"; sourceTree = "<group>"; };
|
||||
180E6E362E93BFDB0067C73A /* AlertControllerUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertControllerUtil.swift; sourceTree = "<group>"; };
|
||||
1817B61D2E6FD04D000D938D /* SafeTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafeTimer.swift; sourceTree = "<group>"; };
|
||||
182042252EFEE46700309FF6 /* touchCentered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = touchCentered.swift; sourceTree = "<group>"; };
|
||||
1829CE3D2E2154DF0074A99A /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
|
||||
1829CE3E2E2154DF0074A99A /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
|
||||
18341A022DEB65AB0094E5F2 /* FixedTintImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedTintImageView.h; sourceTree = "<group>"; };
|
||||
@@ -582,6 +583,7 @@
|
||||
FB1A67542132419700507771 /* Moonlight TV */,
|
||||
FB290CF019B2C406004C83CF /* Frameworks */,
|
||||
FB290CEF19B2C406004C83CF /* Products */,
|
||||
182042252EFEE46700309FF6 /* touchCentered.swift */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
||||
@@ -396,6 +396,7 @@ static CGRect layoutViewBounds;
|
||||
buttonState.backgroundAlpha = widgetView.backgroundAlpha;
|
||||
buttonState.labelAlpha = widgetView.labelAlpha;
|
||||
buttonState.borderAlpha = widgetView.borderAlpha;
|
||||
buttonState.highlightAlpha = widgetView.highlightAlpha;
|
||||
buttonState.borderWidth = widgetView.borderWidth;
|
||||
buttonState.highlightSizeFactor = widgetView.highlightSizeFactor;
|
||||
buttonState.autoTapInterval = widgetView.autoTapInterval;
|
||||
|
||||
@@ -52,6 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) CGFloat backgroundAlpha;
|
||||
@property (nonatomic, assign) CGFloat labelAlpha;
|
||||
@property (nonatomic, assign) CGFloat borderAlpha;
|
||||
@property (nonatomic, assign) CGFloat highlightAlpha;
|
||||
@property (nonatomic, assign) uint8_t vibrationStyle;
|
||||
@property (nonatomic, assign) uint8_t mouseButtonAction;
|
||||
@property (nonatomic, assign) uint16_t autoTapInterval;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
[encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"];
|
||||
[encoder encodeFloat:self.labelAlpha forKey:@"labelAlpha"];
|
||||
[encoder encodeFloat:self.borderAlpha forKey:@"borderAlpha"];
|
||||
[encoder encodeFloat:self.highlightAlpha forKey:@"highlightAlpha"];
|
||||
[encoder encodeFloat:self.borderWidth forKey:@"borderWidth"];
|
||||
[encoder encodeFloat:self.highlightSizeFactor forKey:@"highlightSizeFactor"];
|
||||
[encoder encodeObject:self.widgetShape forKey:@"widgetShape"];
|
||||
@@ -94,6 +95,7 @@
|
||||
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"] : 0.19;
|
||||
self.highlightAlpha = [decoder containsValueForKey:@"highlightAlpha"] ? [decoder decodeFloatForKey:@"highlightAlpha"] : 0.77;
|
||||
self.borderWidth = [decoder decodeFloatForKey:@"borderWidth"];
|
||||
self.highlightSizeFactor = [decoder containsValueForKey:@"highlightSizeFactor"] ? [decoder decodeFloatForKey:@"highlightSizeFactor"] : 1.0;
|
||||
self.widgetShape = [decoder decodeObjectForKey:@"widgetShape"];
|
||||
|
||||
@@ -90,6 +90,7 @@ import SVGKit
|
||||
@objc public var componentAlpha: CGFloat = 1
|
||||
@objc public var labelAlpha: CGFloat = 0.82
|
||||
@objc public var borderAlpha: CGFloat = 0.1
|
||||
@objc public var highlightAlpha: CGFloat = 0.77
|
||||
@objc public var vibrationStyle: Int = 6
|
||||
@objc public var latestTouchLocation: CGPoint
|
||||
@objc public var selfViewOnTheRight: Bool = false
|
||||
@@ -164,6 +165,7 @@ import SVGKit
|
||||
// for LSPAD, RSPAD
|
||||
@objc public var offSetX: CGFloat
|
||||
@objc public var offSetY: CGFloat
|
||||
private var touchCenteredOffset: Bool = false
|
||||
private let crossMarkColor: CGColor = UIColor(white: 1, alpha: 0.70).cgColor
|
||||
private let stickBallColor: CGColor = UIColor(white: 1, alpha: 0.75).cgColor
|
||||
private var stickInputScale: CGFloat = 35
|
||||
@@ -260,7 +262,7 @@ import SVGKit
|
||||
@objc public let buttonDownVisualEffectLayer = CAShapeLayer()
|
||||
@objc public var buttonDownVisualEffectStandardWidth: CGFloat
|
||||
@objc public var highlightSizeFactor: CGFloat = 1.0
|
||||
@objc static public var isTweakingHighlightSize: Bool = false
|
||||
@objc static public var isTweakingHighlight: Bool = false
|
||||
|
||||
// discreteWheels
|
||||
private var tickCycle: UInt8 = UIScreen.main.maximumFramesPerSecond > 110 ? 20 : 10
|
||||
@@ -386,6 +388,12 @@ import SVGKit
|
||||
self.sensitivityFactorY = 0.42
|
||||
self.componentSizeFactor = 2.8
|
||||
}
|
||||
if self.isDirectionPad {
|
||||
self.widthFactor = 2
|
||||
self.heightFactor = 2
|
||||
self.sensitivityFactorX = 0
|
||||
self.sensitivityFactorY = 0
|
||||
}
|
||||
}
|
||||
|
||||
self.tweakBorderAlpha(alpha: self.borderAlpha) // fix default borderAlpha offset
|
||||
@@ -570,18 +578,29 @@ import SVGKit
|
||||
|
||||
@objc public func tweakBorderAlpha(alpha:CGFloat){
|
||||
borderAlpha = alpha
|
||||
defaultBorderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
|
||||
defaultBorderColor = UIColor(white: borderAlpha>0 ? 0.1 : 0.9, alpha: abs(borderAlpha)).cgColor
|
||||
self.layer.borderColor = defaultBorderColor
|
||||
}
|
||||
|
||||
@objc public func tweakHighlightAlpha(alpha:CGFloat){
|
||||
highlightAlpha = alpha
|
||||
self.buttonDownVisualEffectLayer.borderColor = UIColor(red: 0.5, green: 0.5, blue: 1.0, alpha: highlightAlpha).cgColor
|
||||
self.l3r3Indicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
self.lrudIndicatorBall.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
self.upIndicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
self.downIndicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
self.leftIndicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
self.rightIndicator.borderColor = self.buttonDownVisualEffectLayer.borderColor
|
||||
}
|
||||
|
||||
private func tweakAlpha(tweakBorderAlpha:Bool){
|
||||
// setup default border from self.backgroundAlpha
|
||||
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
|
||||
let realBackgroundAlpha = abs(self.backgroundAlpha) - 0.18 // offset to be consistent with legacy onScreen controller layer opacity
|
||||
self.backgroundColor = UIColor(white:self.backgroundAlpha>0 ? 0.1 : 0.9, alpha: realBackgroundAlpha) // offset to be consistent with legacy onScreen controller layer opacity
|
||||
|
||||
if tweakBorderAlpha {
|
||||
borderAlpha = realBackgroundAlpha * 1.01
|
||||
defaultBorderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
|
||||
defaultBorderColor = UIColor(white: self.backgroundAlpha>0 ? 0.1 : 0.9, alpha: abs(borderAlpha)).cgColor
|
||||
self.layer.borderColor = defaultBorderColor
|
||||
}
|
||||
|
||||
@@ -719,8 +738,8 @@ import SVGKit
|
||||
let attr = NSAttributedString(
|
||||
string: text,
|
||||
attributes: [
|
||||
.foregroundColor: UIColor(white: 1.0, alpha: labelAlpha), // 填充色
|
||||
.strokeColor: UIColor.black.withAlphaComponent(labelAlpha*0.43), // 描边色
|
||||
.foregroundColor: UIColor(white:labelAlpha>0 ? 1.0 : 0, alpha: abs(labelAlpha)), // 填充色
|
||||
.strokeColor: (labelAlpha>0 ? UIColor.black : UIColor.white).withAlphaComponent(abs(labelAlpha)*0.43), // 描边色
|
||||
.strokeWidth: containsNonLatin(text) ? -1 : -4 // 负值 = 同时填充
|
||||
]
|
||||
)
|
||||
@@ -846,7 +865,7 @@ import SVGKit
|
||||
l3r3Indicator.path = path.cgPath
|
||||
l3r3Indicator.borderColor = voidlinkPurple
|
||||
self.l3r3Indicator.position = CGPointMake(self.bounds.width/2, self.bounds.height/2)
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {l3r3Indicator.isHidden = true}
|
||||
if !OnScreenWidgetView.isTweakingHighlight {l3r3Indicator.isHidden = true}
|
||||
|
||||
if l3r3Indicator.superlayer == nil {
|
||||
self.layer.addSublayer(l3r3Indicator)
|
||||
@@ -1165,7 +1184,7 @@ import SVGKit
|
||||
lrudIndicatorBall.shadowRadius = 0;
|
||||
lrudIndicatorBall.shadowOpacity = 0.8
|
||||
lrudIndicatorBall.name = "lrudBall"
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {lrudIndicatorBall.isHidden = true}
|
||||
if !OnScreenWidgetView.isTweakingHighlight {lrudIndicatorBall.isHidden = true}
|
||||
|
||||
// Set the fill color (inside of the circle)
|
||||
lrudIndicatorBall.fillColor = stickBallColor // Light fill with some transparency
|
||||
@@ -1191,7 +1210,7 @@ import SVGKit
|
||||
|
||||
private func showLrudDirectionIndicator(with indicatorLayer:CAShapeLayer){
|
||||
// show the indicator based on the touchBeganLocation
|
||||
indicatorLayer.position = touchBeganLocation
|
||||
indicatorLayer.position = touchCenteredOffset ? touchBeganLocation : CGPoint(x: self.bounds.midX, y: self.bounds.midY)
|
||||
|
||||
if indicatorLayer.isHidden {
|
||||
indicatorLayer.isHidden = false
|
||||
@@ -1208,9 +1227,13 @@ import SVGKit
|
||||
|
||||
let radians = atan2(-offSetY,offSetX)
|
||||
let degrees = radians * 180 / .pi
|
||||
let nearZeroPoint = abs(offSetX) < 16/sensitivityFactorX && abs(offSetY) < 16/sensitivityFactorY
|
||||
|
||||
let nearZeroPoint = sensitivityFactorX == 0 || sensitivityFactorY == 0 ? false : abs(offSetX) < 16/sensitivityFactorX && abs(offSetY) < 16/sensitivityFactorY
|
||||
// NSLog("deltaX: %f, detalY: %f", deltaX, deltaY)
|
||||
|
||||
if self.stickWheelAxis.isHidden {
|
||||
self.stickWheelAxis.isHidden = false
|
||||
}
|
||||
|
||||
var pressedButtonMask = 0;
|
||||
if abs(degrees) < triggeringAngle {
|
||||
@@ -1426,7 +1449,7 @@ import SVGKit
|
||||
if OnScreenWidgetView.buttonVisualFeedbackEnabled {
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {buttonDownVisualEffectLayer.isHidden = true}
|
||||
if !OnScreenWidgetView.isTweakingHighlight {buttonDownVisualEffectLayer.isHidden = true}
|
||||
CATransaction.commit()
|
||||
}
|
||||
}
|
||||
@@ -1449,24 +1472,35 @@ import SVGKit
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
|
||||
self.setupLrudBall()
|
||||
// self.setupLrudBall()
|
||||
|
||||
setupLrudDirectionLayer(directionLayer: upIndicator)
|
||||
upIndicator.anchorPoint = CGPoint(x: 0.5, y: 1)
|
||||
let offset = upIndicator.borderWidth/(2*upIndicator.bounds.width)
|
||||
upIndicator.anchorPoint = CGPoint(x: 0.5, y: 1-offset)
|
||||
setupLrudDirectionLayer(directionLayer: downIndicator)
|
||||
downIndicator.anchorPoint = CGPoint(x: 0.5, y: 0)
|
||||
downIndicator.anchorPoint = CGPoint(x: 0.5, y: 0+offset)
|
||||
setupLrudDirectionLayer(directionLayer: leftIndicator)
|
||||
leftIndicator.anchorPoint = CGPoint(x: 1, y: 0.5)
|
||||
leftIndicator.anchorPoint = CGPoint(x: 1-offset, y: 0.5)
|
||||
setupLrudDirectionLayer(directionLayer: rightIndicator)
|
||||
rightIndicator.anchorPoint = CGPoint(x: 0, y: 0.5)
|
||||
rightIndicator.anchorPoint = CGPoint(x: 0+offset, y: 0.5)
|
||||
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {
|
||||
if !OnScreenWidgetView.isTweakingHighlight {
|
||||
leftIndicator.isHidden = true
|
||||
rightIndicator.isHidden = true
|
||||
upIndicator.isHidden = true
|
||||
downIndicator.isHidden = true
|
||||
}
|
||||
|
||||
if !touchCenteredOffset {
|
||||
let axisdiameter = self.getDiameter(lengthFactor: 0.35)
|
||||
let axisSize = CGSize(width: axisdiameter, height: axisdiameter)
|
||||
self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis-0.75.svg", in: self.layer, targetSize: axisSize)
|
||||
GraphicUtils.changeColor(layer: self.stickWheelAxis, color: UIColor(white: 1, alpha: 0.6))
|
||||
self.stickWheelAxis.removeFromSuperlayer()
|
||||
self.layer.addSublayer(self.stickWheelAxis)
|
||||
self.stickWheelAxis.isHidden = false
|
||||
}
|
||||
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
@@ -1511,7 +1545,7 @@ import SVGKit
|
||||
}
|
||||
|
||||
buttonDownVisualEffectLayer.position = CGPointMake(self.bounds.midX, self.bounds.midY)
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {buttonDownVisualEffectLayer.isHidden = true}
|
||||
if !OnScreenWidgetView.isTweakingHighlight {buttonDownVisualEffectLayer.isHidden = true}
|
||||
|
||||
CATransaction.commit()
|
||||
}
|
||||
@@ -1714,7 +1748,16 @@ import SVGKit
|
||||
self.showl3r3Indicator()
|
||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
||||
case "DPAD", "WASDPAD", "ARROWPAD":
|
||||
if allSpawnedTouchesCount == 1 {showLrudBall(at: touchBeganLocation)}
|
||||
if allSpawnedTouchesCount == 1 {
|
||||
// showLrudBall(at: touchBeganLocation)
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
self.stickWheelAxis.position = touchCenteredOffset ? touchBeganLocation : CGPoint(x: self.bounds.midX, y: self.bounds.midY)
|
||||
self.stickWheelAxis.isHidden = false
|
||||
CATransaction.commit()
|
||||
self.getVector(touch: touches.first!)
|
||||
self.handleLrudTouchMove()
|
||||
}
|
||||
if quickDoubleTapDetected {
|
||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
||||
DispatchQueue.global(qos: .userInteractive).async {
|
||||
@@ -1960,9 +2003,10 @@ import SVGKit
|
||||
self.inertialScroller.vector = UITouchUtil.vector(of: touch, in: self)
|
||||
}
|
||||
|
||||
let touchCentered = !self.isStickWheel
|
||||
self.offSetX = touchCentered ? currentTouchLocation.x - self.touchBeganLocation.x : currentTouchLocation.x - self.bounds.midX
|
||||
self.offSetY = touchCentered ? currentTouchLocation.y - self.touchBeganLocation.y : currentTouchLocation.y - self.bounds.midY
|
||||
touchCenteredOffset = (!self.isStickWheel
|
||||
&& !(self.isDirectionPad && sensitivityFactorX==0 && sensitivityFactorY==0))
|
||||
self.offSetX = touchCenteredOffset ? currentTouchLocation.x - self.touchBeganLocation.x : currentTouchLocation.x - self.bounds.midX
|
||||
self.offSetY = touchCenteredOffset ? currentTouchLocation.y - self.touchBeganLocation.y : currentTouchLocation.y - self.bounds.midY
|
||||
}
|
||||
|
||||
private func updateTouchLocation(touch: UITouch){
|
||||
@@ -2337,16 +2381,19 @@ import SVGKit
|
||||
case "RTPAD":
|
||||
self.onScreenControls.updateRightTrigger(0x00)
|
||||
case "WASDPAD":
|
||||
self.stickWheelAxis.isHidden = touchCenteredOffset
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["W"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["A"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["S"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["D"]!,Int8(KEY_ACTION_UP), 0)
|
||||
case "ARROWPAD":
|
||||
self.stickWheelAxis.isHidden = touchCenteredOffset
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["LEFT_ARROW"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["RIGHT_ARROW"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["UP_ARROW"]!,Int8(KEY_ACTION_UP), 0)
|
||||
LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["DOWN_ARROW"]!,Int8(KEY_ACTION_UP), 0)
|
||||
case "DPAD":
|
||||
self.stickWheelAxis.isHidden = touchCenteredOffset
|
||||
self.onScreenControls.releaseControllerButton(LEFT_FLAG)
|
||||
self.onScreenControls.releaseControllerButton(RIGHT_FLAG)
|
||||
self.onScreenControls.releaseControllerButton(UP_FLAG)
|
||||
@@ -2358,7 +2405,7 @@ import SVGKit
|
||||
}
|
||||
}
|
||||
|
||||
if !OnScreenWidgetView.isTweakingHighlightSize {
|
||||
if !OnScreenWidgetView.isTweakingHighlight {
|
||||
if CommandManager.stickTouchPads.contains(touchPadString){
|
||||
self.l3r3Indicator.isHidden = true
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
|
||||
|
||||
- (void) clearOnScreenWidgets{
|
||||
OnScreenWidgetView.isTweakingHighlightSize = false;
|
||||
OnScreenWidgetView.isTweakingHighlight = false;
|
||||
for (UIView *subview in self->streamFrameTopLayerView.subviews) {
|
||||
// 检查子视图是否是特定类型的实例
|
||||
if ([subview isKindOfClass:[OnScreenWidgetView class]]) {
|
||||
@@ -588,6 +588,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
[widgetView adjustBorderWithWidth:buttonState.borderWidth];
|
||||
[widgetView tweakLabelAlphaWithAlpha:buttonState.labelAlpha];
|
||||
[widgetView tweakBorderAlphaWithAlpha:buttonState.borderAlpha];
|
||||
[widgetView tweakHighlightAlphaWithAlpha:buttonState.highlightAlpha];
|
||||
[widgetView setupAutoTapTimer];
|
||||
[widgetView setupInertialScroller];
|
||||
}
|
||||
|
||||
@@ -2990,6 +2990,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Highlight alpha: %.2f" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "高亮透明度: %.2f"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "高亮透明度: %.2f"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "高亮透明度: %.2f"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Highlight size: %.2f" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<svg width="860" height="860" viewBox="0 0 860 860" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_3_30)">
|
||||
<path opacity="0.75" d="M430 45.3164C642.136 45.3164 814.471 217.345 814.471 430C814.471 642.656 642.136 814.684 430 814.684C217.864 814.684 45.5294 642.656 45.5294 430C45.5294 217.345 217.864 45.3164 430 45.3164Z" stroke="white" stroke-width="90"/>
|
||||
<path opacity="0.75" d="M430 122.855L508.859 213.488H351.141L430 122.855Z" fill="#D9D9D9"/>
|
||||
<path opacity="0.75" d="M430 737.144L351.141 646.512H508.859L430 737.144Z" fill="#D9D9D9"/>
|
||||
<path opacity="0.75" d="M738.588 430.001L647.529 508.491V351.512L738.588 430.001Z" fill="#D9D9D9"/>
|
||||
<path opacity="0.75" d="M121.412 430.001L212.471 351.512V508.491L121.412 430.001Z" fill="#D9D9D9"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_3_30">
|
||||
<rect width="860" height="860" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 879 B |
+48
-9
@@ -25,6 +25,7 @@ typedef NS_ENUM(NSUInteger, AlphaSliderMode) {
|
||||
widgetAlpha,
|
||||
labelAlpha,
|
||||
borderAlpha,
|
||||
highlightAlpha,
|
||||
AlphaSliderModeCount
|
||||
};
|
||||
|
||||
@@ -87,7 +88,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
|
||||
- (void) viewWillDisappear:(BOOL)animated{
|
||||
OnScreenWidgetView.editMode = false;
|
||||
OnScreenWidgetView.isTweakingHighlightSize = false;
|
||||
OnScreenWidgetView.isTweakingHighlight = false;
|
||||
[super viewWillDisappear:animated];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
|
||||
}
|
||||
@@ -125,7 +126,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
|
||||
- (void)reloadOnScreenWidgetViews{
|
||||
NSLog(@"reloadOnScreenWidgets %f", CACurrentMediaTime());
|
||||
OnScreenWidgetView.isTweakingHighlightSize = false;
|
||||
OnScreenWidgetView.isTweakingHighlight = false;
|
||||
OnScreenWidgetView.editMode = true;
|
||||
[self hideStickIndicators];
|
||||
|
||||
@@ -180,6 +181,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
[widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha tweakBorderAlpha:NO];
|
||||
[widgetView tweakLabelAlphaWithAlpha:buttonState.labelAlpha];
|
||||
[widgetView tweakBorderAlphaWithAlpha:buttonState.borderAlpha];
|
||||
[widgetView tweakHighlightAlphaWithAlpha:buttonState.highlightAlpha];
|
||||
[widgetView adjustBorderWithWidth:buttonState.borderWidth];
|
||||
[self.onScreenWidgetViews addObject:widgetView];
|
||||
}
|
||||
@@ -366,24 +368,50 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
- (void)switchAlphaSlider:(UITapGestureRecognizer *)sender {
|
||||
if(!widgetViewSelected) return;
|
||||
alphaSliderMode = (alphaSliderMode + 1) % AlphaSliderModeCount;
|
||||
OnScreenWidgetView.isTweakingHighlight = alphaSliderMode == highlightAlpha || borderWidthSliderMode == hightlightSize;
|
||||
[self loadWidgetAlphas];
|
||||
}
|
||||
|
||||
- (void)setHiddenForWidgetHighlights{
|
||||
selectedWidgetView.buttonDownVisualEffectLayer.hidden = !OnScreenWidgetView.isTweakingHighlight;
|
||||
selectedWidgetView.l3r3Indicator.hidden = !selectedWidgetView.hasL3R3Indicator || !OnScreenWidgetView.isTweakingHighlight;
|
||||
(selectedWidgetView.lrudIndicatorBall.hidden
|
||||
= selectedWidgetView.upIndicator.hidden
|
||||
= selectedWidgetView.downIndicator.hidden
|
||||
= selectedWidgetView.leftIndicator.hidden
|
||||
= selectedWidgetView.rightIndicator.hidden
|
||||
= !selectedWidgetView.isDirectionPad
|
||||
&& !OnScreenWidgetView.isTweakingHighlight);
|
||||
}
|
||||
|
||||
- (void)loadWidgetAlphas{
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
[self setHiddenForWidgetHighlights];
|
||||
switch(alphaSliderMode){
|
||||
case widgetAlpha:
|
||||
[self.widgetAlphaSlider setMaximumValue:1];
|
||||
[self.widgetAlphaSlider setMinimumValue:-1];
|
||||
[self.widgetAlphaSlider setValue: self->selectedWidgetView.backgroundAlpha];
|
||||
[self.widgetAlphaLabel setText:[LocalizationHelper localizedStringForKey:@"Alpha: %.2f", _widgetAlphaSlider.value]];
|
||||
break;
|
||||
case labelAlpha:
|
||||
[self.widgetAlphaSlider setMaximumValue:1];
|
||||
[self.widgetAlphaSlider setMinimumValue:-1];
|
||||
[self.widgetAlphaSlider setValue: self->selectedWidgetView.labelAlpha];
|
||||
[self.widgetAlphaLabel setText:[LocalizationHelper localizedStringForKey:@"Label alpha: %.2f", _widgetAlphaSlider.value]];
|
||||
break;
|
||||
case borderAlpha:
|
||||
[self.widgetAlphaSlider setMaximumValue:1];
|
||||
[self.widgetAlphaSlider setMinimumValue:-1];
|
||||
[self.widgetAlphaSlider setValue: self->selectedWidgetView.borderAlpha];
|
||||
[self.widgetAlphaLabel setText:[LocalizationHelper localizedStringForKey:@"Border alpha: %.2f", _widgetAlphaSlider.value]];
|
||||
break;
|
||||
case highlightAlpha:
|
||||
[self.widgetAlphaSlider setMaximumValue:1];
|
||||
[self.widgetAlphaSlider setMinimumValue:0];
|
||||
[self.widgetAlphaSlider setValue: self->selectedWidgetView.highlightAlpha];
|
||||
[self.widgetAlphaLabel setText:[LocalizationHelper localizedStringForKey:@"Highlight alpha: %.2f", _widgetAlphaSlider.value]];
|
||||
break;
|
||||
case AlphaSliderModeCount:
|
||||
default:
|
||||
break;
|
||||
@@ -400,18 +428,20 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
- (void)switchBorderWidthSlider:(UITapGestureRecognizer *)sender {
|
||||
if(!widgetViewSelected) return;
|
||||
borderWidthSliderMode = (borderWidthSliderMode + 1) % BorderWidthSliderModeCount;
|
||||
OnScreenWidgetView.isTweakingHighlightSize = borderWidthSliderMode == hightlightSize;
|
||||
OnScreenWidgetView.isTweakingHighlight = alphaSliderMode == highlightAlpha || borderWidthSliderMode == hightlightSize;
|
||||
[self loadWidgetWidths];
|
||||
}
|
||||
|
||||
- (void)loadWidgetWidths{
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
[self setHiddenForWidgetHighlights];
|
||||
switch(borderWidthSliderMode){
|
||||
case widgetBorderWidth:
|
||||
[self.widgetBorderWidthSlider setMinimumValue:0];
|
||||
[self.widgetBorderWidthSlider setMaximumValue:8];
|
||||
[self.widgetBorderWidthSlider setValue:selectedWidgetView.borderWidth animated:NO];
|
||||
|
||||
/*
|
||||
selectedWidgetView.buttonDownVisualEffectLayer.hidden = true;
|
||||
selectedWidgetView.l3r3Indicator.hidden = true;
|
||||
|
||||
@@ -420,7 +450,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
= selectedWidgetView.downIndicator.hidden
|
||||
= selectedWidgetView.leftIndicator.hidden
|
||||
= selectedWidgetView.rightIndicator.hidden
|
||||
= true);
|
||||
= true); */
|
||||
|
||||
[self.widgetBorderWidthLabel setText:[LocalizationHelper localizedStringForKey:@"Border width: %.2f", _widgetBorderWidthSlider.value]];
|
||||
break;
|
||||
@@ -429,15 +459,17 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
[self.widgetBorderWidthSlider setMinimumValue:0];
|
||||
[self.widgetBorderWidthSlider setMaximumValue:2];
|
||||
[self.widgetBorderWidthSlider setValue:selectedWidgetView.highlightSizeFactor animated:NO];
|
||||
selectedWidgetView.buttonDownVisualEffectLayer.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton;
|
||||
selectedWidgetView.l3r3Indicator.hidden = !selectedWidgetView.hasL3R3Indicator;
|
||||
/*
|
||||
selectedWidgetView.buttonDownVisualEffectLayer.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton && !OnScreenWidgetView.isTweakingHighlight;
|
||||
selectedWidgetView.l3r3Indicator.hidden = !selectedWidgetView.hasL3R3Indicator && !OnScreenWidgetView.isTweakingHighlight;
|
||||
|
||||
(selectedWidgetView.lrudIndicatorBall.hidden
|
||||
= selectedWidgetView.upIndicator.hidden
|
||||
= selectedWidgetView.downIndicator.hidden
|
||||
= selectedWidgetView.leftIndicator.hidden
|
||||
= selectedWidgetView.rightIndicator.hidden
|
||||
= !selectedWidgetView.isDirectionPad);
|
||||
= !selectedWidgetView.isDirectionPad
|
||||
&& !OnScreenWidgetView.isTweakingHighlight); */
|
||||
|
||||
[self.widgetBorderWidthLabel setText:[LocalizationHelper localizedStringForKey:@"Highlight size: %.2f", _widgetBorderWidthSlider.value]];
|
||||
break;
|
||||
@@ -773,6 +805,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
[newWidget adjustTransparencyWithAlpha:widget.backgroundAlpha tweakBorderAlpha:NO];
|
||||
[newWidget tweakLabelAlphaWithAlpha:widget.labelAlpha];
|
||||
[newWidget tweakBorderAlphaWithAlpha:widget.borderAlpha];
|
||||
[newWidget tweakHighlightAlphaWithAlpha:widget.highlightAlpha];
|
||||
[newWidget adjustBorderWithWidth:widget.borderWidth];
|
||||
[self.onScreenWidgetViews addObject:newWidget];
|
||||
self->selectedWidgetView = newWidget;
|
||||
@@ -996,10 +1029,8 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
[self loadWidgetAlphas];
|
||||
[self autoFitLabel:self.widgetAlphaLabel];
|
||||
|
||||
// [self.widgetBorderWidthSlider setValue:self->selectedWidgetView.borderWidth];
|
||||
[self loadWidgetWidths];
|
||||
[self autoFitLabel:self.widgetBorderWidthLabel];
|
||||
// [self widgetBorderWidthSliderMoved:self.widgetBorderWidthSlider];
|
||||
|
||||
self.autoTapStack.hidden = !selectedWidgetView.hasAutoTap;
|
||||
// [self.autoTapSlider setValue:self->selectedWidgetView.autoTapInterval];
|
||||
@@ -1117,6 +1148,9 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
|
||||
|
||||
- (void)widgetAlphaSliderMoved:(UISlider* )sender{
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
switch(alphaSliderMode){
|
||||
case widgetAlpha:
|
||||
@@ -1128,6 +1162,9 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
case borderAlpha:
|
||||
[self->selectedWidgetView tweakBorderAlphaWithAlpha:sender.value];
|
||||
break;
|
||||
case highlightAlpha:
|
||||
[self->selectedWidgetView tweakHighlightAlphaWithAlpha:sender.value];
|
||||
break;
|
||||
case AlphaSliderModeCount:
|
||||
default:
|
||||
break;
|
||||
@@ -1138,6 +1175,8 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
||||
[self.layoutOSC adjustControllerLayerOpacityWith:self->selectedControllerLayer and:sender.value];
|
||||
}
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
- (void)widgetBorderWidthSliderMoved:(UISlider* )sender{
|
||||
|
||||
Reference in New Issue
Block a user