mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Reduce scroll amount to have previous page stay a bit on screen
This commit is contained in:
@@ -182,16 +182,17 @@ class BrowserEnvironment(Environment):
|
|||||||
logger.debug(f"Action: {action.type} by ({scroll_x},{scroll_y}) at ({action.x},{action.y})")
|
logger.debug(f"Action: {action.type} by ({scroll_x},{scroll_y}) at ({action.x},{action.y})")
|
||||||
# Otherwise use direction/amount (from Anthropic style)
|
# Otherwise use direction/amount (from Anthropic style)
|
||||||
elif action.scroll_direction:
|
elif action.scroll_direction:
|
||||||
|
scale = 40.0
|
||||||
dx, dy = 0.0, 0.0
|
dx, dy = 0.0, 0.0
|
||||||
amount = action.scroll_amount or 1
|
amount = action.scroll_amount or 1
|
||||||
if action.scroll_direction == "up":
|
if action.scroll_direction == "up":
|
||||||
dy = -100.0 * amount
|
dy = -scale * amount
|
||||||
elif action.scroll_direction == "down":
|
elif action.scroll_direction == "down":
|
||||||
dy = 100.0 * amount
|
dy = scale * amount
|
||||||
elif action.scroll_direction == "left":
|
elif action.scroll_direction == "left":
|
||||||
dx = -100.0 * amount
|
dx = -scale * amount
|
||||||
elif action.scroll_direction == "right":
|
elif action.scroll_direction == "right":
|
||||||
dx = 100.0 * amount
|
dx = scale * amount
|
||||||
|
|
||||||
if action.x is not None and action.y is not None:
|
if action.x is not None and action.y is not None:
|
||||||
await self.page.mouse.move(action.x, action.y)
|
await self.page.mouse.move(action.x, action.y)
|
||||||
|
|||||||
Reference in New Issue
Block a user