- onScreenWidget guidelines alignment with OnScreenControl CALayers

- stage manager version
This commit is contained in:
TrueZhuangjia
2025-01-29 21:13:38 +08:00
parent 9b9b278a14
commit 301c8580c8
6 changed files with 80 additions and 12 deletions
+8 -4
View File
@@ -683,7 +683,7 @@ import UIKit
self.onScreenControls.sendLeftStickTouchPadEvent(targetX, targetY)
}
//==========================================================================================================
// Touch event handling
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
@@ -781,11 +781,15 @@ import UIKit
private func moveByTouch(touch: UITouch){
let currentLocation = touch.location(in: superview)
let offsetX = currentLocation.x - storedLocation.x
let offsetY = currentLocation.y - storedLocation.y
center = CGPoint(x: center.x + offsetX, y: center.y + offsetY)
// let offsetX = currentLocation.x - storedLocation.x
// let offsetY = currentLocation.y - storedLocation.y
// center = CGPoint(x: center.x + offsetX, y: center.y + offsetY)
center = currentLocation;
//NSLog("x coord: %f, y coord: %f", self.frame.origin.x, self.frame.origin.y)
storedLocation = currentLocation // Update initial center for next movement
if OnScreenWidgetView.editMode {
NotificationCenter.default.post(name: Notification.Name("OnScreenWidgetMovedByTouch"), object:self) // inform the layoutOnScreenControl to update guideLines for this widget view
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {