From 551af859010c5205959a46fa79e483850257420e Mon Sep 17 00:00:00 2001 From: rich2014 Date: Fri, 5 Jul 2024 21:13:12 +0800 Subject: [PATCH] Cocoa: ensure that in extreme cases, the Scroller can remain Horizontal/Vertical unchanged --- lcl/interfaces/cocoa/cocoascrollers.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoascrollers.pas b/lcl/interfaces/cocoa/cocoascrollers.pas index 85f7680fcc..10c50cc9c3 100644 --- a/lcl/interfaces/cocoa/cocoascrollers.pas +++ b/lcl/interfaces/cocoa/cocoascrollers.pas @@ -1680,11 +1680,17 @@ begin vertScrollerFrame.origin.x := docFrame.size.width - vertScrollerFrame.size.width; vertScrollerFrame.origin.y := docFrame.origin.y; - if Assigned(horzScroller) then + if Assigned(horzScroller) then begin + if horzScrollerFrame.size.width <= horzScrollerFrame.size.height then + horzScrollerFrame.size.width:= horzScrollerFrame.size.height + 1; horzScroller.setFrame(horzScrollerFrame); + end; - if Assigned(vertScroller) then + if Assigned(vertScroller) then begin + if vertScrollerFrame.size.height <= vertScrollerFrame.size.width then + vertScrollerFrame.size.height:= vertScrollerFrame.size.width + 1; vertScroller.setFrame(vertScrollerFrame); + end; if not NSEqualRects(doc.frame, docFrame) then begin