widget layout tool fixes

This commit is contained in:
True Zhuanjia
2026-05-30 11:05:30 +08:00
parent 9979408b1a
commit e734973be1
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -107,6 +107,7 @@ import ObjectiveC.runtime
@objc public var logicallyDown: Bool = false
@objc public var isOverlappingWithTrashcan: Bool = false
@objc public var isBeingResized: Bool = false
@objc public var widthFactor: CGFloat = 1.0 {
didSet{
@@ -2236,6 +2237,7 @@ import ObjectiveC.runtime
}
// here is in edit mode:
else{
OnScreenWidgetView.capturer = nil
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
}
@@ -2275,7 +2277,7 @@ import ObjectiveC.runtime
widget.highlightBorder(highlighted: true, color: standardHighlightColor.cgColor)
}
else if widget.isFolder {
if isLocation(currentLocation, in: widget), !self.sequenceSet.contains(widget.sequence), !widget.isHidden {
if isLocation(currentLocation, in: widget), !self.sequenceSet.contains(widget.sequence), !widget.isHidden, !widget.isOverlappingWithTrashcan {
// self.layer.borderColor = UIColor.systemYellow.cgColor
widget.highlightBorder(highlighted: true)
OnScreenWidgetView.capturer = widget
@@ -1548,6 +1548,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
layoutOSC.updateGuidelinesFor(onScreenWidget: widget)
view.bringSubviewToFront(widget)
let overlapping = layerIsOverlappingWithTrashcanButton(widget.layer)
selectedWidget?.isOverlappingWithTrashcan = overlapping
let color = overlapping ? UIColor.red : trashCanStoryBoardColor ?? UIColor.systemTeal
trashCanButton.tintColor = color
trashCanButton.titleLabel?.textColor = color
@@ -2489,7 +2490,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
let commonLayer = view.layer
let rect1 = layer.convert(layer.bounds, to: commonLayer)
let rect2 = trashCanButton.layer.convert(trashCanButton.layer.bounds, to: commonLayer)
return rect1.intersects(rect2)
return rect1.intersects(rect2) && !self.isToolbarHidden
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {