diff --git a/Limelight/Base.lproj/iPad.storyboard b/Limelight/Base.lproj/iPad.storyboard index 3029a003..c887646f 100644 --- a/Limelight/Base.lproj/iPad.storyboard +++ b/Limelight/Base.lproj/iPad.storyboard @@ -868,32 +868,32 @@ ICAgICAgICAgICAgICA - + - + - - + + - - + + - + + + + + + + @@ -929,6 +935,7 @@ ICAgICAgICAgICAgICA + diff --git a/Limelight/Base.lproj/iPhone.storyboard b/Limelight/Base.lproj/iPhone.storyboard index 3770cd0c..ab2a8ffd 100644 --- a/Limelight/Base.lproj/iPhone.storyboard +++ b/Limelight/Base.lproj/iPhone.storyboard @@ -732,14 +732,14 @@ ICAgICAgICAgICAgIA - + - + - + - + - + - - + + - - + + - + + + + + + + @@ -919,6 +925,7 @@ ICAgICAgICAgICAgIA + @@ -931,13 +938,14 @@ ICAgICAgICAgICAgIA + - + @@ -1012,13 +1020,13 @@ ICAgICAgICAgICAgIA - + - + diff --git a/Limelight/Input/CommandManager.swift b/Limelight/Input/CommandManager.swift index 7ba17d1e..8767ffef 100644 --- a/Limelight/Input/CommandManager.swift +++ b/Limelight/Input/CommandManager.swift @@ -74,6 +74,14 @@ import UIKit "OSCL2" : 0, "OSCR2" : 0] + @objc public static let oscRectangleButtonCmds: [String] = [ + "OSCUP", + "OSCDOWN", + "OSCLEFT", + "OSCRIGHT", + "OSCSTART", + "OSCSELECT"] + @objc public static let touchPadCmds: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD", "MOUSEPAD", "DPAD", "WASDPAD", "ARROWPAD"] @objc public static let stickTouchPads: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD"] @objc public static let nonVectorStickPads: [String] = ["LSPAD", "RSPAD"] diff --git a/Limelight/Input/CustomOSC/OSCProfilesManager.m b/Limelight/Input/CustomOSC/OSCProfilesManager.m index 69b6da4d..43c527b9 100644 --- a/Limelight/Input/CustomOSC/OSCProfilesManager.m +++ b/Limelight/Input/CustomOSC/OSCProfilesManager.m @@ -290,6 +290,7 @@ static NSMutableDictionary *OnScreenWidgetViewsDict; buttonState.widthFactor = widgetView.widthFactor; buttonState.heightFactor = widgetView.heightFactor; buttonState.backgroundAlpha = widgetView.backgroundAlpha; + buttonState.borderWidth = widgetView.borderWidth; buttonState.sensitivityFactor = widgetView.sensitivityFactor; buttonState.stickIndicatorXOffset = widgetView.stickIndicatorXOffset; diff --git a/Limelight/Input/CustomOSC/OnScreenButtonState.h b/Limelight/Input/CustomOSC/OnScreenButtonState.h index bec0e14c..5fe3eb06 100644 --- a/Limelight/Input/CustomOSC/OnScreenButtonState.h +++ b/Limelight/Input/CustomOSC/OnScreenButtonState.h @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) NSTimeInterval timestamp; @property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView @property (nonatomic, assign) CGFloat heightFactor; // for OnScreenWidgetView +@property (nonatomic, assign) CGFloat borderWidth; // for OnScreenWidgetView @property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenWidgetView @property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenWidgetView diff --git a/Limelight/Input/CustomOSC/OnScreenButtonState.m b/Limelight/Input/CustomOSC/OnScreenButtonState.m index 71f1419f..0bf89321 100644 --- a/Limelight/Input/CustomOSC/OnScreenButtonState.m +++ b/Limelight/Input/CustomOSC/OnScreenButtonState.m @@ -39,6 +39,7 @@ [encoder encodeFloat:self.stickIndicatorXOffset forKey:@"stickIndicatorOffset"]; [encoder encodeFloat:self.oscLayerSizeFactor forKey:@"oscLayerSizeFactor"]; [encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"]; + [encoder encodeFloat:self.borderWidth forKey:@"borderWidth"]; } - (id) initWithCoder:(NSCoder*)decoder { @@ -55,6 +56,7 @@ self.stickIndicatorXOffset = [decoder decodeFloatForKey:@"stickIndicatorOffset"]; self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"]; self.backgroundAlpha = [decoder decodeFloatForKey:@"backgroundAlpha"]; + self.borderWidth = [decoder decodeFloatForKey:@"borderWidth"]; } return self; } diff --git a/Limelight/Input/OnScreenControls.m b/Limelight/Input/OnScreenControls.m index 9f279a26..0ff5ff81 100644 --- a/Limelight/Input/OnScreenControls.m +++ b/Limelight/Input/OnScreenControls.m @@ -1894,9 +1894,9 @@ static float L3_Y; // CALayer* superLayer = layer.superlayer; // if(layerBeingDragged.name == @"") CGFloat targetAlpha; - + targetAlpha = alpha; + if(alpha < 0.23) targetAlpha = 0.23; if(alpha == 0.0 || alpha == 1.0) targetAlpha = 5.0f/6.0f; // invalid alpha value - else targetAlpha = alpha; NSLog(@"alphas: %f",targetAlpha); diff --git a/Limelight/Input/OnScreenWidgetView.swift b/Limelight/Input/OnScreenWidgetView.swift index 4d27820e..0bdf5de2 100644 --- a/Limelight/Input/OnScreenWidgetView.swift +++ b/Limelight/Input/OnScreenWidgetView.swift @@ -27,6 +27,7 @@ import UIKit @objc public var pressed: Bool @objc public var widthFactor: CGFloat = 1.0 @objc public var heightFactor: CGFloat = 1.0 + @objc public var borderWidth: CGFloat = 0.0 @objc public var backgroundAlpha: CGFloat = 0.5 @objc public var latestTouchLocation: CGPoint @objc public var selfViewOnTheRight: Bool = false @@ -153,16 +154,24 @@ import UIKit OnScreenWidgetView.editMode = enabled } - @objc public func adjustButtonTransparency(alpha: CGFloat){ + @objc public func adjustTransparency(alpha: CGFloat){ if alpha != 0 { self.backgroundAlpha = alpha } else{ - self.backgroundAlpha = 0.5 + // self.backgroundAlpha = 0.5 + self.backgroundAlpha = alpha } self.tweakAlpha() } + @objc public func adjustBorder(width: CGFloat){ + self.borderWidth = width + // self.layer.borderWidth = borderWidth + // if CommandManager.touchPadCmds.contains(self.keyString) && width == 0 {self.layer.borderWidth = 1} + setupView() + } + @objc public func resizeWidgetView(){ guard let superview = superview else { return } @@ -173,7 +182,6 @@ import UIKit // To resize the button, we must set this to false temporarily translatesAutoresizingMaskIntoConstraints = false - // replace invalid factor values if self.widthFactor == 0 {self.widthFactor = 1.0} if self.heightFactor == 0 {self.heightFactor = 1.0} @@ -207,7 +215,7 @@ import UIKit } private func changeAndActivateContraints(){ - if CommandManager.oscButtonMappings.keys.contains(self.keyString){ // we'll make custom osc buttons round & smaller + if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString){ // we'll make custom osc buttons round & smaller NSLayoutConstraint.activate([ self.widthAnchor.constraint(equalToConstant: 60 * self.widthFactor), self.heightAnchor.constraint(equalToConstant: 60 * self.heightFactor),]) @@ -244,19 +252,21 @@ import UIKit self.translatesAutoresizingMaskIntoConstraints = true // this is mandatory to prevent unexpected key view location change - self.layer.cornerRadius = 20 - self.layer.borderWidth = 1 + self.layer.cornerRadius = 16 + self.layer.borderWidth = self.borderWidth self.tweakAlpha() - if CommandManager.oscButtonMappings.keys.contains(self.keyString){ //make oscButtons round and no border + if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString){ //make oscButtons round and no border self.layer.cornerRadius = self.frame.width/2 - self.layer.borderWidth = 0 + // self.layer.borderWidth = self.borderWidth label.minimumScaleFactor = 0.15 // Adjust the scale factor for oscButtons label.font = UIFont.boldSystemFont(ofSize: 22) } if CommandManager.touchPadCmds.contains(self.keyString){ + if(self.borderWidth < 1) {self.layer.borderWidth = 1} + else {self.layer.borderWidth = self.borderWidth} label.text = "" // make touchPad display no text if OnScreenWidgetView.editMode { //display label in edit mode to make the pad more visible label.text = self.keyString @@ -634,7 +644,7 @@ import UIKit private func setupButtonDownVisualEffectLayer() { self.buttonDownVisualEffectWidth = 8.6 - if CommandManager.oscButtonMappings.keys.contains(self.keyString) {self.buttonDownVisualEffectWidth = 15.3} // wider visual effect for osc buttons + if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString) {self.buttonDownVisualEffectWidth = 15.3} // wider visual effect for osc buttons // Set the frame to be larger than the view to expand outward buttonDownVisualEffectLayer.borderWidth = 0 // set this 0 to hide the visual effect first diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index bde9bdb0..0b211d9f 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -401,13 +401,15 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place widgetView.widthFactor = buttonState.widthFactor; widgetView.heightFactor = buttonState.heightFactor; + widgetView.borderWidth = buttonState.borderWidth; widgetView.sensitivityFactor = buttonState.sensitivityFactor; widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset; // Add the widgetView to the view controller's view [self->streamFrameTopLayerView addSubview:widgetView]; // add keyboard button to the stream frame view. must add it to the target view before setting location. [widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y]; [widgetView resizeWidgetView]; // resize must be called after relocation - [widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha]; + [widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha]; + [widgetView adjustBorderWithWidth:buttonState.borderWidth]; } } } diff --git a/Limelight/Limelight-Info.plist b/Limelight/Limelight-Info.plist index f29ea4d0..541e31d5 100644 --- a/Limelight/Limelight-Info.plist +++ b/Limelight/Limelight-Info.plist @@ -74,7 +74,7 @@ armv7 UIRequiresFullScreen - + UIStatusBarHidden UISupportedInterfaceOrientations diff --git a/Limelight/Localization/Localizable.xcstrings b/Limelight/Localization/Localizable.xcstrings index 14708128..39e5d0cd 100644 --- a/Limelight/Localization/Localizable.xcstrings +++ b/Limelight/Localization/Localizable.xcstrings @@ -283,6 +283,52 @@ } } }, + "Border Width" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "边界宽度" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "边界宽度" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "边界宽度" + } + } + } + }, + "Border Width: %.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" + } + } + } + }, "Cancel" : { "extractionState" : "manual", "localizations" : { diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h index 5998fc9e..c5a3a8be 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h @@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic) IBOutlet UISlider *widgetAlphaSlider; @property (strong, nonatomic) IBOutlet UISlider *sensitivityFactorSlider; @property (strong, nonatomic) IBOutlet UISlider *stickIndicatorOffsetSlider; +@property (strong, nonatomic) IBOutlet UISlider *widgetBorderWidthSlider; @end diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 19ed2137..9f270401 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -32,6 +32,7 @@ UILabel *widgetSizeSliderLabel; UILabel *widgetHeightSliderLabel; UILabel *widgetAlphaSliderLabel; + UILabel *widgetBorderWidthSliderLabel; UILabel *sensitivitySliderLabel; UILabel *stickIndicatorOffsetSliderLabel; UILabel *stickIndicatorOffsetExplain; @@ -78,6 +79,7 @@ widgetView.timestamp = buttonState.timestamp; // will be set as key in in the dict. widgetView.widthFactor = buttonState.widthFactor; widgetView.heightFactor = buttonState.heightFactor; + widgetView.borderWidth = buttonState.borderWidth; widgetView.sensitivityFactor = buttonState.sensitivityFactor; widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset; // widgetView.backgroundAlpha = buttonState.backgroundAlpha; @@ -85,7 +87,8 @@ [self.view addSubview:widgetView]; [widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y]; [widgetView resizeWidgetView]; // resize must be called after relocation - [widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha]; + [widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha]; + [widgetView adjustBorderWithWidth:buttonState.borderWidth]; [self.OnScreenWidgetViewsDict setObject:widgetView forKey:@(widgetView.timestamp)]; } } @@ -103,6 +106,7 @@ widgetSizeSliderLabel = [[UILabel alloc] init]; widgetHeightSliderLabel = [[UILabel alloc] init]; widgetAlphaSliderLabel = [[UILabel alloc] init]; + widgetBorderWidthSliderLabel = [[UILabel alloc] init]; sensitivitySliderLabel = [[UILabel alloc] init]; stickIndicatorOffsetSliderLabel = [[UILabel alloc] init]; stickIndicatorOffsetExplain = [[UILabel alloc] init]; @@ -399,6 +403,7 @@ [self.widgetSizeSlider setValue: self->selectedWidgetView.widthFactor]; [self.widgetHeightSlider setValue: self->selectedWidgetView.heightFactor]; [self.widgetAlphaSlider setValue: self->selectedWidgetView.backgroundAlpha]; + [self.widgetBorderWidthSlider setValue:self->selectedWidgetView.borderWidth]; NSSet *stickAndMouseTouchpads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", @"LSVPAD", @"RSVPAD", @"MOUSEPAD", nil]; NSSet *nonVectorStickPads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", nil]; @@ -425,6 +430,7 @@ [widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedWidgetView.widthFactor]]; [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedWidgetView.heightFactor]]; [widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedWidgetView.backgroundAlpha]]; + [widgetBorderWidthSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Border Width: %.2f", self->selectedWidgetView.borderWidth]]; } - (void)setControllerCALayerSliderValues: (NSNotification *)notification{ @@ -473,7 +479,7 @@ [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]]; if(self->selectedWidgetView != nil && self->widgetViewSelected){ self->selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change - if([CommandManager.oscButtonMappings.allKeys containsObject:selectedWidgetView.keyString]) return; // don't change custom osc button height + if([CommandManager.oscButtonMappings.allKeys containsObject:selectedWidgetView.keyString] && ![CommandManager.oscRectangleButtonCmds containsObject:selectedWidgetView.keyString]) return; // don't change custom osc button height, except for dPad buttons which are in rectangle shape self->selectedWidgetView.heightFactor = self.widgetHeightSlider.value; [self->selectedWidgetView resizeWidgetView]; } @@ -482,7 +488,7 @@ - (void)widgetAlphaSliderMoved{ [widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.widgetAlphaSlider.value]]; if(self->selectedWidgetView != nil && self->widgetViewSelected){ - [self->selectedWidgetView adjustButtonTransparencyWithAlpha:self.widgetAlphaSlider.value]; + [self->selectedWidgetView adjustTransparencyWithAlpha:self.widgetAlphaSlider.value]; } if(self->selectedControllerLayer != nil && self->controllerLayerSelected){ @@ -491,6 +497,14 @@ return; } +- (void)widgetBorderWidthSliderMoved{ + [widgetBorderWidthSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Border Width: %.2f", self.widgetBorderWidthSlider.value]]; + if(self->selectedWidgetView != nil && self->widgetViewSelected){ + [self->selectedWidgetView adjustBorderWithWidth:self.widgetBorderWidthSlider.value]; + } + return; +} + - (void)sensitivitySliderMoved{ [sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self.sensitivityFactorSlider.value]]; if(self->selectedWidgetView != nil && self->widgetViewSelected) self->selectedWidgetView.sensitivityFactor = self.sensitivityFactorSlider.value; @@ -590,6 +604,27 @@ widgetAlphaSliderLabel.hidden = NO; + // border Width slider + self.widgetBorderWidthSlider.hidden = NO; + self.widgetBorderWidthSlider.frame = CGRectMake(CGRectGetMaxX(self.currentProfileLabel.frame)-self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.origin.y, self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.size.height); + + [self.widgetBorderWidthSlider addTarget:self action:@selector(widgetBorderWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)]; + widgetBorderWidthSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Border Width"]; + widgetBorderWidthSliderLabel.font = [UIFont systemFontOfSize:18]; + widgetBorderWidthSliderLabel.textColor = [UIColor whiteColor]; + widgetBorderWidthSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; + widgetBorderWidthSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout + [self.view addSubview:widgetBorderWidthSliderLabel]; + [NSLayoutConstraint activateConstraints:@[ + // Position the label to the left of the slider + [widgetBorderWidthSliderLabel.trailingAnchor constraintEqualToAnchor:self.widgetBorderWidthSlider.leadingAnchor constant:-10], + // Align vertically with the slider + [widgetBorderWidthSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetBorderWidthSlider.centerYAnchor] + ]]; + widgetBorderWidthSliderLabel.hidden = NO; + + + // sensitivity slider self.sensitivityFactorSlider.hidden = YES; self.sensitivityFactorSlider.frame = CGRectMake(sliderXPosition, self.sensitivityFactorSlider.frame.origin.y, self.sensitivityFactorSlider.frame.size.width, self.sensitivityFactorSlider.frame.size.height); @@ -610,6 +645,7 @@ ]]; sensitivitySliderLabel.hidden = self.sensitivityFactorSlider.hidden; + // stick indicator offset slider self.stickIndicatorOffsetSlider.hidden = YES; self.stickIndicatorOffsetSlider.frame = CGRectMake(sliderXPosition, self.stickIndicatorOffsetSlider.frame.origin.y, self.stickIndicatorOffsetSlider.frame.size.width, self.stickIndicatorOffsetSlider.frame.size.height); // make this label bigger to show some tips