Inconsistency between saved_mouse_position_y and mouse_position_y coordinate signs

Describe the bug
When using get_number_variable({variable_name: 'saved_mouse_position_y'}), I get a positive value (e.g., 540), but when using get_number_variable({variable_name: 'mouse_position_y'}), I get a negative value (e.g., -540) for the same position. The X coordinates are consistent between both variables.


Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Mouse (affects JavaScript variables related to mouse position)


Screenshots
Console output showing the inconsistency:

[Log] Previous position: (487, 540)
[Log] Current position: (487, -540)

Code used to generate this output:

async function checkMousePosition() {
    return await (async () => {
        const previousX = await get_number_variable({variable_name: 'saved_mouse_position_x'});
        const previousY = await get_number_variable({variable_name: 'saved_mouse_position_y'});
        const currentX = await get_number_variable({variable_name: 'mouse_position_x'});
        const currentY = await get_number_variable({variable_name: 'mouse_position_y'});
        
        console.log(`Previous position: (${previousX}, ${previousY})`);
        console.log(`Current position: (${currentX}, ${currentY})`);
        
        return false;
    })();
}

Device information:

  • Type of Mac: MacBook Pro
  • macOS version: 15.4 (Sequoia)
  • BetterTouchTool version: 5.294 (Setapp)

unfortunately that's by design because they are used for different things internally (related to the different coordinate systems macOS uses for different things). If you need to get it like this, best multiply one of them by -1

1 Like