- 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 UIView* _view;
|
||||||
@property NSMutableArray *layoutChanges;
|
@property NSMutableArray *layoutChanges;
|
||||||
@property CALayer *layerBeingDragged;
|
@property CALayer *layerBeingDragged;
|
||||||
|
@property UIViewController *layoutToolVC;
|
||||||
|
|
||||||
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport
|
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport
|
||||||
streamConfig:(StreamConfiguration*)streamConfig oscLevel:(int)oscLevel;
|
streamConfig:(StreamConfiguration*)streamConfig oscLevel:(int)oscLevel;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#import "OSCProfilesTableViewController.h"
|
#import "OSCProfilesTableViewController.h"
|
||||||
#import "OnScreenButtonState.h"
|
#import "OnScreenButtonState.h"
|
||||||
#import "OSCProfilesManager.h"
|
#import "OSCProfilesManager.h"
|
||||||
|
#import "Moonlight-Swift.h"
|
||||||
|
|
||||||
@interface LayoutOnScreenControls ()
|
@interface LayoutOnScreenControls ()
|
||||||
@end
|
@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 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.
|
-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
|
for (CALayer *button in self.OSCButtonLayers) { // horizontal guideline position check
|
||||||
|
|
||||||
if ((layerBeingDragged != button) && !button.isHidden) {
|
if ((layerBeingDragged != button) && !button.isHidden) {
|
||||||
if ((horizontalGuideline.center.y < button.position.y + 1) &&
|
if ((horizontalGuideline.center.y < button.position.y + 1) &&
|
||||||
(horizontalGuideline.center.y > button.position.y - 1)) {
|
(horizontalGuideline.center.y > button.position.y - 1)) {
|
||||||
horizontalGuideline.backgroundColor = [UIColor whiteColor];
|
horizontalGuideline.backgroundColor = [UIColor yellowColor];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
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 (CALayer *button in self.OSCButtonLayers) { // vertical guideline position check
|
|
||||||
|
|
||||||
|
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 ((layerBeingDragged != button) && !button.isHidden) {
|
||||||
if ((verticalGuideline.center.x < button.position.x + 1) &&
|
if ((verticalGuideline.center.x < button.position.x + 1) &&
|
||||||
(verticalGuideline.center.x > button.position.x - 1)) {
|
(verticalGuideline.center.x > button.position.x - 1)) {
|
||||||
verticalGuideline.backgroundColor = [UIColor whiteColor];
|
verticalGuideline.backgroundColor = [UIColor yellowColor];
|
||||||
break;
|
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 {
|
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
|
|
||||||
+ (OSCProfilesManager *) sharedManager;
|
+ (OSCProfilesManager *) sharedManager;
|
||||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict;
|
+ (void) setOnScreenWidgetViewsDict:(NSMutableDictionary* )dict;
|
||||||
|
|
||||||
#pragma mark - Getters
|
#pragma mark - Getters
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
@implementation OSCProfilesManager
|
@implementation OSCProfilesManager
|
||||||
|
|
||||||
static NSMutableDictionary *onScreenButtonViewsDict;
|
static NSMutableDictionary *OnScreenWidgetViewsDict;
|
||||||
|
|
||||||
#pragma mark - Initializer
|
#pragma mark - Initializer
|
||||||
|
|
||||||
@@ -32,8 +32,8 @@ static NSMutableDictionary *onScreenButtonViewsDict;
|
|||||||
#pragma mark - Class Helper Methods
|
#pragma mark - Class Helper Methods
|
||||||
|
|
||||||
|
|
||||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict{
|
+ (void) setOnScreenWidgetViewsDict:(NSMutableDictionary* )dict{
|
||||||
onScreenButtonViewsDict = dict;
|
OnScreenWidgetViewsDict = dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -281,17 +281,17 @@ static NSMutableDictionary *onScreenButtonViewsDict;
|
|||||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||||
}
|
}
|
||||||
|
|
||||||
// save on-screen button views (keyboard & mouse command) as buttonstate:
|
// save on-screen widget 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.
|
[OnScreenWidgetViewsDict 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;
|
OnScreenWidgetView *widgetView = value;
|
||||||
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:buttonView.keyString buttonType:KeyboardOrMouseButton andPosition:buttonView.frame.origin];
|
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:widgetView.keyString buttonType:KeyboardOrMouseButton andPosition:widgetView.frame.origin];
|
||||||
buttonState.alias = buttonView.keyLabel;
|
buttonState.alias = widgetView.keyLabel;
|
||||||
buttonState.timestamp = buttonView.timestamp;
|
buttonState.timestamp = widgetView.timestamp;
|
||||||
buttonState.widthFactor = buttonView.widthFactor;
|
buttonState.widthFactor = widgetView.widthFactor;
|
||||||
buttonState.heightFactor = buttonView.heightFactor;
|
buttonState.heightFactor = widgetView.heightFactor;
|
||||||
buttonState.backgroundAlpha = buttonView.backgroundAlpha;
|
buttonState.backgroundAlpha = widgetView.backgroundAlpha;
|
||||||
buttonState.sensitivityFactor = buttonView.sensitivityFactor;
|
buttonState.sensitivityFactor = widgetView.sensitivityFactor;
|
||||||
buttonState.stickIndicatorXOffset = buttonView.stickIndicatorXOffset;
|
buttonState.stickIndicatorXOffset = widgetView.stickIndicatorXOffset;
|
||||||
|
|
||||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic, assign) BOOL isHidden;
|
@property (nonatomic, assign) BOOL isHidden;
|
||||||
@property (nonatomic, assign) uint8_t buttonType;
|
@property (nonatomic, assign) uint8_t buttonType;
|
||||||
@property (nonatomic, assign) NSTimeInterval timestamp;
|
@property (nonatomic, assign) NSTimeInterval timestamp;
|
||||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenButtonView
|
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView
|
||||||
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenButtonView
|
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenWidgetView
|
||||||
@property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenButtonView
|
@property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenWidgetView
|
||||||
@property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenButtonView
|
@property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenWidgetView
|
||||||
|
|
||||||
@property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer
|
@property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer
|
||||||
@property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer
|
@property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static CGFloat screenWidthInPoints;
|
|||||||
_gestureCaptured = false;
|
_gestureCaptured = false;
|
||||||
self.state = UIGestureRecognizerStateFailed;
|
self.state = UIGestureRecognizerStateFailed;
|
||||||
}
|
}
|
||||||
else if(_gestureCaptured && allTouchesCount == [touches count] && !_isOnScreenControllerBeingPressed && ![self isOnScreenButtonViewBeingPressed]){ //must exclude virtual controller & onscreen button taps here to prevent stucked button, _areVirtualControllerTaps flag is set by onscreencontrols, containOnScreenButtonsTaps will be returned by iterating all button views in streamframeview
|
else if(_gestureCaptured && allTouchesCount == [touches count] && !_isOnScreenControllerBeingPressed && ![self isOnScreenWidgetViewBeingPressed]){ //must exclude virtual controller & onscreen button taps here to prevent stucked button, _areVirtualControllerTaps flag is set by onscreencontrols, containOnScreenButtonsTaps will be returned by iterating all widget views in streamframeview
|
||||||
_gestureCaptured = false; //reset for next recognition
|
_gestureCaptured = false; //reset for next recognition
|
||||||
if((CACurrentMediaTime() - _gestureCapturedTime) < _tapDownTimeThreshold){
|
if((CACurrentMediaTime() - _gestureCapturedTime) < _tapDownTimeThreshold){
|
||||||
lowestTouchPointYCoord = 0.0; //reset for next recognition
|
lowestTouchPointYCoord = 0.0; //reset for next recognition
|
||||||
@@ -85,28 +85,28 @@ static CGFloat screenWidthInPoints;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// it was a not a perfect choice to code OnScreenButtonView in Swift...
|
// it was a not a perfect choice to code OnScreenWidgetView in Swift...
|
||||||
// we're unable to import this class to swift codebase by the bridging header,and have to exlucde the onscreen button taps here
|
// we're unable to import this class to swift codebase by the bridging header,and have to exlucde the onscreen button taps here
|
||||||
// by iterating every button view instances. but it's basically ok since the number of buttonViews are always limited.
|
// by iterating every widget view instances. but it's basically ok since the number of widgetViews are always limited.
|
||||||
// and this method will only be called when the recognizer is active & and the taps passes all the checks and is about to ge triggered.
|
// and this method will only be called when the recognizer is active & and the taps passes all the checks and is about to ge triggered.
|
||||||
- (bool)isOnScreenButtonViewBeingPressed {
|
- (bool)isOnScreenWidgetViewBeingPressed {
|
||||||
NSTimeInterval allFingersTapDownTime = CACurrentMediaTime() - _gestureCapturedTime; //RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S has been passed to this recognizer as _tapDownTimeShreshold, we'll decide how to deal with pressed flag of on-screen button views based on tapDownTime
|
NSTimeInterval allFingersTapDownTime = CACurrentMediaTime() - _gestureCapturedTime; //RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S has been passed to this recognizer as _tapDownTimeShreshold, we'll decide how to deal with pressed flag of on-screen widget views based on tapDownTime
|
||||||
bool gotOneButtonPressed = false;
|
bool gotOneWidgetPressed = false;
|
||||||
// the tap gestures are all added to the streamFrameTopLayerView, where all the onScreenButtonViews are added. so we can iterate them in this way:
|
// the tap gestures are all added to the streamFrameTopLayerView, where all the OnScreenWidgetViews are added. so we can iterate them in this way:
|
||||||
for(UIView* view in self.view.subviews){
|
for(UIView* view in self.view.subviews){
|
||||||
if ([view isKindOfClass:[OnScreenButtonView class]]) {
|
if ([view isKindOfClass:[OnScreenWidgetView class]]) {
|
||||||
OnScreenButtonView* buttonView = (OnScreenButtonView*) view;
|
OnScreenWidgetView* widgetView = (OnScreenWidgetView*) view;
|
||||||
if(gotOneButtonPressed && allFingersTapDownTime <= _tapDownTimeThreshold){ // once we have just 1 button pressed already,& the tapDownTime has not exceeded the threshold, we'll reset pressed flag for the all the buttonViews.
|
if(gotOneWidgetPressed && allFingersTapDownTime <= _tapDownTimeThreshold){ // once we have just 1 button pressed already,& the tapDownTime has not exceeded the threshold, we'll reset pressed flag for the all the widgetViews.
|
||||||
buttonView.pressed = false; //reset the flag for buttonView
|
widgetView.pressed = false; //reset the flag for widgetView
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(buttonView.pressed){
|
if(widgetView.pressed){
|
||||||
gotOneButtonPressed = true; //got one button pressed
|
gotOneWidgetPressed = true; //got one button pressed
|
||||||
if(allFingersTapDownTime <= _tapDownTimeThreshold) buttonView.pressed = false; // reset the flag for current buttonView if tapDowntime is still within the threshold, if not, leave the flag for mouse scroller gesture in relative touch mode.
|
if(allFingersTapDownTime <= _tapDownTimeThreshold) widgetView.pressed = false; // reset the flag for current widgetView if tapDowntime is still within the threshold, if not, leave the flag for mouse scroller gesture in relative touch mode.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gotOneButtonPressed;
|
return gotOneWidgetPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
@class ControllerSupport;
|
@class ControllerSupport;
|
||||||
@class StreamConfiguration;
|
@class StreamConfiguration;
|
||||||
|
|
||||||
// sending self as an instance to OnScreenButtonView or other related classes
|
// sending self as an instance to OnScreenWidgetView or other related classes
|
||||||
@protocol InstanceProviderDelegate <NSObject>
|
@protocol InstanceProviderDelegate <NSObject>
|
||||||
- (void)getOnScreenControlsInstance:(id)sender; // Renamed delegate method
|
- (void)getOnScreenControlsInstance:(id)sender; // Renamed delegate method
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ static float L3_Y;
|
|||||||
[_controllerSupport updateFinished:_controller];
|
[_controllerSupport updateFinished:_controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
// sending self as an instance to OnScreenButtonView
|
// sending self as an instance to OnScreenWidgetView
|
||||||
- (void)sendInstance{
|
- (void)sendInstance{
|
||||||
NSLog(@"OnScreenControls is sending its instance...");
|
NSLog(@"OnScreenControls is sending its instance...");
|
||||||
if ([self.delegate respondsToSelector:@selector(getOnScreenControlsInstance:)]) {
|
if ([self.delegate respondsToSelector:@selector(getOnScreenControlsInstance:)]) {
|
||||||
|
|||||||
+22
-22
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objc class OnScreenButtonView: UIView, InstanceProviderDelegate {
|
@objc class OnScreenWidgetView: UIView, InstanceProviderDelegate {
|
||||||
// receiving the OnScreenControls instance from delegate
|
// receiving the OnScreenControls instance from delegate
|
||||||
@objc func getOnScreenControlsInstance(_ sender: Any) {
|
@objc func getOnScreenControlsInstance(_ sender: Any) {
|
||||||
if let controls = sender as? OnScreenControls {
|
if let controls = sender as? OnScreenControls {
|
||||||
@@ -150,7 +150,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc public func enableRelocationMode(enabled: Bool){
|
@objc public func enableRelocationMode(enabled: Bool){
|
||||||
OnScreenButtonView.editMode = enabled
|
OnScreenWidgetView.editMode = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func adjustButtonTransparency(alpha: CGFloat){
|
@objc public func adjustButtonTransparency(alpha: CGFloat){
|
||||||
@@ -163,7 +163,7 @@ import UIKit
|
|||||||
self.tweakAlpha()
|
self.tweakAlpha()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func resizeButtonView(){
|
@objc public func resizeWidgetView(){
|
||||||
guard let superview = superview else { return }
|
guard let superview = superview else { return }
|
||||||
|
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ import UIKit
|
|||||||
// Trigger layout update
|
// Trigger layout update
|
||||||
superview.layoutIfNeeded()
|
superview.layoutIfNeeded()
|
||||||
|
|
||||||
// Re-setup buttonView style
|
// Re-setup widgetView style
|
||||||
setupView()
|
setupView()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ import UIKit
|
|||||||
|
|
||||||
if CommandManager.touchPadCmds.contains(self.keyString){
|
if CommandManager.touchPadCmds.contains(self.keyString){
|
||||||
label.text = "" // make touchPad display no text
|
label.text = "" // make touchPad display no text
|
||||||
if OnScreenButtonView.editMode { //display label in edit mode to make the pad more visible
|
if OnScreenWidgetView.editMode { //display label in edit mode to make the pad more visible
|
||||||
label.text = self.keyString
|
label.text = self.keyString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ import UIKit
|
|||||||
self.selfViewOnTheRight = (self.storedLocation.x > self.appWindow.frame.width*0.5)
|
self.selfViewOnTheRight = (self.storedLocation.x > self.appWindow.frame.width*0.5)
|
||||||
let offsetSign = selfViewOnTheRight ? -1 : 1
|
let offsetSign = selfViewOnTheRight ? -1 : 1
|
||||||
let stickMarkerRelativeLocation:CGPoint
|
let stickMarkerRelativeLocation:CGPoint
|
||||||
if !OnScreenButtonView.editMode {
|
if !OnScreenWidgetView.editMode {
|
||||||
stickMarkerRelativeLocation = CGPointMake(touchBeganLocation.x + CGFloat(offsetSign) * self.stickIndicatorXOffset, touchBeganLocation.y)
|
stickMarkerRelativeLocation = CGPointMake(touchBeganLocation.x + CGFloat(offsetSign) * self.stickIndicatorXOffset, touchBeganLocation.y)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -384,7 +384,7 @@ import UIKit
|
|||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
CATransaction.setDisableActions(true)
|
CATransaction.setDisableActions(true)
|
||||||
self.stickBallLayer.removeAllAnimations()
|
self.stickBallLayer.removeAllAnimations()
|
||||||
if !OnScreenButtonView.editMode {
|
if !OnScreenWidgetView.editMode {
|
||||||
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetX*sensitivityFactor), CGRectGetMidY(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetY*sensitivityFactor))
|
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetX*sensitivityFactor), CGRectGetMidY(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetY*sensitivityFactor))
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -701,14 +701,14 @@ import UIKit
|
|||||||
self.latestTouchLocation = touchBeganLocation
|
self.latestTouchLocation = touchBeganLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
let allCapturedTouchesCount = event?.allTouches?.filter({ $0.view == self }).count // this will counts all valid touches within the self buttonView, and excludes touches in other buttonViews
|
let allCapturedTouchesCount = event?.allTouches?.filter({ $0.view == self }).count // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
||||||
if allCapturedTouchesCount == 2 {
|
if allCapturedTouchesCount == 2 {
|
||||||
self.twoTouchesDetected = true
|
self.twoTouchesDetected = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.pressed = true
|
self.pressed = true
|
||||||
|
|
||||||
if !OnScreenButtonView.editMode {
|
if !OnScreenWidgetView.editMode {
|
||||||
if CommandManager.touchPadCmds.contains(self.keyString) && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews
|
if CommandManager.touchPadCmds.contains(self.keyString) && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews
|
||||||
switch self.keyString {
|
switch self.keyString {
|
||||||
case "LSPAD":
|
case "LSPAD":
|
||||||
@@ -770,7 +770,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
// here is in edit mode:
|
// here is in edit mode:
|
||||||
else{
|
else{
|
||||||
NotificationCenter.default.post(name: Notification.Name("OnScreenButtonViewSelected"),object: self) // inform layout tool controller to fetch button size factors. self will be passed as the object of the notification
|
NotificationCenter.default.post(name: Notification.Name("OnScreenWidgetViewSelected"),object: self) // inform layout tool controller to fetch button size factors. self will be passed as the object of the notification
|
||||||
if let touch = touches.first {
|
if let touch = touches.first {
|
||||||
let touchLocation = touch.location(in: superview)
|
let touchLocation = touch.location(in: superview)
|
||||||
storedLocation = touchLocation
|
storedLocation = touchLocation
|
||||||
@@ -790,9 +790,9 @@ import UIKit
|
|||||||
|
|
||||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
super.touchesMoved(touches, with: event)
|
super.touchesMoved(touches, with: event)
|
||||||
OnScreenButtonView.timestampOfButtonBeingDragged = self.timestamp
|
OnScreenWidgetView.timestampOfButtonBeingDragged = self.timestamp
|
||||||
|
|
||||||
if !OnScreenButtonView.editMode {
|
if !OnScreenWidgetView.editMode {
|
||||||
if CommandManager.touchPadCmds.contains(self.keyString){
|
if CommandManager.touchPadCmds.contains(self.keyString){
|
||||||
handleTouchPadMoveEvent(touches, with: event)
|
handleTouchPadMoveEvent(touches, with: event)
|
||||||
}
|
}
|
||||||
@@ -808,8 +808,8 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the buttonView based on touch movement in relocation mode
|
// Move the widgetView based on touch movement in relocation mode
|
||||||
if OnScreenButtonView.editMode {
|
if OnScreenWidgetView.editMode {
|
||||||
if let touch = touches.first {
|
if let touch = touches.first {
|
||||||
self.moveByTouch(touch: touch)
|
self.moveByTouch(touch: touch)
|
||||||
}
|
}
|
||||||
@@ -858,10 +858,10 @@ import UIKit
|
|||||||
|
|
||||||
if self.keyString != "MOUSEPAD" {quickDoubleTapDetected = false} //do not reset this flag here in mousePad mode
|
if self.keyString != "MOUSEPAD" {quickDoubleTapDetected = false} //do not reset this flag here in mousePad mode
|
||||||
|
|
||||||
let allCapturedTouchesCount = event?.allTouches?.filter({ $0.view == self }).count // this will counts all valid touches within the self buttonView, and excludes touches in other buttonViews
|
let allCapturedTouchesCount = event?.allTouches?.filter({ $0.view == self }).count // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
||||||
|
|
||||||
// deal with MOUSPAD first
|
// deal with MOUSPAD first
|
||||||
if !OnScreenButtonView.editMode && self.keyString == "MOUSEPAD" && allCapturedTouchesCount == 1 && !twoTouchesDetected {
|
if !OnScreenWidgetView.editMode && self.keyString == "MOUSEPAD" && allCapturedTouchesCount == 1 && !twoTouchesDetected {
|
||||||
if !mousePointerMoved && !quickDoubleTapDetected {self.sendLongMouseLeftButtonClickEvent()} // deal with single tap(click)
|
if !mousePointerMoved && !quickDoubleTapDetected {self.sendLongMouseLeftButtonClickEvent()} // deal with single tap(click)
|
||||||
if quickDoubleTapDetected { //deal with quick double tap
|
if quickDoubleTapDetected { //deal with quick double tap
|
||||||
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_RELEASE), BUTTON_LEFT) //must release the button anyway, because the button is likely being held down since the long click turned into a dragging event.
|
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_RELEASE), BUTTON_LEFT) //must release the button anyway, because the button is likely being held down since the long click turned into a dragging event.
|
||||||
@@ -871,14 +871,14 @@ import UIKit
|
|||||||
mousePointerMoved = false // reset this flag
|
mousePointerMoved = false // reset this flag
|
||||||
}
|
}
|
||||||
|
|
||||||
if !OnScreenButtonView.editMode && self.keyString == "MOUSEPAD" && twoTouchesDetected && touches.count == allCapturedTouchesCount { // need to enable multi-touch first
|
if !OnScreenWidgetView.editMode && self.keyString == "MOUSEPAD" && twoTouchesDetected && touches.count == allCapturedTouchesCount { // need to enable multi-touch first
|
||||||
// touches.count == allCapturedTouchesCount means allfingers are lifting
|
// touches.count == allCapturedTouchesCount means allfingers are lifting
|
||||||
self.sendMouseRightButtonClickEvent()
|
self.sendMouseRightButtonClickEvent()
|
||||||
twoTouchesDetected = false
|
twoTouchesDetected = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// then other types of pads
|
// then other types of pads
|
||||||
if !OnScreenButtonView.editMode && CommandManager.touchPadCmds.contains(self.keyString) {
|
if !OnScreenWidgetView.editMode && CommandManager.touchPadCmds.contains(self.keyString) {
|
||||||
switch self.keyString{
|
switch self.keyString{
|
||||||
case "LSPAD":
|
case "LSPAD":
|
||||||
self.onScreenControls.clearLeftStickTouchPadFlag()
|
self.onScreenControls.clearLeftStickTouchPadFlag()
|
||||||
@@ -912,7 +912,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !OnScreenButtonView.editMode && CommandManager.specialOverlayButtonCmds.contains(self.keyString){
|
if !OnScreenWidgetView.editMode && CommandManager.specialOverlayButtonCmds.contains(self.keyString){
|
||||||
if CACurrentMediaTime() - self.touchTapTimeStamp < 0.3 {
|
if CACurrentMediaTime() - self.touchTapTimeStamp < 0.3 {
|
||||||
switch self.keyString {
|
switch self.keyString {
|
||||||
case "SETTINGS":
|
case "SETTINGS":
|
||||||
@@ -940,7 +940,7 @@ import UIKit
|
|||||||
if self.keyString == "OSCR2" {self.onScreenControls.updateRightTrigger(0x00)}
|
if self.keyString == "OSCR2" {self.onScreenControls.updateRightTrigger(0x00)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !OnScreenButtonView.editMode && !self.keyString.contains("+") { // if the command(keystring contains "+", it's a multi-key command rather than a single key button
|
if !OnScreenWidgetView.editMode && !self.keyString.contains("+") { // if the command(keystring contains "+", it's a multi-key command rather than a single key button
|
||||||
|
|
||||||
if CommandManager.mouseButtonMappings.keys.contains(self.keyString){
|
if CommandManager.mouseButtonMappings.keys.contains(self.keyString){
|
||||||
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_RELEASE), Int32(CommandManager.mouseButtonMappings[self.keyString]!))
|
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_RELEASE), Int32(CommandManager.mouseButtonMappings[self.keyString]!))
|
||||||
@@ -950,7 +950,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if OnScreenButtonView.editMode {
|
if OnScreenWidgetView.editMode {
|
||||||
guard let superview = superview else { return }
|
guard let superview = superview else { return }
|
||||||
|
|
||||||
// Deactivate existing constraints if necessary
|
// Deactivate existing constraints if necessary
|
||||||
@@ -969,7 +969,7 @@ import UIKit
|
|||||||
// Trigger layout update
|
// Trigger layout update
|
||||||
superview.layoutIfNeeded()
|
superview.layoutIfNeeded()
|
||||||
|
|
||||||
setupView(); //re-setup buttonView style
|
setupView(); //re-setup widgetView style
|
||||||
|
|
||||||
if CommandManager.nonVectorStickPads.contains(self.keyString) {
|
if CommandManager.nonVectorStickPads.contains(self.keyString) {
|
||||||
self.crossMarkLayer.removeFromSuperlayer()
|
self.crossMarkLayer.removeFromSuperlayer()
|
||||||
@@ -91,12 +91,12 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (bool)isOnScreenButtonViewBeingPressed {
|
- (bool)isOnScreenWidgetViewBeingPressed {
|
||||||
bool gotOneButtonPressed = false;
|
bool gotOneButtonPressed = false;
|
||||||
for(UIView* view in self->streamView.superview.subviews){ // iterates all on-screen button views in StreamFrameView
|
for(UIView* view in self->streamView.superview.subviews){ // iterates all on-screen widget views in StreamFrameView
|
||||||
if ([view isKindOfClass:[OnScreenButtonView class]]) {
|
if ([view isKindOfClass:[OnScreenWidgetView class]]) {
|
||||||
OnScreenButtonView* buttonView = (OnScreenButtonView*) view;
|
OnScreenWidgetView* widgetView = (OnScreenWidgetView*) view;
|
||||||
if(buttonView.pressed){
|
if(widgetView.pressed){
|
||||||
gotOneButtonPressed = true; //got one button pressed
|
gotOneButtonPressed = true; //got one button pressed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,11 +104,11 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
|
|||||||
return gotOneButtonPressed;
|
return gotOneButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetAllPressedFlagsForOnscreenButtonViews {
|
- (void)resetAllPressedFlagsForOnScreenWidgetViews {
|
||||||
for(UIView* view in self->streamView.superview.subviews){ // iterates all on-screen button views in StreamFrameView
|
for(UIView* view in self->streamView.superview.subviews){ // iterates all on-screen widget views in StreamFrameView
|
||||||
if ([view isKindOfClass:[OnScreenButtonView class]]) {
|
if ([view isKindOfClass:[OnScreenWidgetView class]]) {
|
||||||
OnScreenButtonView* buttonView = (OnScreenButtonView*) view;
|
OnScreenWidgetView* widgetView = (OnScreenWidgetView*) view;
|
||||||
buttonView.pressed = false;
|
widgetView.pressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
|
|||||||
|
|
||||||
touchPointSpawnedAtUpperScreenEdge = false; // reset this flag immediately if we get a touch event passing the check above, this fixes irresponsive touch after closing the command tool menu.
|
touchPointSpawnedAtUpperScreenEdge = false; // reset this flag immediately if we get a touch event passing the check above, this fixes irresponsive touch after closing the command tool menu.
|
||||||
|
|
||||||
if([[event allTouches] count] == 2 && ![self isOnScreenButtonViewBeingPressed] && ![self isOnScreenControllerBeingPressed:[event allTouches]]){
|
if([[event allTouches] count] == 2 && ![self isOnScreenWidgetViewBeingPressed] && ![self isOnScreenControllerBeingPressed:[event allTouches]]){
|
||||||
NSLog(@"get in scrolling mode");
|
NSLog(@"get in scrolling mode");
|
||||||
isInMouseWheelScrollingMode = true;
|
isInMouseWheelScrollingMode = true;
|
||||||
return; // if we got 2 touches on the blank area, it's gonna be a mouse scroll touch, and must prevent UITtouch object for mouse pointer being captured & locked
|
return; // if we got 2 touches on the blank area, it's gonna be a mouse scroll touch, and must prevent UITtouch object for mouse pointer being captured & locked
|
||||||
@@ -190,7 +190,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
|
|||||||
|
|
||||||
//NSLog(@"%f, touchesMoved callback, is scrolling: %d, touches count: %d", CACurrentMediaTime(), isInMouseWheelScrollingMode, (uint32_t)[touches count]);
|
//NSLog(@"%f, touchesMoved callback, is scrolling: %d, touches count: %d", CACurrentMediaTime(), isInMouseWheelScrollingMode, (uint32_t)[touches count]);
|
||||||
|
|
||||||
if(isInMouseWheelScrollingMode && [[event allTouches] count] == 2 && ![self isOnScreenButtonViewBeingPressed] && ![self isOnScreenControllerBeingPressed:touches]){
|
if(isInMouseWheelScrollingMode && [[event allTouches] count] == 2 && ![self isOnScreenWidgetViewBeingPressed] && ![self isOnScreenControllerBeingPressed:touches]){
|
||||||
NSSet* twoTouches = [event allTouches];
|
NSSet* twoTouches = [event allTouches];
|
||||||
CGPoint firstLocation = [[[twoTouches allObjects] objectAtIndex:0] locationInView:streamView];
|
CGPoint firstLocation = [[[twoTouches allObjects] objectAtIndex:0] locationInView:streamView];
|
||||||
CGPoint secondLocation = [[[twoTouches allObjects] objectAtIndex:1] locationInView:streamView];
|
CGPoint secondLocation = [[[twoTouches allObjects] objectAtIndex:1] locationInView:streamView];
|
||||||
@@ -237,7 +237,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
|
|||||||
isInMouseWheelScrollingMode = false;
|
isInMouseWheelScrollingMode = false;
|
||||||
touchLockedForMouseMove = nil;
|
touchLockedForMouseMove = nil;
|
||||||
mousePointerMoved = false; // need to reset this anyway
|
mousePointerMoved = false; // need to reset this anyway
|
||||||
[self resetAllPressedFlagsForOnscreenButtonViews]; // reset all pressed flag for on-screen button views after all fingers lifted from screen.
|
[self resetAllPressedFlagsForOnScreenWidgetViews]; // reset all pressed flag for on-screen widget views after all fingers lifted from screen.
|
||||||
touchPointSpawnedAtUpperScreenEdge = false;
|
touchPointSpawnedAtUpperScreenEdge = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
|
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
|
||||||
andConfig:(StreamConfiguration*)streamConfig;
|
andConfig:(StreamConfiguration*)streamConfig;
|
||||||
- (void) clearOnScreenKeyboardButtons;
|
- (void) clearOnScreenKeyboardButtons;
|
||||||
- (void) reloadOnScreenButtonViews;
|
- (void) reloadOnScreenWidgetViews;
|
||||||
|
|
||||||
- (CGSize) getVideoAreaSize;
|
- (CGSize) getVideoAreaSize;
|
||||||
- (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point;
|
- (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point;
|
||||||
|
|||||||
@@ -368,18 +368,18 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
- (void) clearOnScreenKeyboardButtons{
|
- (void) clearOnScreenKeyboardButtons{
|
||||||
for (UIView *subview in self->streamFrameTopLayerView.subviews) {
|
for (UIView *subview in self->streamFrameTopLayerView.subviews) {
|
||||||
// 检查子视图是否是特定类型的实例
|
// 检查子视图是否是特定类型的实例
|
||||||
if ([subview isKindOfClass:[OnScreenButtonView class]]) {
|
if ([subview isKindOfClass:[OnScreenWidgetView class]]) {
|
||||||
// 如果是,就添加到将要被移除的数组中
|
// 如果是,就添加到将要被移除的数组中
|
||||||
[subview removeFromSuperview];
|
[subview removeFromSuperview];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) reloadOnScreenButtonViews{
|
- (void) reloadOnScreenWidgetViews{
|
||||||
|
|
||||||
NSLog(@"reload on screen keyboard buttons here");
|
NSLog(@"reload on screen keyboard buttons here");
|
||||||
|
|
||||||
// remove all keyboard button views first
|
// remove all keyboard widget views first
|
||||||
[self clearOnScreenKeyboardButtons];
|
[self clearOnScreenKeyboardButtons];
|
||||||
|
|
||||||
// bool customOscEnabled = [self isOscEnabled] && settings.onscreenControls.intValue == OnScreenControlsLevelCustom;
|
// bool customOscEnabled = [self isOscEnabled] && settings.onscreenControls.intValue == OnScreenControlsLevelCustom;
|
||||||
@@ -389,25 +389,25 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
OSCProfilesManager* profilesManager = [OSCProfilesManager sharedManager];
|
OSCProfilesManager* profilesManager = [OSCProfilesManager sharedManager];
|
||||||
OSCProfile *oscProfile = [profilesManager getSelectedProfile]; //returns the currently selected OSCProfile
|
OSCProfile *oscProfile = [profilesManager getSelectedProfile]; //returns the currently selected OSCProfile
|
||||||
|
|
||||||
if(!OnScreenButtonView.editMode){ // in edit mode, keyboard button view will be updated within layoutool view controller.
|
if(!OnScreenWidgetView.editMode){ // in edit mode, keyboard widget view will be updated within layoutool view controller.
|
||||||
for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
|
for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
|
||||||
OnScreenButtonState* buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:buttonStateEncoded error:nil];
|
OnScreenButtonState* buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:buttonStateEncoded error:nil];
|
||||||
if(buttonState.buttonType == KeyboardOrMouseButton){
|
if(buttonState.buttonType == KeyboardOrMouseButton){
|
||||||
OnScreenButtonView* buttonView = [[OnScreenButtonView alloc] initWithKeyString:buttonState.name keyLabel:buttonState.alias]; //reconstruct buttonView
|
OnScreenWidgetView* widgetView = [[OnScreenWidgetView alloc] initWithKeyString:buttonState.name keyLabel:buttonState.alias]; //reconstruct widgetView
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
onScreenControls.delegate = buttonView; // connecting onScreenControls to OnScreenButtonView, sending the active instance for touchPad stick control
|
onScreenControls.delegate = widgetView; // connecting onScreenControls to OnScreenWidgetView, sending the active instance for touchPad stick control
|
||||||
[onScreenControls sendInstance];
|
[onScreenControls sendInstance];
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
buttonView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
||||||
buttonView.widthFactor = buttonState.widthFactor;
|
widgetView.widthFactor = buttonState.widthFactor;
|
||||||
buttonView.heightFactor = buttonState.heightFactor;
|
widgetView.heightFactor = buttonState.heightFactor;
|
||||||
buttonView.sensitivityFactor = buttonState.sensitivityFactor;
|
widgetView.sensitivityFactor = buttonState.sensitivityFactor;
|
||||||
buttonView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
|
widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
|
||||||
// Add the buttonView to the view controller's view
|
// Add the widgetView to the view controller's view
|
||||||
[self->streamFrameTopLayerView addSubview:buttonView]; // add keyboard button to the stream frame view. must add it to the target view before setting location.
|
[self->streamFrameTopLayerView addSubview:widgetView]; // 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];
|
[widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
|
||||||
[buttonView resizeButtonView]; // resize must be called after relocation
|
[widgetView resizeWidgetView]; // resize must be called after relocation
|
||||||
[buttonView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
[widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -20,10 +20,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
@interface LayoutOnScreenControlsViewController : UIViewController
|
@interface LayoutOnScreenControlsViewController : UIViewController
|
||||||
- (void)profileRefresh;
|
- (void)profileRefresh;
|
||||||
- (void)reloadOnScreenButtonViews;
|
- (void)reloadOnScreenWidgetViews;
|
||||||
|
|
||||||
@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 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;
|
@property (nonatomic) NSMutableDictionary* OnScreenWidgetViewsDict;
|
||||||
|
|
||||||
@property int OSCSegmentSelected;
|
@property int OSCSegmentSelected;
|
||||||
|
|
||||||
|
|||||||
+86
-85
@@ -22,10 +22,10 @@
|
|||||||
@implementation LayoutOnScreenControlsViewController {
|
@implementation LayoutOnScreenControlsViewController {
|
||||||
BOOL isToolbarHidden;
|
BOOL isToolbarHidden;
|
||||||
OSCProfilesManager* profilesManager;
|
OSCProfilesManager* profilesManager;
|
||||||
OnScreenButtonView* selectedButtonView;
|
OnScreenWidgetView* selectedWidgetView;
|
||||||
CALayer* selectedControllerLayer;
|
CALayer* selectedControllerLayer;
|
||||||
CGRect controllerLoadedBounds;
|
CGRect controllerLoadedBounds;
|
||||||
bool buttonViewSelected;
|
bool widgetViewSelected;
|
||||||
bool controllerLayerSelected;
|
bool controllerLayerSelected;
|
||||||
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone;
|
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone;
|
||||||
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad;
|
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad;
|
||||||
@@ -46,25 +46,25 @@
|
|||||||
|
|
||||||
|
|
||||||
- (void) viewWillDisappear:(BOOL)animated{
|
- (void) viewWillDisappear:(BOOL)animated{
|
||||||
OnScreenButtonView.editMode = false;
|
OnScreenWidgetView.editMode = false;
|
||||||
for (OnScreenButtonView* buttonView in self.onScreenButtonViewsDict.allValues){
|
for (OnScreenWidgetView* widgetView in self.OnScreenWidgetViewsDict.allValues){
|
||||||
[buttonView.stickBallLayer removeFromSuperlayer];
|
[widgetView.stickBallLayer removeFromSuperlayer];
|
||||||
[buttonView.crossMarkLayer removeFromSuperlayer];
|
[widgetView.crossMarkLayer removeFromSuperlayer];
|
||||||
}
|
}
|
||||||
[super viewWillDisappear:animated];
|
[super viewWillDisappear:animated];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) reloadOnScreenButtonViews {
|
- (void) reloadOnScreenWidgetViews {
|
||||||
for (UIView *subview in self.view.subviews) {
|
for (UIView *subview in self.view.subviews) {
|
||||||
// 检查子视图是否是特定类型的实例
|
// 检查子视图是否是特定类型的实例
|
||||||
if ([subview isKindOfClass:[OnScreenButtonView class]]) {
|
if ([subview isKindOfClass:[OnScreenWidgetView class]]) {
|
||||||
// 如果是,就添加到将要被移除的数组中
|
// 如果是,就添加到将要被移除的数组中
|
||||||
[subview removeFromSuperview];
|
[subview removeFromSuperview];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.onScreenButtonViewsDict removeAllObjects];
|
[self.OnScreenWidgetViewsDict removeAllObjects];
|
||||||
|
|
||||||
NSLog(@"reload os Key here");
|
NSLog(@"reload os Key here");
|
||||||
|
|
||||||
@@ -73,20 +73,20 @@
|
|||||||
for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
|
for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
|
||||||
OnScreenButtonState* buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:buttonStateEncoded error:nil];
|
OnScreenButtonState* buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:buttonStateEncoded error:nil];
|
||||||
if(buttonState.buttonType == KeyboardOrMouseButton){
|
if(buttonState.buttonType == KeyboardOrMouseButton){
|
||||||
OnScreenButtonView* buttonView = [[OnScreenButtonView alloc] initWithKeyString:buttonState.name keyLabel:buttonState.alias]; //reconstruct buttonView
|
OnScreenWidgetView* widgetView = [[OnScreenWidgetView alloc] initWithKeyString:buttonState.name keyLabel:buttonState.alias]; //reconstruct widgetView
|
||||||
buttonView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
||||||
buttonView.timestamp = buttonState.timestamp; // will be set as key in in the dict.
|
widgetView.timestamp = buttonState.timestamp; // will be set as key in in the dict.
|
||||||
buttonView.widthFactor = buttonState.widthFactor;
|
widgetView.widthFactor = buttonState.widthFactor;
|
||||||
buttonView.heightFactor = buttonState.heightFactor;
|
widgetView.heightFactor = buttonState.heightFactor;
|
||||||
buttonView.sensitivityFactor = buttonState.sensitivityFactor;
|
widgetView.sensitivityFactor = buttonState.sensitivityFactor;
|
||||||
buttonView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
|
widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
|
||||||
// buttonView.backgroundAlpha = buttonState.backgroundAlpha;
|
// widgetView.backgroundAlpha = buttonState.backgroundAlpha;
|
||||||
// Add the buttonView to the view controller's view
|
// Add the widgetView to the view controller's view
|
||||||
[self.view addSubview:buttonView];
|
[self.view addSubview:widgetView];
|
||||||
[buttonView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
|
[widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
|
||||||
[buttonView resizeButtonView]; // resize must be called after relocation
|
[widgetView resizeWidgetView]; // resize must be called after relocation
|
||||||
[buttonView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
[widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
|
||||||
[self.onScreenButtonViewsDict setObject:buttonView forKey:@(buttonView.timestamp)];
|
[self.OnScreenWidgetViewsDict setObject:widgetView forKey:@(widgetView.timestamp)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,8 +95,8 @@
|
|||||||
- (void) viewDidLoad {
|
- (void) viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
profilesManager = [OSCProfilesManager sharedManager];
|
profilesManager = [OSCProfilesManager sharedManager];
|
||||||
self.onScreenButtonViewsDict = [[NSMutableDictionary alloc] init]; // will be revised to read persisted data , somewhere else
|
self.OnScreenWidgetViewsDict = [[NSMutableDictionary alloc] init]; // will be revised to read persisted data , somewhere else
|
||||||
[OSCProfilesManager setOnScreenButtonViewsDict:self.onScreenButtonViewsDict]; // pass the keyboard button dict to profiles manager
|
[OSCProfilesManager setOnScreenWidgetViewsDict:self.OnScreenWidgetViewsDict]; // pass the keyboard button dict to profiles manager
|
||||||
|
|
||||||
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
|
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
|
||||||
|
|
||||||
@@ -127,6 +127,7 @@
|
|||||||
|
|
||||||
self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected];
|
self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected];
|
||||||
self.layoutOSC._level = OnScreenControlsLevelCustom;
|
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 addInnerAnalogSticksToOuterAnalogLayers]; // allows inner and analog sticks to be dragged together around the screen together as one unit which is the expected behavior
|
||||||
@@ -144,13 +145,13 @@
|
|||||||
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(reloadOnScreenButtonViews)
|
selector:@selector(reloadOnScreenWidgetViews)
|
||||||
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
|
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];
|
object:nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(buttonViewTapped:)
|
selector:@selector(widgetViewTapped:)
|
||||||
name:@"OnScreenButtonViewSelected"
|
name:@"OnScreenWidgetViewSelected"
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
@@ -190,7 +191,7 @@
|
|||||||
|
|
||||||
|
|
||||||
- (void) viewDidAppear:(BOOL)animated {
|
- (void) viewDidAppear:(BOOL)animated {
|
||||||
OnScreenButtonView.editMode = true;
|
OnScreenWidgetView.editMode = true;
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
[self profileRefresh];
|
[self profileRefresh];
|
||||||
}
|
}
|
||||||
@@ -354,14 +355,14 @@
|
|||||||
if(noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString && noValidSpecialButtonString) return;
|
if(noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString && noValidSpecialButtonString) return;
|
||||||
|
|
||||||
//saving & present the keyboard button:
|
//saving & present the keyboard button:
|
||||||
OnScreenButtonView* buttonView = [[OnScreenButtonView alloc] initWithKeyString:cmdString keyLabel:keyLabel];
|
OnScreenWidgetView* widgetView = [[OnScreenWidgetView alloc] initWithKeyString:cmdString keyLabel:keyLabel];
|
||||||
buttonView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
||||||
buttonView.timestamp = CACurrentMediaTime(); // will be set as key in in the dict.
|
widgetView.timestamp = CACurrentMediaTime(); // will be set as key in in the dict.
|
||||||
[self.onScreenButtonViewsDict setObject:buttonView forKey:@(buttonView.timestamp)];
|
[self.OnScreenWidgetViewsDict setObject:widgetView forKey:@(widgetView.timestamp)];
|
||||||
// Add the buttonView to the view controller's view
|
// Add the widgetView to the view controller's view
|
||||||
[self.view addSubview:buttonView];
|
[self.view addSubview:widgetView];
|
||||||
[buttonView setLocationWithXOffset:50 yOffset:50];
|
[widgetView setLocationWithXOffset:50 yOffset:50];
|
||||||
[buttonView resizeButtonView];
|
[widgetView resizeWidgetView];
|
||||||
}];
|
}];
|
||||||
[alertController addAction:cancelAction];
|
[alertController addAction:cancelAction];
|
||||||
[alertController addAction:okAction];
|
[alertController addAction:okAction];
|
||||||
@@ -388,48 +389,48 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)buttonViewTapped: (NSNotification *)notification{
|
- (void)widgetViewTapped: (NSNotification *)notification{
|
||||||
// receive the selected buttonView obj passed from the notification
|
// receive the selected widgetView obj passed from the notification
|
||||||
OnScreenButtonView* buttonView = (OnScreenButtonView* )notification.object;
|
OnScreenWidgetView* widgetView = (OnScreenWidgetView* )notification.object;
|
||||||
self->buttonViewSelected = true;
|
self->widgetViewSelected = true;
|
||||||
self->controllerLayerSelected = false;
|
self->controllerLayerSelected = false;
|
||||||
self->selectedButtonView = buttonView;
|
self->selectedWidgetView = widgetView;
|
||||||
// setup slider values
|
// setup slider values
|
||||||
[self.widgetSizeSlider setValue: self->selectedButtonView.widthFactor];
|
[self.widgetSizeSlider setValue: self->selectedWidgetView.widthFactor];
|
||||||
[self.widgetHeightSlider setValue: self->selectedButtonView.heightFactor];
|
[self.widgetHeightSlider setValue: self->selectedWidgetView.heightFactor];
|
||||||
[self.widgetAlphaSlider setValue: self->selectedButtonView.backgroundAlpha];
|
[self.widgetAlphaSlider setValue: self->selectedWidgetView.backgroundAlpha];
|
||||||
|
|
||||||
NSSet *stickAndMouseTouchpads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", @"LSVPAD", @"RSVPAD", @"MOUSEPAD", nil];
|
NSSet *stickAndMouseTouchpads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", @"LSVPAD", @"RSVPAD", @"MOUSEPAD", nil];
|
||||||
NSSet *nonVectorStickPads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", nil];
|
NSSet *nonVectorStickPads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", nil];
|
||||||
|
|
||||||
|
|
||||||
bool showSensitivityFactorSlider = [stickAndMouseTouchpads containsObject:self->selectedButtonView.keyString];
|
bool showSensitivityFactorSlider = [stickAndMouseTouchpads containsObject:self->selectedWidgetView.keyString];
|
||||||
bool showStickIndicatorOffsetSlider = [nonVectorStickPads containsObject:self->selectedButtonView.keyString];
|
bool showStickIndicatorOffsetSlider = [nonVectorStickPads containsObject:self->selectedWidgetView.keyString];
|
||||||
self.sensitivityFactorSlider.hidden = self->sensitivitySliderLabel.hidden = !showSensitivityFactorSlider;
|
self.sensitivityFactorSlider.hidden = self->sensitivitySliderLabel.hidden = !showSensitivityFactorSlider;
|
||||||
self.stickIndicatorOffsetSlider.hidden = self->stickIndicatorOffsetExplain.hidden = self->stickIndicatorOffsetSliderLabel.hidden = !showStickIndicatorOffsetSlider;
|
self.stickIndicatorOffsetSlider.hidden = self->stickIndicatorOffsetExplain.hidden = self->stickIndicatorOffsetSliderLabel.hidden = !showStickIndicatorOffsetSlider;
|
||||||
if(showSensitivityFactorSlider){
|
if(showSensitivityFactorSlider){
|
||||||
[self.sensitivityFactorSlider setValue:self->selectedButtonView.sensitivityFactor];
|
[self.sensitivityFactorSlider setValue:self->selectedWidgetView.sensitivityFactor];
|
||||||
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self->selectedButtonView.sensitivityFactor]];
|
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self->selectedWidgetView.sensitivityFactor]];
|
||||||
}
|
}
|
||||||
if(showStickIndicatorOffsetSlider){
|
if(showStickIndicatorOffsetSlider){
|
||||||
// illustrating the indicator offset,
|
// illustrating the indicator offset,
|
||||||
[selectedButtonView.stickBallLayer removeFromSuperlayer];
|
[selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||||
[selectedButtonView.crossMarkLayer removeFromSuperlayer];
|
[selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||||
selectedButtonView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedButtonView.frame)/2, CGRectGetHeight(selectedButtonView.frame)/4);
|
selectedWidgetView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedWidgetView.frame)/2, CGRectGetHeight(selectedWidgetView.frame)/4);
|
||||||
[selectedButtonView showStickIndicator];// this will create the indicator CAShapeLayers
|
[selectedWidgetView showStickIndicator];// this will create the indicator CAShapeLayers
|
||||||
[self.stickIndicatorOffsetSlider setValue:self->selectedButtonView.stickIndicatorXOffset];
|
[self.stickIndicatorOffsetSlider setValue:self->selectedWidgetView.stickIndicatorXOffset];
|
||||||
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f", self->selectedButtonView.stickIndicatorXOffset]];
|
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f", self->selectedWidgetView.stickIndicatorXOffset]];
|
||||||
[self->selectedButtonView updateStickIndicator];
|
[self->selectedWidgetView updateStickIndicator];
|
||||||
}
|
}
|
||||||
[widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedButtonView.widthFactor]];
|
[widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedWidgetView.widthFactor]];
|
||||||
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedButtonView.heightFactor]];
|
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedWidgetView.heightFactor]];
|
||||||
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedButtonView.backgroundAlpha]];
|
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedWidgetView.backgroundAlpha]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setControllerCALayerSliderValues: (NSNotification *)notification{
|
- (void)setControllerCALayerSliderValues: (NSNotification *)notification{
|
||||||
// receive the selected buttonView obj passed from the notification
|
// receive the selected widgetView obj passed from the notification
|
||||||
CALayer* controllerLayer = (CALayer* )notification.object;
|
CALayer* controllerLayer = (CALayer* )notification.object;
|
||||||
self->buttonViewSelected = false;
|
self->widgetViewSelected = false;
|
||||||
self->stickIndicatorOffsetExplain.hidden = true;
|
self->stickIndicatorOffsetExplain.hidden = true;
|
||||||
self->stickIndicatorOffsetSliderLabel.hidden = true;
|
self->stickIndicatorOffsetSliderLabel.hidden = true;
|
||||||
self.stickIndicatorOffsetSlider.hidden = true;
|
self.stickIndicatorOffsetSlider.hidden = true;
|
||||||
@@ -457,11 +458,11 @@
|
|||||||
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetSizeSlider.value]]; // resizing the whole button
|
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetSizeSlider.value]]; // resizing the whole button
|
||||||
[self.widgetHeightSlider setValue: self.widgetSizeSlider.value];
|
[self.widgetHeightSlider setValue: self.widgetSizeSlider.value];
|
||||||
|
|
||||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||||
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
self->selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
||||||
// when adjusting width, the buttonView height will be syncronized
|
// when adjusting width, the widgetView height will be syncronized
|
||||||
self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.widgetSizeSlider.value;
|
self->selectedWidgetView.widthFactor = self->selectedWidgetView.heightFactor = self.widgetSizeSlider.value;
|
||||||
[self->selectedButtonView resizeButtonView];
|
[self->selectedWidgetView resizeWidgetView];
|
||||||
}
|
}
|
||||||
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
||||||
[self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.widgetSizeSlider.value];
|
[self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.widgetSizeSlider.value];
|
||||||
@@ -470,18 +471,18 @@
|
|||||||
|
|
||||||
- (void)widgetHeightSliderMoved{
|
- (void)widgetHeightSliderMoved{
|
||||||
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]];
|
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]];
|
||||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||||
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
self->selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
|
||||||
if([CommandManager.oscButtonMappings.allKeys containsObject:selectedButtonView.keyString]) return; // don't change custom osc button height
|
if([CommandManager.oscButtonMappings.allKeys containsObject:selectedWidgetView.keyString]) return; // don't change custom osc button height
|
||||||
self->selectedButtonView.heightFactor = self.widgetHeightSlider.value;
|
self->selectedWidgetView.heightFactor = self.widgetHeightSlider.value;
|
||||||
[self->selectedButtonView resizeButtonView];
|
[self->selectedWidgetView resizeWidgetView];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)widgetAlphaSliderMoved{
|
- (void)widgetAlphaSliderMoved{
|
||||||
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.widgetAlphaSlider.value]];
|
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.widgetAlphaSlider.value]];
|
||||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||||
[self->selectedButtonView adjustButtonTransparencyWithAlpha:self.widgetAlphaSlider.value];
|
[self->selectedWidgetView adjustButtonTransparencyWithAlpha:self.widgetAlphaSlider.value];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
|
||||||
@@ -492,22 +493,22 @@
|
|||||||
|
|
||||||
- (void)sensitivitySliderMoved{
|
- (void)sensitivitySliderMoved{
|
||||||
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self.sensitivityFactorSlider.value]];
|
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self.sensitivityFactorSlider.value]];
|
||||||
if(self->selectedButtonView != nil && self->buttonViewSelected) self->selectedButtonView.sensitivityFactor = self.sensitivityFactorSlider.value;
|
if(self->selectedWidgetView != nil && self->widgetViewSelected) self->selectedWidgetView.sensitivityFactor = self.sensitivityFactorSlider.value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stickIndicatorOffsetSliderMoved{
|
- (void)stickIndicatorOffsetSliderMoved{
|
||||||
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f", self.stickIndicatorOffsetSlider.value]];
|
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f", self.stickIndicatorOffsetSlider.value]];
|
||||||
if(self->selectedButtonView != nil && self->buttonViewSelected){
|
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||||
self->selectedButtonView.stickIndicatorXOffset = self.stickIndicatorOffsetSlider.value;
|
self->selectedWidgetView.stickIndicatorXOffset = self.stickIndicatorOffsetSlider.value;
|
||||||
[self->selectedButtonView updateStickIndicator];
|
[self->selectedWidgetView updateStickIndicator];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showIndicatorOffset{
|
- (void)showIndicatorOffset{
|
||||||
selectedButtonView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedButtonView.frame)/2, CGRectGetHeight(selectedButtonView.frame)/4);
|
selectedWidgetView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedWidgetView.frame)/2, CGRectGetHeight(selectedWidgetView.frame)/4);
|
||||||
[selectedButtonView showStickIndicator];
|
[selectedWidgetView showStickIndicator];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setupProfileLableAndSliders{
|
- (void)setupProfileLableAndSliders{
|
||||||
@@ -671,7 +672,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
[self.oscProfilesTableViewController profileViewRefresh]; // execute this will make sure OSCLayout is updated from persisted profile, not any cache.
|
[self.oscProfilesTableViewController profileViewRefresh]; // execute this will make sure OSCLayout is updated from persisted profile, not any cache.
|
||||||
[self reloadOnScreenButtonViews];
|
[self reloadOnScreenWidgetViews];
|
||||||
|
|
||||||
// [self presentViewController:vc animated:YES completion:nil];
|
// [self presentViewController:vc animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
@@ -768,11 +769,11 @@
|
|||||||
// removing keyboard buttons objs
|
// removing keyboard buttons objs
|
||||||
UITouch *touch = [touches anyObject]; // Get the first touch in the set
|
UITouch *touch = [touches anyObject]; // Get the first touch in the set
|
||||||
if([self touchWithinTashcanButton:touch]){
|
if([self touchWithinTashcanButton:touch]){
|
||||||
[self.onScreenButtonViewsDict[@(OnScreenButtonView.timestampOfButtonBeingDragged)] removeFromSuperview];
|
[self.OnScreenWidgetViewsDict[@(OnScreenWidgetView.timestampOfButtonBeingDragged)] removeFromSuperview];
|
||||||
[self.onScreenButtonViewsDict removeObjectForKey:@(OnScreenButtonView.timestampOfButtonBeingDragged)];
|
[self.OnScreenWidgetViewsDict removeObjectForKey:@(OnScreenWidgetView.timestampOfButtonBeingDragged)];
|
||||||
[selectedButtonView.stickBallLayer removeFromSuperlayer];
|
[selectedWidgetView.stickBallLayer removeFromSuperlayer];
|
||||||
[selectedButtonView.crossMarkLayer removeFromSuperlayer];
|
[selectedWidgetView.crossMarkLayer removeFromSuperlayer];
|
||||||
OnScreenButtonView.timestampOfButtonBeingDragged = 0; //reset thie timestamp
|
OnScreenWidgetView.timestampOfButtonBeingDragged = 0; //reset thie timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
UIView *_streamVideoRenderView;
|
UIView *_streamVideoRenderView;
|
||||||
/*
|
/*
|
||||||
* View architecture of this viewController:
|
* View architecture of this viewController:
|
||||||
* self.view (named `streamFrameTopLayerView` in StreamView.m, where slide & tap gestures, and onScreenControls & onScreenButtonView buttons are registered)
|
* self.view (named `streamFrameTopLayerView` in StreamView.m, where slide & tap gestures, and onScreenControls & OnScreenWidgetView buttons are registered)
|
||||||
* - streamView (where touchHandlers are registered)
|
* - streamView (where touchHandlers are registered)
|
||||||
* - streamVideoRenderView (where stream view is rendered)
|
* - streamVideoRenderView (where stream view is rendered)
|
||||||
*/
|
*/
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
||||||
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
||||||
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
||||||
[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
|
[self->_streamView reloadOnScreenWidgetViews]; //reload keyboard buttons here. the keyboard widget view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
|
||||||
[self reloadAirPlayConfig];
|
[self reloadAirPlayConfig];
|
||||||
[self mousePresenceChanged];
|
[self mousePresenceChanged];
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@
|
|||||||
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
|
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
|
||||||
andConfig:(StreamConfiguration*)_streamConfig];
|
andConfig:(StreamConfiguration*)_streamConfig];
|
||||||
[self->_streamView showOnScreenControls];
|
[self->_streamView showOnScreenControls];
|
||||||
[self->_streamView reloadOnScreenButtonViews]; //update keyboard buttons here
|
[self->_streamView reloadOnScreenWidgetViews]; //update keyboard buttons here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
840751B32BF49C050096B657 /* CustomTapGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 840751B22BF49C050096B657 /* CustomTapGestureRecognizer.m */; };
|
840751B32BF49C050096B657 /* CustomTapGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 840751B22BF49C050096B657 /* CustomTapGestureRecognizer.m */; };
|
||||||
84203F232C5F24C00032EEED /* OnScreenButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84203F222C5F24C00032EEED /* OnScreenButtonView.swift */; };
|
84203F232C5F24C00032EEED /* OnScreenWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84203F222C5F24C00032EEED /* OnScreenWidgetView.swift */; };
|
||||||
84351B0E2C29ACCB00A77989 /* LayoutOnScreenControls.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B072C29ACCA00A77989 /* LayoutOnScreenControls.m */; };
|
84351B0E2C29ACCB00A77989 /* LayoutOnScreenControls.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B072C29ACCA00A77989 /* LayoutOnScreenControls.m */; };
|
||||||
84351B0F2C29ACCB00A77989 /* OnScreenButtonState.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B092C29ACCA00A77989 /* OnScreenButtonState.m */; };
|
84351B0F2C29ACCB00A77989 /* OnScreenButtonState.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B092C29ACCA00A77989 /* OnScreenButtonState.m */; };
|
||||||
84351B102C29ACCB00A77989 /* OSCProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B0A2C29ACCA00A77989 /* OSCProfile.m */; };
|
84351B102C29ACCB00A77989 /* OSCProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 84351B0A2C29ACCA00A77989 /* OSCProfile.m */; };
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
693B3A9A218638CD00982F7B /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
693B3A9A218638CD00982F7B /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
||||||
840751B12BF49B5A0096B657 /* CustomTapGestureRecognizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomTapGestureRecognizer.h; sourceTree = "<group>"; };
|
840751B12BF49B5A0096B657 /* CustomTapGestureRecognizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomTapGestureRecognizer.h; sourceTree = "<group>"; };
|
||||||
840751B22BF49C050096B657 /* CustomTapGestureRecognizer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomTapGestureRecognizer.m; sourceTree = "<group>"; };
|
840751B22BF49C050096B657 /* CustomTapGestureRecognizer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomTapGestureRecognizer.m; sourceTree = "<group>"; };
|
||||||
84203F222C5F24C00032EEED /* OnScreenButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnScreenButtonView.swift; sourceTree = "<group>"; };
|
84203F222C5F24C00032EEED /* OnScreenWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnScreenWidgetView.swift; sourceTree = "<group>"; };
|
||||||
84351B062C29ACCA00A77989 /* OnScreenButtonState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnScreenButtonState.h; sourceTree = "<group>"; };
|
84351B062C29ACCA00A77989 /* OnScreenButtonState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnScreenButtonState.h; sourceTree = "<group>"; };
|
||||||
84351B072C29ACCA00A77989 /* LayoutOnScreenControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LayoutOnScreenControls.m; sourceTree = "<group>"; };
|
84351B072C29ACCA00A77989 /* LayoutOnScreenControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LayoutOnScreenControls.m; sourceTree = "<group>"; };
|
||||||
84351B082C29ACCA00A77989 /* OSCProfilesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSCProfilesManager.h; sourceTree = "<group>"; };
|
84351B082C29ACCA00A77989 /* OSCProfilesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSCProfilesManager.h; sourceTree = "<group>"; };
|
||||||
@@ -630,7 +630,7 @@
|
|||||||
988FCD3F293B091B003050E2 /* KeyboardInputField.h */,
|
988FCD3F293B091B003050E2 /* KeyboardInputField.h */,
|
||||||
988FCD40293B091B003050E2 /* KeyboardInputField.m */,
|
988FCD40293B091B003050E2 /* KeyboardInputField.m */,
|
||||||
84E1CDEB2C4F67D300547904 /* CommandManager.swift */,
|
84E1CDEB2C4F67D300547904 /* CommandManager.swift */,
|
||||||
84203F222C5F24C00032EEED /* OnScreenButtonView.swift */,
|
84203F222C5F24C00032EEED /* OnScreenWidgetView.swift */,
|
||||||
);
|
);
|
||||||
path = Input;
|
path = Input;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1036,7 +1036,7 @@
|
|||||||
FBDE86E019F7A837001C18A8 /* UIComputerView.m in Sources */,
|
FBDE86E019F7A837001C18A8 /* UIComputerView.m in Sources */,
|
||||||
FB89463019F646E200339C8A /* StreamConfiguration.m in Sources */,
|
FB89463019F646E200339C8A /* StreamConfiguration.m in Sources */,
|
||||||
FBD3495319FF36FB002D2A60 /* SWRevealViewController.m in Sources */,
|
FBD3495319FF36FB002D2A60 /* SWRevealViewController.m in Sources */,
|
||||||
84203F232C5F24C00032EEED /* OnScreenButtonView.swift in Sources */,
|
84203F232C5F24C00032EEED /* OnScreenWidgetView.swift in Sources */,
|
||||||
84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */,
|
84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */,
|
||||||
FB1D59971BBCCB6400F482CA /* ComputerScrollView.m in Sources */,
|
FB1D59971BBCCB6400F482CA /* ComputerScrollView.m in Sources */,
|
||||||
FBD3495019FF2174002D2A60 /* SettingsViewController.m in Sources */,
|
FBD3495019FF2174002D2A60 /* SettingsViewController.m in Sources */,
|
||||||
|
|||||||
Reference in new issue
Block a user