Skip to content

Fix mouse being pulled to the bottom right#1156

Merged
codeHusky merged 1 commit intosmartcmd:mainfrom
ayushthoren:mouse-pull-fix
Mar 12, 2026
Merged

Fix mouse being pulled to the bottom right#1156
codeHusky merged 1 commit intosmartcmd:mainfrom
ayushthoren:mouse-pull-fix

Conversation

@ayushthoren
Copy link
Contributor

Description

Fixes a big with imprecisions pushing the mouse position in a certain direction.

Changes

Previous Behavior

Previously, mouse movements were pulled slightly to the bottom right. This could be demonstrated by moving the mouse in circles, which caused the cursor to gradually drift to the bottom right instead of staying centered around the same area.

Root Cause

Pointer snapping logic forced odd coordinates to the next even value (+ x % 2 or + y % 2), which introduced a bias in the positive x/y direction over time.

New Behavior

Cursor movement is unbiased. Circular mouse motion no longer accumulates drift.

Fix Implementation

Updated positioning logic in IUIScene_AbstractContainerMenu::onMouseTick():

  • Removed biased adjustment
  • Replaced with unbiased nearest integer rounding:
    • vPointerPos.x = floor(vPointerPos.x + 0.5f)
    • vPointerPos.y = floor(vPointerPos.y + 0.5f)

AI Use Disclosure

No AI was used to solve this issue.

Related Issues

Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
@codeHusky codeHusky merged commit bb8ffee into smartcmd:main Mar 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Weird mouse pulling down glitch

2 participants