- OnScreenButtonView refactored to OnScreenWidgetView
- oscLayer guideline alignment with onScreenWidgetViews
This commit is contained in:
1 parent
ed3a837200
commit
9b9b278a14
16 files changed
+207
-191
No files matched your search
@@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property UIView* _view;
|
||||
@property NSMutableArray *layoutChanges;
|
||||
@property CALayer *layerBeingDragged;
|
||||
@property UIViewController *layoutToolVC;
|
||||
|
||||
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport
|
||||
streamConfig:(StreamConfiguration*)streamConfig oscLevel:(int)oscLevel;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#import "OSCProfilesTableViewController.h"
|
||||
#import "OnScreenButtonState.h"
|
||||
#import "OSCProfilesManager.h"
|
||||
|
||||
#import "Moonlight-Swift.h"
|
||||
|
||||
@interface LayoutOnScreenControls ()
|
||||
@end
|
||||
@@ -209,30 +209,44 @@
|
||||
-Change horizontal guideline color to white if its y-position is almost equal to that of one of the buttons on screen.
|
||||
-Change vertical guideline color to white if its x-position is almost equal to that of one of the buttons on screen.
|
||||
*/
|
||||
horizontalGuideline.backgroundColor = [UIColor blueColor]; // change horizontal guideline back to blue if it doesn't line up with one of the on screen buttons
|
||||
for (CALayer *button in self.OSCButtonLayers) { // horizontal guideline position check
|
||||
|
||||
if ((layerBeingDragged != button) && !button.isHidden) {
|
||||
if ((horizontalGuideline.center.y < button.position.y + 1) &&
|
||||
(horizontalGuideline.center.y > button.position.y - 1)) {
|
||||
horizontalGuideline.backgroundColor = [UIColor whiteColor];
|
||||
horizontalGuideline.backgroundColor = [UIColor yellowColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
horizontalGuideline.backgroundColor = [UIColor blueColor]; // change horizontal guideline back to blue if it doesn't line up with one of the on screen buttons
|
||||
}
|
||||
for(UIView* view in self.layoutToolVC.view.subviews){
|
||||
if ([view isKindOfClass:[OnScreenWidgetView class]]) {
|
||||
if ((horizontalGuideline.center.y < view.center.y + 1) && (horizontalGuideline.center.y > view.center.y - 1)) {
|
||||
horizontalGuideline.backgroundColor = [UIColor yellowColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
verticalGuideline.backgroundColor = [UIColor blueColor]; // change vertical guideline back to blue if it doesn't line up with one of the on screen buttons
|
||||
for (CALayer *button in self.OSCButtonLayers) { // vertical guideline position check
|
||||
|
||||
if ((layerBeingDragged != button) && !button.isHidden) {
|
||||
if ((verticalGuideline.center.x < button.position.x + 1) &&
|
||||
(verticalGuideline.center.x > button.position.x - 1)) {
|
||||
verticalGuideline.backgroundColor = [UIColor whiteColor];
|
||||
verticalGuideline.backgroundColor = [UIColor yellowColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
verticalGuideline.backgroundColor = [UIColor blueColor]; // change vertical guideline back to blue if it doesn't line up with one of the on screen buttons
|
||||
}
|
||||
for(UIView* view in self.layoutToolVC.view.subviews){
|
||||
if ([view isKindOfClass:[OnScreenWidgetView class]]) {
|
||||
if ((verticalGuideline.center.x < view.center.x + 1) && (verticalGuideline.center.x > view.center.x - 1)) {
|
||||
verticalGuideline.backgroundColor = [UIColor yellowColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
|
||||
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
+ (OSCProfilesManager *) sharedManager;
|
||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict;
|
||||
+ (void) setOnScreenWidgetViewsDict:(NSMutableDictionary* )dict;
|
||||
|
||||
#pragma mark - Getters
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
@implementation OSCProfilesManager
|
||||
|
||||
static NSMutableDictionary *onScreenButtonViewsDict;
|
||||
static NSMutableDictionary *OnScreenWidgetViewsDict;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
@@ -32,8 +32,8 @@ static NSMutableDictionary *onScreenButtonViewsDict;
|
||||
#pragma mark - Class Helper Methods
|
||||
|
||||
|
||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict{
|
||||
onScreenButtonViewsDict = dict;
|
||||
+ (void) setOnScreenWidgetViewsDict:(NSMutableDictionary* )dict{
|
||||
OnScreenWidgetViewsDict = dict;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,17 +281,17 @@ static NSMutableDictionary *onScreenButtonViewsDict;
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
}
|
||||
|
||||
// save on-screen button views (keyboard & mouse command) as buttonstate:
|
||||
[onScreenButtonViewsDict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { // this dict is passed from the layout tool VC, as a static obj in this class.
|
||||
OnScreenButtonView *buttonView = value;
|
||||
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:buttonView.keyString buttonType:KeyboardOrMouseButton andPosition:buttonView.frame.origin];
|
||||
buttonState.alias = buttonView.keyLabel;
|
||||
buttonState.timestamp = buttonView.timestamp;
|
||||
buttonState.widthFactor = buttonView.widthFactor;
|
||||
buttonState.heightFactor = buttonView.heightFactor;
|
||||
buttonState.backgroundAlpha = buttonView.backgroundAlpha;
|
||||
buttonState.sensitivityFactor = buttonView.sensitivityFactor;
|
||||
buttonState.stickIndicatorXOffset = buttonView.stickIndicatorXOffset;
|
||||
// save on-screen widget views (keyboard & mouse command) as buttonstate:
|
||||
[OnScreenWidgetViewsDict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { // this dict is passed from the layout tool VC, as a static obj in this class.
|
||||
OnScreenWidgetView *widgetView = value;
|
||||
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:widgetView.keyString buttonType:KeyboardOrMouseButton andPosition:widgetView.frame.origin];
|
||||
buttonState.alias = widgetView.keyLabel;
|
||||
buttonState.timestamp = widgetView.timestamp;
|
||||
buttonState.widthFactor = widgetView.widthFactor;
|
||||
buttonState.heightFactor = widgetView.heightFactor;
|
||||
buttonState.backgroundAlpha = widgetView.backgroundAlpha;
|
||||
buttonState.sensitivityFactor = widgetView.sensitivityFactor;
|
||||
buttonState.stickIndicatorXOffset = widgetView.stickIndicatorXOffset;
|
||||
|
||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
|
||||
@@ -25,10 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) BOOL isHidden;
|
||||
@property (nonatomic, assign) uint8_t buttonType;
|
||||
@property (nonatomic, assign) NSTimeInterval timestamp;
|
||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenButtonView
|
||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView
|
||||
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenWidgetView
|
||||
@property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenWidgetView
|
||||
@property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenWidgetView
|
||||
|
||||
@property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer
|
||||
@property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer
|
||||
|
||||
Reference in new issue
Block a user