enable track point for onscreen widget edit mode

This commit is contained in:
True Zhuanjia committed 2026-03-04 13:06:22 +08:00
1 parent 8cd366d2cd
commit acc89dba39
2 files changed
+38 -25

No files matched your search

+22 -22
View File
@@ -1898,22 +1898,22 @@ import SVGKit
OnScreenWidgetView.updateStreamViewGuidelines(for: self)
}
}
if self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
CATransaction.begin()
CATransaction.setDisableActions(true)
if let touch = touches.first {
trackPoint.isHidden = false
trackPoint.position = touch.location(in: self)
}
CATransaction.commit()
}
}
// here is in edit mode:
else{
self.handleButtonDown()
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 self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
CATransaction.begin()
CATransaction.setDisableActions(true)
if let touch = touches.first {
trackPoint.isHidden = false
trackPoint.position = touch.location(in: self)
}
CATransaction.commit()
}
}
private func moveByTouch(touch: UITouch){
@@ -2108,18 +2108,6 @@ import SVGKit
self.moveByTouch(touch: touch)
}
}
if self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
if let touch = touches.first {
CATransaction.begin()
CATransaction.setDisableActions(true)
if trackPoint.isHidden {
trackPoint.isHidden = false
}
trackPoint.position = touch.location(in: self)
CATransaction.commit()
}
}
}
// Move the widgetView based on touch movement in relocation mode
@@ -2130,6 +2118,18 @@ import SVGKit
self.lrudIndicatorBall.removeFromSuperlayer()
self.crossMarkLayer.removeFromSuperlayer()
}
if self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
if let touch = touches.first {
CATransaction.begin()
CATransaction.setDisableActions(true)
if trackPoint.isHidden {
trackPoint.isHidden = false
}
trackPoint.position = touch.location(in: self)
CATransaction.commit()
}
}
}
func isAdjacentPoints(_ currentPoint: CGPoint, from originalPoint: CGPoint, tolerance: CGFloat) -> Bool {
@@ -56,6 +56,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
bool widgetViewSelected;
bool controllerLayerSelected;
bool viewWillBeResized;
bool originalTrackPointEnabled;
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone;
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad;
UIColor* trashCanStoryBoardColor;
@@ -150,6 +151,12 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
// _activeCustomOscButtonPositionDict will be updated every time when the osc profile is reloaded
OSCProfile *oscProfile = [self->profilesManager getSelectedProfile]; //returns the currently selected OSCProfile
NSLog(@"reloadOnScreenWidgets %lu", oscProfile.buttonStatesEncoded.count);
if(!_quickSwitchEnabled){
self->originalTrackPointEnabled = OnScreenWidgetView.trackPointEnabled;
OnScreenWidgetView.trackPointEnabled = true;
}
bool hasLegacyWidget = false;
for (NSData *buttonStateEncoded in oscProfile.buttonStatesEncoded) {
// OnScreenButtonState* buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:buttonStateEncoded error:nil];
@@ -566,7 +573,9 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
- (IBAction) closeTapped:(id)sender {
[self clearSickInput];
[self dismissViewControllerAnimated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:^{
OnScreenWidgetView.trackPointEnabled = self->originalTrackPointEnabled;
}];
}
- (IBAction) trashCanTapped:(id)sender {
@@ -1717,7 +1726,11 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
}
- (void)handleProfileTablViewDismiss{
if(_quickSwitchEnabled) [self dismissViewControllerAnimated:NO completion:nil];
if(_quickSwitchEnabled){
[self clearOnScreenWidgets];
[self dismissViewControllerAnimated:NO completion:^{
}];
}
else [self setupWidgetPanel];
// setup: current profile lable, button width slider, button height slider & button alpha slider
}
@@ -1772,7 +1785,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
__weak typeof(self) weakSelf = 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 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
if(!pickProfile || true) [weakSelf reloadOnScreenWidgetViews];
if(!pickProfile) [weakSelf reloadOnScreenWidgetViews];
};
self.widgetPanelStack.hidden = YES;