mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 05:36:22 +02:00
Cocoa: Trackpad Tapping in ManualScrollView supported
This commit is contained in:
parent
35cb0e2579
commit
08653013fd
@ -254,6 +254,8 @@ type
|
||||
procedure delayShowScrollBars; message 'delayShowScrollBars';
|
||||
procedure showScrollBarsAndAutoHide( tapping:Integer ); message 'showScrollBarsAndAutoHide:';
|
||||
|
||||
function isTapping( scroller:NSScroller ): Boolean; message 'isTapping:';
|
||||
procedure onBarScrolled( scroller:NSScroller ); message 'onBarScrolled:';
|
||||
procedure touchesBeganWithEvent(event: NSEvent); override;
|
||||
procedure touchesEndedWithEvent(event: NSEvent); override;
|
||||
procedure touchesCancelledWithEvent(event: NSEvent); override;
|
||||
@ -763,6 +765,33 @@ begin
|
||||
Result:=fdocumentView;
|
||||
end;
|
||||
|
||||
function TCocoaManualScrollView.isTapping(scroller: NSScroller): Boolean;
|
||||
begin
|
||||
if _tapping < 0 then
|
||||
Exit( False );
|
||||
if _tapping = SB_BOTH then
|
||||
Exit( True );
|
||||
if (_tapping = SB_HORZ) and (scroller=self.fhscroll) then
|
||||
Exit( True );
|
||||
if (_tapping = SB_VERT) and (scroller=self.fvscroll) then
|
||||
Exit( True );
|
||||
Result:= False;
|
||||
end;
|
||||
|
||||
procedure TCocoaManualScrollView.onBarScrolled(scroller: NSScroller);
|
||||
begin
|
||||
if _tapping < 0 then
|
||||
Exit;
|
||||
|
||||
if scroller=self.fvscroll then begin
|
||||
_tapping:= SB_VERT;
|
||||
_manager.tempHideScrollBar( fhscroll );
|
||||
end else if scroller=self.fhscroll then begin
|
||||
_tapping:= SB_HORZ;
|
||||
_manager.tempHideScrollBar( fvscroll );
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCocoaManualScrollView.delayShowScrollBars();
|
||||
begin
|
||||
_manager.showScrollBar( self.fhscroll, False );
|
||||
@ -1871,6 +1900,9 @@ begin
|
||||
if (effect.currentKnobPosition=knobPosition) and (effect.currentKnobProportion=knobProportion) then
|
||||
Exit;
|
||||
|
||||
if effect.currentKnobPosition <> knobPosition then
|
||||
_scrollView.onBarScrolled( scroller );
|
||||
|
||||
effect.currentKnobPosition:= knobPosition;
|
||||
effect.currentKnobProportion:= knobProportion;
|
||||
|
||||
@ -1952,6 +1984,9 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if NOT _scrollView.isTapping(scroller) and NOT effect.entered then
|
||||
effect.setDelayHidingTimer;
|
||||
|
||||
// on old versions of macOS, alpha=0 is considered hidden.
|
||||
// that is, to be truly visible, not only Hidden=false, but Alpha must also be set.
|
||||
// otherwise it is considered hidden and setNeedsDisplay() does not take effect.
|
||||
|
Loading…
Reference in New Issue
Block a user