widget layout tool fixes

This commit is contained in:
True Zhuanjia committed 2026-05-30 11:05:30 +08:00
1 parent 9979408b1a
commit e734973be1
2 files changed
+5 -2

No files matched your search

+3 -1
View File
@@ -107,6 +107,7 @@ import ObjectiveC.runtime
@objc public var logicallyDown: Bool = false @objc public var logicallyDown: Bool = false
@objc public var isOverlappingWithTrashcan: Bool = false
@objc public var isBeingResized: Bool = false @objc public var isBeingResized: Bool = false
@objc public var widthFactor: CGFloat = 1.0 { @objc public var widthFactor: CGFloat = 1.0 {
didSet{ didSet{
@@ -2236,6 +2237,7 @@ import ObjectiveC.runtime
} }
// here is in edit mode: // here is in edit mode:
else{ else{
OnScreenWidgetView.capturer = nil
self.handleButtonDown() 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 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) widget.highlightBorder(highlighted: true, color: standardHighlightColor.cgColor)
} }
else if widget.isFolder { 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 // self.layer.borderColor = UIColor.systemYellow.cgColor
widget.highlightBorder(highlighted: true) widget.highlightBorder(highlighted: true)
OnScreenWidgetView.capturer = widget OnScreenWidgetView.capturer = widget
@@ -1548,6 +1548,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
layoutOSC.updateGuidelinesFor(onScreenWidget: widget) layoutOSC.updateGuidelinesFor(onScreenWidget: widget)
view.bringSubviewToFront(widget) view.bringSubviewToFront(widget)
let overlapping = layerIsOverlappingWithTrashcanButton(widget.layer) let overlapping = layerIsOverlappingWithTrashcanButton(widget.layer)
selectedWidget?.isOverlappingWithTrashcan = overlapping
let color = overlapping ? UIColor.red : trashCanStoryBoardColor ?? UIColor.systemTeal let color = overlapping ? UIColor.red : trashCanStoryBoardColor ?? UIColor.systemTeal
trashCanButton.tintColor = color trashCanButton.tintColor = color
trashCanButton.titleLabel?.textColor = color trashCanButton.titleLabel?.textColor = color
@@ -2489,7 +2490,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
let commonLayer = view.layer let commonLayer = view.layer
let rect1 = layer.convert(layer.bounds, to: commonLayer) let rect1 = layer.convert(layer.bounds, to: commonLayer)
let rect2 = trashCanButton.layer.convert(trashCanButton.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?) { override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {