Skip to content

Commit ddbca8f

Browse files
author
Alextp
committed
fixing mouse-wheel-scroll
1 parent 0093939 commit ddbca8f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

atimagebox/atimagebox.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@ procedure TATImageBox.MouseWheelUp(Sender: TObject; Shift: TShiftState;
268268
if (Shift = []) then
269269
begin
270270
with VertScrollBar do
271-
Position:= Position - FScrollSmallStep;
271+
Position:= Max(0, Position - FScrollSmallStep);
272272
DoScroll;
273273
end
274274
else
275275
if (Shift = [FModifierMouseHorzScroll]) then
276276
begin
277277
with HorzScrollBar do
278-
Position:= Position - FScrollSmallStep;
278+
Position:= Max(0, Position - FScrollSmallStep);
279279
DoScroll;
280280
end
281281
else
@@ -296,14 +296,14 @@ procedure TATImageBox.MouseWheelDown(Sender: TObject; Shift: TShiftState;
296296
if (Shift = []) then
297297
begin
298298
with VertScrollBar do
299-
Position:= Position + FScrollSmallStep;
299+
Position:= Max(0, Min(Range-Page, Position + FScrollSmallStep));
300300
DoScroll;
301301
end
302302
else
303303
if (Shift = [FModifierMouseHorzScroll]) then
304304
begin
305305
with HorzScrollBar do
306-
Position:= Position + FScrollSmallStep;
306+
Position:= Max(0, Min(Range-Page, Position + FScrollSmallStep));
307307
DoScroll;
308308
end
309309
else

0 commit comments

Comments
 (0)