PdfiumLib icon indicating copy to clipboard operation
PdfiumLib copied to clipboard

Page Change Using Mouse Wheel

Open xelnaga64 opened this issue 3 years ago • 1 comments

I couldn't find an official way to change page (next or previous) using mouse wheel scrolling.

xelnaga64 avatar Sep 28 '21 11:09 xelnaga64

Please update the DoMouseWheel function in PdfiumCtrl.pas

function TPdfControl.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; var PagePt: TPdfPoint; begin Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos); if not Result then begin if IsPageValid and AllowFormEvents then begin PagePt := DeviceToPage(MousePos.X, MousePos.Y); if CurrentPage.FormEventMouseWheel(Shift, WheelDelta, PagePt.X, PagePt.Y) then Exit; end; if ssCtrl in Shift then begin if ScaleMode = smZoom then begin ZoomPercentage := ZoomPercentage + (WheelDelta div WHEEL_DELTA) * 5; Result := True; end; end else begin if ssShift in Shift then Result := ScrollContent(-WheelDelta, 0, SmoothScroll) else Result := ScrollContent(0, -WheelDelta, SmoothScroll); if not Result then begin if WheelDelta < 0 then Self.GotoNextPage() else begin if Self.PageIndex>0 then begin Self.GotoPrevPage(); Self.ScrollContentTo(0,999999999); end; end; end; Result := True; end; end; end;

xelnaga64 avatar Jun 05 '22 11:06 xelnaga64