adjustable onScreenButtonView alpha(transparency)
This commit is contained in:
@@ -838,18 +838,24 @@ ICAgICAgICAgICAgICA
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="60" maxValue="390" id="Efn-Si-TPp" userLabel="Button Size Slider">
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="Efn-Si-TPp" userLabel="Button Size Slider">
|
||||
<rect key="frame" x="205" y="172" width="420" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
|
||||
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</slider>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="60" maxValue="390" id="ZOF-sL-e7p" userLabel="Button Height Slider">
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="ZOF-sL-e7p" userLabel="Button Height Slider">
|
||||
<rect key="frame" x="205" y="211" width="420" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
|
||||
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</slider>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.001" maxValue="1" id="ZLL-pE-iZh" userLabel="Button Alpha Slider">
|
||||
<rect key="frame" x="207" y="249" width="420" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
|
||||
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</slider>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
@@ -861,6 +867,7 @@ ICAgICAgICAgICAgICA
|
||||
<toolbarItems/>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="buttonAndControllerAlphaSlider" destination="ZLL-pE-iZh" id="5OX-P6-YKt"/>
|
||||
<outlet property="buttonAndControllerHeightSlider" destination="ZOF-sL-e7p" id="OHK-5i-3RY"/>
|
||||
<outlet property="buttonAndControllerSizeSlider" destination="Efn-Si-TPp" id="CgK-cC-Yo0"/>
|
||||
<outlet property="chevronImageView" destination="iVZ-Fd-dY7" id="403-Nj-wRx"/>
|
||||
@@ -951,13 +958,13 @@ ICAgICAgICAgICAgICA
|
||||
<image name="SquaresArrowUp" width="40" height="40"/>
|
||||
<image name="Trash" width="40" height="40"/>
|
||||
<systemColor name="secondaryLabelColor">
|
||||
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="tintColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="viewFlipsideBackgroundColor">
|
||||
<color red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
|
||||
@@ -286,6 +286,7 @@ static NSMutableDictionary *onScreenButtonViewsDict;
|
||||
buttonState.timestamp = buttonView.timestamp;
|
||||
buttonState.widthFactor = buttonView.widthFactor;
|
||||
buttonState.heightFactor = buttonView.heightFactor;
|
||||
buttonState.backgroundAlpha = buttonView.backgroundAlpha;
|
||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
}];
|
||||
|
||||
@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer
|
||||
@property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer
|
||||
|
||||
// @property (nonatomic, assign) BOOL hasValidPosition;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
[encoder encodeFloat:self.widthFactor forKey:@"widthFactor"];
|
||||
[encoder encodeFloat:self.heightFactor forKey:@"heightFactor"];
|
||||
[encoder encodeFloat:self.oscLayerSizeFactor forKey:@"oscLayerSizeFactor"];
|
||||
[encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"];
|
||||
}
|
||||
|
||||
- (id) initWithCoder:(NSCoder*)decoder {
|
||||
@@ -49,6 +50,7 @@
|
||||
self.widthFactor = [decoder decodeFloatForKey:@"widthFactor"];
|
||||
self.heightFactor = [decoder decodeFloatForKey:@"heightFactor"];
|
||||
self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"];
|
||||
self.backgroundAlpha = [decoder decodeFloatForKey:@"backgroundAlpha"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -18,21 +18,24 @@ import UIKit
|
||||
@objc public var pressed: Bool
|
||||
@objc public var widthFactor: CGFloat
|
||||
@objc public var heightFactor: CGFloat
|
||||
@objc public var backgroundAlpha: CGFloat
|
||||
|
||||
private let label: UILabel
|
||||
private let originalBackgroundColor: UIColor
|
||||
// private let originalBackgroundColor: UIColor
|
||||
private var storedLocation: CGPoint = .zero
|
||||
private let minimumBorderAlpha: CGFloat = 0.19
|
||||
|
||||
|
||||
@objc init(keyString: String, keyLabel: String) {
|
||||
self.keyString = keyString
|
||||
self.keyLabel = keyLabel
|
||||
self.label = UILabel()
|
||||
self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7)
|
||||
// self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7)
|
||||
self.timestamp = 0
|
||||
self.pressed = false
|
||||
self.widthFactor = 1.0
|
||||
self.heightFactor = 1.0
|
||||
self.backgroundAlpha = 0.5
|
||||
super.init(frame: .zero)
|
||||
setupView()
|
||||
}
|
||||
@@ -52,6 +55,23 @@ import UIKit
|
||||
OnScreenButtonView.editMode = enabled
|
||||
}
|
||||
|
||||
@objc public func adjustButtonTransparency(alpha: CGFloat){
|
||||
if(alpha != 0){
|
||||
self.backgroundAlpha = alpha
|
||||
}
|
||||
else{
|
||||
self.backgroundAlpha = 0.5
|
||||
}
|
||||
|
||||
var borderAlpha = 1.5 * self.backgroundAlpha
|
||||
if(borderAlpha < minimumBorderAlpha){
|
||||
borderAlpha = minimumBorderAlpha
|
||||
}
|
||||
|
||||
self.backgroundColor = UIColor(white: 0.2, alpha: self.backgroundAlpha)
|
||||
self.layer.borderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
|
||||
}
|
||||
|
||||
@objc public func resizeButtonView(){
|
||||
guard let superview = superview else { return }
|
||||
|
||||
@@ -83,6 +103,8 @@ import UIKit
|
||||
setupView()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@objc public func setupView() {
|
||||
label.text = self.keyLabel
|
||||
label.font = UIFont.boldSystemFont(ofSize: 19)
|
||||
@@ -97,17 +119,21 @@ import UIKit
|
||||
label.translatesAutoresizingMaskIntoConstraints = false // enable auto alignment for the label
|
||||
|
||||
self.translatesAutoresizingMaskIntoConstraints = true // this is mandatory to prevent unexpected key view location change
|
||||
self.layer.borderColor = UIColor(white: 0.2, alpha: 0.86).cgColor
|
||||
var borderAlpha = 1.5 * self.backgroundAlpha
|
||||
if(borderAlpha < minimumBorderAlpha){
|
||||
borderAlpha = minimumBorderAlpha
|
||||
}
|
||||
// if(self.backgroundAlpha * )
|
||||
self.layer.borderColor = UIColor(white: 0.2, alpha: borderAlpha).cgColor
|
||||
self.layer.borderWidth = 1
|
||||
self.layer.cornerRadius = 20
|
||||
self.backgroundColor = UIColor(white: 0.2, alpha: 0.57)
|
||||
self.backgroundColor = UIColor(white: 0.2, alpha: self.backgroundAlpha)
|
||||
self.layer.shadowColor = UIColor.clear.cgColor
|
||||
self.layer.shadowRadius = 8
|
||||
self.layer.shadowOpacity = 0.5
|
||||
|
||||
addSubview(label)
|
||||
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
//self.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width * 0.088),
|
||||
//self.heightAnchor.constraint(equalToConstant: UIScreen.main.bounds.height * 0.1),
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
|
||||
andConfig:(StreamConfiguration*)streamConfig;
|
||||
- (void) clearOnScreenKeyboardButtons;
|
||||
- (void) reloadOnScreenKeyboardButtons;
|
||||
- (void) reloadOnScreenButtonViews;
|
||||
|
||||
- (CGSize) getVideoAreaSize;
|
||||
- (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point;
|
||||
|
||||
@@ -363,7 +363,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) reloadOnScreenKeyboardButtons{
|
||||
- (void) reloadOnScreenButtonViews{
|
||||
|
||||
NSLog(@"reload on screen keyboard buttons here");
|
||||
|
||||
@@ -389,6 +389,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
[self->streamFrameTopLayerView addSubview:buttonView]; // add keyboard button to the stream frame view. must add it to the target view before setting location.
|
||||
[buttonView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
|
||||
[buttonView resizeButtonView]; // resize must be called after relocation
|
||||
[buttonView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +237,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Button Alpha" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "按键透明度"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "按键透明度"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "按键透明度"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Button Height" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
+2
-1
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@interface LayoutOnScreenControlsViewController : UIViewController
|
||||
- (void)profileRefresh;
|
||||
- (void)reloadOnScreenKeyboardButtons;
|
||||
- (void)reloadOnScreenButtonViews;
|
||||
|
||||
@property LayoutOnScreenControls *layoutOSC; // object that contains a view which contains the on screen controller buttons that allows the user to drag and positions each button on the screen using touch
|
||||
@property (nonatomic) NSMutableDictionary* onScreenButtonViewsDict;
|
||||
@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (strong, nonatomic) IBOutlet UILabel *currentProfileLabel;
|
||||
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerSizeSlider;
|
||||
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerHeightSlider;
|
||||
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerAlphaSlider;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+60
-19
@@ -31,6 +31,7 @@
|
||||
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad;
|
||||
UILabel *buttonSizeSliderLabel;
|
||||
UILabel *buttonHeightSliderLabel;
|
||||
UILabel *buttonAlphaSliderLabel;
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
|
||||
}
|
||||
|
||||
- (void) reloadOnScreenKeyboardButtons {
|
||||
- (void) reloadOnScreenButtonViews {
|
||||
for (UIView *subview in self.view.subviews) {
|
||||
// 检查子视图是否是特定类型的实例
|
||||
if ([subview isKindOfClass:[OnScreenButtonView class]]) {
|
||||
@@ -71,10 +72,12 @@
|
||||
buttonView.timestamp = buttonState.timestamp; // will be set as key in in the dict.
|
||||
buttonView.widthFactor = buttonState.widthFactor;
|
||||
buttonView.heightFactor = buttonState.heightFactor;
|
||||
// buttonView.backgroundAlpha = buttonState.backgroundAlpha;
|
||||
// Add the buttonView to the view controller's view
|
||||
[self.view addSubview:buttonView];
|
||||
[buttonView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
|
||||
[buttonView resizeButtonView]; // resize must be called after relocation
|
||||
[buttonView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
||||
[self.onScreenButtonViewsDict setObject:buttonView forKey:@(buttonView.timestamp)];
|
||||
}
|
||||
}
|
||||
@@ -89,6 +92,10 @@
|
||||
|
||||
isToolbarHidden = NO; // keeps track if the toolbar is hidden up above the screen so that we know whether to hide or show it when the user taps the toolbar's hide/show button
|
||||
|
||||
buttonSizeSliderLabel = [[UILabel alloc] init];
|
||||
buttonHeightSliderLabel = [[UILabel alloc] init];
|
||||
buttonAlphaSliderLabel = [[UILabel alloc] init];
|
||||
|
||||
/* add curve to bottom of chevron tab view */
|
||||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.chevronView.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];
|
||||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||||
@@ -126,17 +133,17 @@
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(reloadOnScreenKeyboardButtons)
|
||||
selector:@selector(reloadOnScreenButtonViews)
|
||||
name:@"OscLayoutProfileSelctedInTableView" // This is a special notification for reloading the on screen keyboard buttons. which can't be executed by _oscProfilesTableViewController.needToUpdateOscLayoutTVC code block, and has to be triggered by a notification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(setButtonViewSizeSliderValues:)
|
||||
selector:@selector(setButtonViewSliderValues:)
|
||||
name:@"OnScreenButtonViewSelected"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(setControllerCALayerSizeSliderValues:)
|
||||
selector:@selector(setControllerCALayerSliderValues:)
|
||||
name:@"ControllerCALayerSelected"
|
||||
object:nil];
|
||||
|
||||
@@ -365,18 +372,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setButtonViewSizeSliderValues: (NSNotification *)notification{
|
||||
- (void)setButtonViewSliderValues: (NSNotification *)notification{
|
||||
// receive the selected buttonView obj passed from the notification
|
||||
OnScreenButtonView* buttonView = (OnScreenButtonView* )notification.object;
|
||||
self->buttonViewSelected = true;
|
||||
self->controllerLayerSelected = false;
|
||||
self->selectedButtonView = buttonView;
|
||||
// setup slider values
|
||||
[self.buttonAndControllerSizeSlider setValue:100 * self->selectedButtonView.widthFactor];
|
||||
[self.buttonAndControllerHeightSlider setValue:100 * self->selectedButtonView.heightFactor];
|
||||
[self.buttonAndControllerSizeSlider setValue: self->selectedButtonView.widthFactor];
|
||||
[self.buttonAndControllerHeightSlider setValue: self->selectedButtonView.heightFactor];
|
||||
[self.buttonAndControllerAlphaSlider setValue: self->selectedButtonView.backgroundAlpha];
|
||||
}
|
||||
|
||||
- (void)setControllerCALayerSizeSliderValues: (NSNotification *)notification{
|
||||
- (void)setControllerCALayerSliderValues: (NSNotification *)notification{
|
||||
// receive the selected buttonView obj passed from the notification
|
||||
CALayer* controllerLayer = (CALayer* )notification.object;
|
||||
self->buttonViewSelected = false;
|
||||
@@ -386,21 +394,22 @@
|
||||
CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds.
|
||||
|
||||
// setup slider values
|
||||
[self.buttonAndControllerSizeSlider setValue:100 * sizeFactor];
|
||||
[self.buttonAndControllerSizeSlider setValue: sizeFactor];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)buttonAndControllerWidthSliderMoved{
|
||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
||||
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
||||
// when adjusting width, the buttonView height will be syncronized
|
||||
self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.buttonAndControllerSizeSlider.value / 100;
|
||||
self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.buttonAndControllerSizeSlider.value;
|
||||
[self.buttonAndControllerHeightSlider setValue: self.buttonAndControllerSizeSlider.value];
|
||||
[self->selectedButtonView resizeButtonView];
|
||||
}
|
||||
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
||||
[self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.buttonAndControllerSizeSlider.value/100];
|
||||
[self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.buttonAndControllerSizeSlider.value];
|
||||
return;
|
||||
|
||||
CALayer* superLayer = self->selectedControllerLayer.superlayer;
|
||||
@@ -414,7 +423,7 @@
|
||||
[self->selectedControllerLayer.name isEqualToString:@"xButton"] ||
|
||||
[self->selectedControllerLayer.name isEqualToString:@"yButton"]){
|
||||
[self->selectedControllerLayer removeFromSuperlayer];
|
||||
self->selectedControllerLayer.bounds = CGRectMake(0, 0, self.layoutOSC.standardRoundButtonBounds.size.width * self.buttonAndControllerSizeSlider.value/100, self.layoutOSC.standardRoundButtonBounds.size.height * self.buttonAndControllerSizeSlider.value/100);
|
||||
self->selectedControllerLayer.bounds = CGRectMake(0, 0, self.layoutOSC.standardRoundButtonBounds.size.width * self.buttonAndControllerSizeSlider.value, self.layoutOSC.standardRoundButtonBounds.size.height * self.buttonAndControllerSizeSlider.value);
|
||||
[superLayer addSublayer:self->selectedControllerLayer];
|
||||
}
|
||||
}
|
||||
@@ -424,11 +433,17 @@
|
||||
- (void)buttonAndControllerHeightSliderMoved{
|
||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
||||
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
||||
self->selectedButtonView.heightFactor = self.buttonAndControllerHeightSlider.value / 100;
|
||||
self->selectedButtonView.heightFactor = self.buttonAndControllerHeightSlider.value;
|
||||
[self->selectedButtonView resizeButtonView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)buttonAndControllerAlphaSliderMoved{
|
||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
||||
[self->selectedButtonView adjustButtonTransparencyWithAlpha:self.buttonAndControllerAlphaSlider.value];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
- (void)setupProfileLableAndSliders{
|
||||
CGFloat xPosition = (self.view.bounds.size.width - self.currentProfileLabel.frame.size.width) / 2;
|
||||
@@ -441,11 +456,10 @@
|
||||
self.buttonAndControllerSizeSlider.hidden = NO;
|
||||
self.buttonAndControllerSizeSlider.frame = CGRectMake(xPosition, self.buttonAndControllerSizeSlider.frame.origin.y, self.buttonAndControllerSizeSlider.frame.size.width, self.buttonAndControllerSizeSlider.frame.size.height);
|
||||
[self.buttonAndControllerSizeSlider addTarget:self action:@selector(buttonAndControllerWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)];
|
||||
buttonSizeSliderLabel = [[UILabel alloc] init];
|
||||
buttonSizeSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Button Size"];
|
||||
buttonSizeSliderLabel.font = [UIFont systemFontOfSize:23];
|
||||
buttonSizeSliderLabel.textColor = [UIColor whiteColor];
|
||||
buttonSizeSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
|
||||
buttonSizeSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
|
||||
buttonSizeSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
|
||||
// Add slider and label to the view
|
||||
[self.view addSubview:buttonSizeSliderLabel];
|
||||
@@ -456,18 +470,17 @@
|
||||
// Align vertically with the slider
|
||||
[buttonSizeSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerSizeSlider.centerYAnchor]
|
||||
]];
|
||||
|
||||
buttonSizeSliderLabel.hidden = NO;
|
||||
|
||||
// button height sliders
|
||||
self.buttonAndControllerHeightSlider.hidden = NO;
|
||||
self.buttonAndControllerHeightSlider.frame = CGRectMake(xPosition, self.buttonAndControllerHeightSlider.frame.origin.y, self.buttonAndControllerHeightSlider.frame.size.width, self.buttonAndControllerHeightSlider.frame.size.height);
|
||||
[self.buttonAndControllerHeightSlider addTarget:self action:@selector(buttonAndControllerHeightSliderMoved) forControlEvents:(UIControlEventValueChanged)];
|
||||
// button height label
|
||||
buttonHeightSliderLabel = [[UILabel alloc] init];
|
||||
buttonHeightSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Button Height"];
|
||||
buttonHeightSliderLabel.font = [UIFont systemFontOfSize:23];
|
||||
buttonHeightSliderLabel.textColor = [UIColor whiteColor];
|
||||
buttonHeightSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
|
||||
buttonHeightSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
|
||||
buttonHeightSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
|
||||
// Add slider and label to the view
|
||||
[self.view addSubview:buttonHeightSliderLabel];
|
||||
@@ -478,6 +491,30 @@
|
||||
// Align vertically with the slider
|
||||
[buttonHeightSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerHeightSlider.centerYAnchor]
|
||||
]];
|
||||
buttonHeightSliderLabel.hidden = NO;
|
||||
|
||||
|
||||
self.buttonAndControllerAlphaSlider.hidden = NO;
|
||||
self.buttonAndControllerAlphaSlider.frame = CGRectMake(xPosition, self.buttonAndControllerAlphaSlider.frame.origin.y, self.buttonAndControllerAlphaSlider.frame.size.width, self.buttonAndControllerAlphaSlider.frame.size.height);
|
||||
[self.buttonAndControllerAlphaSlider addTarget:self action:@selector(buttonAndControllerAlphaSliderMoved) forControlEvents:(UIControlEventValueChanged)];
|
||||
|
||||
// button alpha label
|
||||
|
||||
buttonAlphaSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Button Alpha"];
|
||||
buttonAlphaSliderLabel.font = [UIFont systemFontOfSize:23];
|
||||
buttonAlphaSliderLabel.textColor = [UIColor whiteColor];
|
||||
buttonAlphaSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
|
||||
buttonAlphaSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
|
||||
// Add slider and label to the view
|
||||
[self.view addSubview:buttonAlphaSliderLabel];
|
||||
// Use Auto Layout to position the label relative to the slider
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
// Position the label to the left of the slider
|
||||
[buttonAlphaSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerAlphaSlider.leadingAnchor constant:-10],
|
||||
// Align vertically with the slider
|
||||
[buttonAlphaSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerAlphaSlider.centerYAnchor]
|
||||
]];
|
||||
buttonAlphaSliderLabel.hidden = NO;
|
||||
}
|
||||
|
||||
|
||||
@@ -510,7 +547,7 @@
|
||||
};
|
||||
|
||||
[self.oscProfilesTableViewController profileViewRefresh]; // execute this will make sure OSCLayout is updated from persisted profile, not any cache.
|
||||
[self reloadOnScreenKeyboardButtons];
|
||||
[self reloadOnScreenButtonViews];
|
||||
|
||||
// [self presentViewController:vc animated:YES completion:nil];
|
||||
}
|
||||
@@ -541,6 +578,10 @@
|
||||
self.currentProfileLabel.hidden = YES; // Hide Current Profile display before entering the profile table view
|
||||
self.buttonAndControllerSizeSlider.hidden = YES;
|
||||
self.buttonAndControllerHeightSlider.hidden = YES;
|
||||
self.buttonAndControllerAlphaSlider.hidden = YES;
|
||||
buttonSizeSliderLabel.hidden = YES;
|
||||
buttonHeightSliderLabel.hidden = YES;
|
||||
buttonAlphaSliderLabel.hidden = YES;
|
||||
_oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers;
|
||||
[self presentViewController:_oscProfilesTableViewController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
||||
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
||||
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
||||
[self->_streamView reloadOnScreenKeyboardButtons]; //reload keyboard buttons here. the keyboard button view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
|
||||
[self->_streamView reloadOnScreenButtonViews]; //reload keyboard buttons here. the keyboard button view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
|
||||
//reconfig statsOverlay
|
||||
self->_statsUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f
|
||||
target:self
|
||||
@@ -338,7 +338,7 @@
|
||||
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
|
||||
andConfig:(StreamConfiguration*)_streamConfig];
|
||||
[self->_streamView showOnScreenControls];
|
||||
[self->_streamView reloadOnScreenKeyboardButtons]; //update keyboard buttons here
|
||||
[self->_streamView reloadOnScreenButtonViews]; //update keyboard buttons here
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user