full portrait support for on-screen widgets & legacy on-screen controls
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
@property (assign, nonatomic) UIView* streamFrameTopLayerView;
|
||||
@property (assign, nonatomic) CGFloat streamAspectRatio;
|
||||
@property (assign, nonatomic) CGRect originalFrame;
|
||||
@property (assign, nonatomic) bool widgetToolOpened;
|
||||
|
||||
|
||||
- (void) setupStreamView:(ControllerSupport*)controllerSupport
|
||||
|
||||
@@ -350,7 +350,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
|
||||
- (void) showOnScreenControls {
|
||||
#if !TARGET_OS_TV
|
||||
[onScreenControls show];
|
||||
if(!_widgetToolOpened) [onScreenControls show];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -411,8 +411,11 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
|
||||
- (CGPoint)denormalizeWidgetPosition:(CGPoint)position {
|
||||
if(position.x < 1.0 && position.y < 1.0){
|
||||
position.x = position.x * self.bounds.size.width;
|
||||
position.y = position.y * self.bounds.size.height;
|
||||
position.x = position.x * streamFrameTopLayerView.bounds.size.width;
|
||||
position.y = position.y * streamFrameTopLayerView.bounds.size.height;
|
||||
}
|
||||
else{
|
||||
NSLog(@"invalid coords");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
+26
-19
@@ -78,7 +78,14 @@
|
||||
return position;
|
||||
}
|
||||
|
||||
- (void) reloadOnScreenWidgetViews {
|
||||
- (void)reloadLegacyOnScreenControls{
|
||||
[self.layoutOSC updateControls]; // creates and saves a 'Default' OSC profile or loads the o//ne the user selected on the previous screen
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers];
|
||||
[self.layoutOSC.layoutChanges removeAllObjects]; // since a new OSC profile is being loaded, this will remove all previous layout changes made from the array
|
||||
[self OSCLayoutChanged]; // fades the 'Undo Button' out
|
||||
}
|
||||
|
||||
- (void)reloadOnScreenWidgetViews{
|
||||
NSLog(@"reloadOnScreenWidgets %f", CACurrentMediaTime());
|
||||
OnScreenWidgetView.editMode = true;
|
||||
[self clearStickIndicator];
|
||||
@@ -155,8 +162,9 @@
|
||||
self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected];
|
||||
self.layoutOSC._level = OnScreenControlsLevelCustom;
|
||||
self.layoutOSC.layoutToolVC = self;
|
||||
//[self.layoutOSC show]; // draw on screen controls
|
||||
[self.layoutOSC show]; // draw on screen controls
|
||||
|
||||
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers]; // allows inner and analog sticks to be dragged together around the screen together as one unit which is the expected behavior
|
||||
|
||||
self.undoButton.alpha = 0.3; // no changes to undo yet, so fade out the undo button a bit
|
||||
@@ -259,11 +267,19 @@
|
||||
[OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager
|
||||
}
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{
|
||||
[self saveTapped:nil];
|
||||
}
|
||||
|
||||
- (void)deviceOrientationDidChange{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
sleep(1);
|
||||
[OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager
|
||||
});
|
||||
[self performSelector:@selector(handleOrientationChangeForOnScreenWidgets) withObject:self afterDelay:1];
|
||||
}
|
||||
|
||||
- (void)handleOrientationChangeForOnScreenWidgets{
|
||||
_oscProfilesTableViewController.layoutViewBounds = self.view.bounds;
|
||||
[OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager
|
||||
[self reloadOnScreenWidgetViews];
|
||||
[self reloadLegacyOnScreenControls];
|
||||
}
|
||||
|
||||
/* fades the 'Undo Button' in or out depending on whether the user has any OSC layout changes to undo */
|
||||
@@ -1116,12 +1132,9 @@
|
||||
|
||||
//this part is just for registration, will not be immediately executed.
|
||||
self->_oscProfilesTableViewController.needToUpdateOscLayoutTVC = ^() { // a block that will be called when the modally presented 'OSCProfilesTableViewController' VC is dismissed. By the time the 'OSCProfilesTableViewController' VC is dismissed the user would have potentially selected a different OSC profile with a different layout and they want to see this layout on this 'LayoutOnScreenControlsViewController.' This block of code will load the profile and then hide/show and move each OSC button to their appropriate position
|
||||
[self.layoutOSC updateControls]; // creates and saves a 'Default' OSC profile or loads the one the user selected on the previous screen
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers];
|
||||
[self.layoutOSC.layoutChanges removeAllObjects]; // since a new OSC profile is being loaded, this will remove all previous layout changes made from the array
|
||||
[self OSCLayoutChanged]; // fades the 'Undo Button' out
|
||||
NSLog(@"profile profile");
|
||||
[self reloadLegacyOnScreenControls];
|
||||
self->_oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers; //pass updated OSCLayout to OSCProfileTableView again
|
||||
//[self reloadOnScreenKeyboardButtons];
|
||||
};
|
||||
|
||||
[self.oscProfilesTableViewController profileViewRefresh]; // execute this will make sure OSCLayout is updated from persisted profile, not any cache.
|
||||
@@ -1144,16 +1157,10 @@
|
||||
}
|
||||
|
||||
_oscProfilesTableViewController = [storyboard instantiateViewControllerWithIdentifier:@"OSCProfilesTableViewController"];
|
||||
_oscProfilesTableViewController.streamViewBounds = self.view.bounds;
|
||||
_oscProfilesTableViewController.layoutViewBounds = self.view.bounds;
|
||||
|
||||
_oscProfilesTableViewController.needToUpdateOscLayoutTVC = ^() { // a block that will be called when the modally presented 'OSCProfilesTableViewController' VC is dismissed. By the time the 'OSCProfilesTableViewController' VC is dismissed the user would have potentially selected a different OSC ofile with a different layout and they want to see this layout on this 'LayoutOnScreenControlsViewController.' This block of code will load the proffile and then hide/show and move each OSC button to their appropriate position
|
||||
[self.layoutOSC updateControls]; // creates and saves a 'Default' OSC profile or loads the one the user selected on the previous screen
|
||||
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers];
|
||||
|
||||
[self.layoutOSC.layoutChanges removeAllObjects]; // since a new OSC profile is being loaded, this will remove all previous layout changes made from the array
|
||||
|
||||
[self OSCLayoutChanged]; // fades the 'Undo Button' out
|
||||
[self reloadLegacyOnScreenControls];
|
||||
};
|
||||
|
||||
self.widgetPanelStack.hidden = YES;
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef NS_ENUM(NSUInteger, FileOperation) {
|
||||
@property (weak, nonatomic) IBOutlet UITableView *tableView;
|
||||
@property (nonatomic, copy) void (^needToUpdateOscLayoutTVC)(void);
|
||||
@property (nonatomic, assign) NSMutableArray *currentOSCButtonLayers;
|
||||
@property (nonatomic, assign) CGRect streamViewBounds;
|
||||
@property (nonatomic, assign) CGRect layoutViewBounds;
|
||||
@property (weak, nonatomic) IBOutlet UINavigationBar *profileTableViewNavigationBar;
|
||||
|
||||
@end
|
||||
|
||||
@@ -74,7 +74,7 @@ const double NAV_BAR_HEIGHT = 50;
|
||||
|
||||
// self.profileTableViewNavigationBar.layer.cornerRadius = 15; // 设置圆角半径
|
||||
|
||||
profilesManager = [OSCProfilesManager sharedManager:_streamViewBounds];
|
||||
profilesManager = [OSCProfilesManager sharedManager:_layoutViewBounds];
|
||||
|
||||
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, NAV_BAR_HEIGHT)];
|
||||
|
||||
|
||||
@@ -640,6 +640,7 @@
|
||||
}
|
||||
|
||||
- (void)openWidgetLayoutTool{
|
||||
_streamView.widgetToolOpened = true;
|
||||
[self->_streamView disableOnScreenControls];
|
||||
[self->_streamView clearOnScreenWidgets]; // clear all onScreenKeyboardButtons before entering edit mode
|
||||
_layoutOnScreenControlsVC.quickSwitchEnabled = false;
|
||||
@@ -649,6 +650,7 @@
|
||||
}
|
||||
|
||||
- (void)switchWidgetProfile{
|
||||
_streamView.widgetToolOpened = true;
|
||||
[self->_streamView disableOnScreenControls];
|
||||
[self->_streamView clearOnScreenWidgets]; // clear all onScreenKeyboardButtons before entering edit mode
|
||||
_layoutOnScreenControlsVC.quickSwitchEnabled = true;
|
||||
@@ -669,6 +671,7 @@
|
||||
|
||||
- (void)oscLayoutClosed{
|
||||
// Handle the callback
|
||||
_streamView.widgetToolOpened = false;
|
||||
[self->_streamView disableOnScreenControls]; // add this to get realtime back menu working.
|
||||
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
|
||||
andConfig:(StreamConfiguration*)_streamConfig];
|
||||
|
||||
Reference in New Issue
Block a user