Skip to content

Commit

Permalink
Add new UI option to set mouse smoothness
Browse files Browse the repository at this point in the history
  • Loading branch information
steve1316 committed Apr 23, 2023
1 parent 4a0b969 commit 7f5fdd2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/context/BotStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface Settings {
reduceDelaySeconds: number
enableBezierCurveMouseMovement: boolean
mouseSpeed: number
mouseSmoothness: number
enableDelayBetweenRuns: boolean
delayBetweenRuns: number
enableRandomizedDelayBetweenRuns: boolean
Expand Down Expand Up @@ -203,7 +204,8 @@ export const defaultSettings: Settings = {
configuration: {
reduceDelaySeconds: 0.0,
enableBezierCurveMouseMovement: true,
mouseSpeed: 0.2,
mouseSpeed: 1.5,
mouseSmoothness: 2,
enableDelayBetweenRuns: false,
delayBetweenRuns: 15,
enableRandomizedDelayBetweenRuns: false,
Expand Down
41 changes: 29 additions & 12 deletions src/pages/ExtraSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,42 @@ const ExtraSettings = () => {

<Grid.Col span={12}>
<Grid>
<Grid.Col span={6}>
<Grid.Col span={12}>
<CustomSwitch
label="Enable Bezier Curve Mouse Movement"
description="Enable this option to have slow but human-like mouse movement. Disable this for fast but bot-like mouse movement. Note that enabling this will disable the Mouse Speed setting."
checked={bsc.settings.configuration.enableBezierCurveMouseMovement}
onChange={(checked) => bsc.setSettings({ ...bsc.settings, configuration: { ...bsc.settings.configuration, enableBezierCurveMouseMovement: checked } })}
/>
</Grid.Col>
<Grid.Col span={6}>
{!bsc.settings.configuration.enableBezierCurveMouseMovement ? (
<CustomNumberInput
label="Mouse Speed"
value={bsc.settings.configuration.mouseSpeed}
onChange={(value) => bsc.setSettings({ ...bsc.settings, configuration: { ...bsc.settings.configuration, mouseSpeed: value } })}
min={0}
step={0.01}
description="Set how fast a mouse operation finishes."
/>
) : null}

<Grid.Col span={12}>
<Grid align="flex-end">
<Grid.Col span={6}>
<CustomNumberInput
label="Mouse Speed"
value={bsc.settings.configuration.mouseSpeed}
onChange={(value) => bsc.setSettings({ ...bsc.settings, configuration: { ...bsc.settings.configuration, mouseSpeed: value } })}
min={0}
step={0.01}
description="Sets the factor on how fast a mouse operation moves."
/>
</Grid.Col>
<Grid.Col span={6}>
{bsc.settings.configuration.enableBezierCurveMouseMovement ? (
<>
<CustomNumberInput
label="Mouse Smoothness"
value={bsc.settings.configuration.mouseSmoothness}
onChange={(value) => bsc.setSettings({ ...bsc.settings, configuration: { ...bsc.settings.configuration, mouseSmoothness: value } })}
min={0}
step={0.01}
description="Sets the factor on how smooth the mouse movement should be. A lower value has it more smoother (more points along the curve to pass through) and a high value has it move more rigidly (less points along the curve)."
/>
</>
) : null}
</Grid.Col>
</Grid>
</Grid.Col>

<Grid.Col span={6}>
Expand Down

0 comments on commit 7f5fdd2

Please sign in to comment.