Browse Source

【2025】【组件库】menu菜单超出页面windows显示不全问题解决

dinglingui 4 months ago
parent
commit
ba9b1b1c76

+ 7 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/GroupItem/ComponentGroup.swift

@@ -160,6 +160,13 @@ public class ComponentGroup: NSView, NibLoadable {
             rect.origin.x += subView.window?.frame.origin.x ?? 0
             rect.origin.y += subView.window?.frame.origin.y ?? 0
             
+            if(rect.origin.y < 0) {
+                rect.origin.y = 0
+            }
+            
+            if(CGRectGetMaxX(rect) > CGRectGetMaxX(screenRect)) {
+                rect.origin.x = CGRectGetMaxX(screenRect) - rect.width
+            }
             frame = rect
             
             contentWindow.contentView?.addSubview(self)