{"id":20000185,"url":"https://github.com/andstor/mouse-controller","last_synced_at":"2025-08-12T16:04:23.227Z","repository":{"id":36798047,"uuid":"228500891","full_name":"andstor/mouse-controller","owner":"andstor","description":":mouse: Node.js C++ Addon for emulating mouse behavior","archived":false,"fork":false,"pushed_at":"2022-01-22T10:04:24.000Z","size":82,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T16:17:53.850Z","etag":null,"topics":["cpp","macos","mouse","node-addon","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mouse-controller","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andstor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-17T00:36:13.000Z","updated_at":"2020-01-03T14:27:03.000Z","dependencies_parsed_at":"2022-09-02T06:35:56.266Z","dependency_job_id":null,"html_url":"https://github.com/andstor/mouse-controller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andstor%2Fmouse-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andstor%2Fmouse-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andstor%2Fmouse-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andstor%2Fmouse-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andstor","download_url":"https://codeload.github.com/andstor/mouse-controller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241439470,"owners_count":19963095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","macos","mouse","node-addon","nodejs"],"created_at":"2024-11-13T05:14:00.555Z","updated_at":"2025-03-01T23:41:05.645Z","avatar_url":"https://github.com/andstor.png","language":"C++","readme":"# mouse-controller\n\n\u003e Node.js C++ Addon for emulating mouse behavior\n\n[![Build Status](https://travis-ci.org/andstor/mouse-controller.svg?branch=master)](https://travis-ci.org/andstor/mouse-controller)\n[![Coverage Status](https://coveralls.io/repos/github/andstor/mouse-controller/badge.svg?branch=master)](https://coveralls.io/github/andstor/mouse-controller?branch=master)\n[![npm version](http://img.shields.io/npm/v/mouse-controller.svg?style=flat)](https://npmjs.org/package/mouse-controller \"View this project on npm\")\n\n## Table of Contents\n  * [Supported Plattforms](#supported-plattforms)\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [Constants](#constants)\n  * [Methods](#methods)\n  * [License](#license)\n\n## Supported Plattforms\n\nCurrently supported plattforms are:\n\n- **MacOS**\n\n## Installation\n\n```sh\n$ npm install --save mouse-controller\n```\n\n[Precompiled binaries](https://github.com/andstor/mouse-controller/releases/latest) for popular 64-bit platforms are provided. When installing `mouse-controller`, [`node-pre-gyp`](https://github.com/mapbox/node-pre-gyp) will check if a compatible binary exists and fallback to a compile step if it doesn't. In that case you'll need a [valid `node-gyp` installation](https://github.com/nodejs/node-gyp#installation).\n\nIf you don't want to use the prebuilt binary for the platform you are installing on, specify the `--build-from-source` flag when you install. One of:\n\n```\nnpm install --build-from-source\nnpm install mouse-controller --build-from-source\n```\n\n\n## Usage\n\n### Syntax\n```js\nnew MouseController()\n```\n\n### Example\n```js\nconst MouseController = require('mouse-controller');\nconst mc = new MouseController();\n\nconsole.log(mc.getPosition());\n//=\u003e { x: 143.9375, y: 129.0625 }\n\n// Move the mouse to the coordinates (500, 500).\nmc.move(500, 500);\n\n// Right click at the current mouse position.\nmc.click(mc.BUTTON.RIGHT, mc.getPosition());\n```\n\n## Constants\n\n### BUTTON\nConstant for specifying the mouse button type.\n\n| Constant | Value | Button             |\n| :------- | :---: | :----------------- |\n| `LEFT`   |  `0`  | Left mouse button  |\n| `RIGHT`  |  `1`  | Right mouse button |\n\n## Methods\n\n### move(x, y)\n- **x**:\n  - Type: `Number`\n  - x-coordinate for the new mouse position.\n\n- **y**:\n  - Type: `Number`\n  - y-coordinate for the new mouse position.\n\nMoves the mouse to the point (`x`, `y`).\n\n### click(BUTTON, point)\n- **BUTTON**:\n  - Type: [`BUTTON`](#button)\n  - Which mouse button to click. The [`BUTTON`](#button) type is defined as multiple constants.\n\n- **point**:\n  - Type: `Object`\n  - Which mouse button to click.\n\nClicks with the `BUTTON` at the `point` provided. To click in the corrent position of the mouse, use the method [getPosition()](#getPosition).\n\n### doubleClick(BUTTON, point)\n- **BUTTON**:\n  - Type: [`BUTTON`](#button)\n  - Which mouse button to click. The [`BUTTON`](#button) type is defined as multiple constants on the BUTTON object.\n\n- **point**:\n  - Type: `Object`\n  - Which mouse button to click.\n\nDouble clicks with the `BUTTON` at the `point` provided. To click in the corrent position of the mouse, use the method [getPosition()](#getPosition).\n\n### getPosition()\n- (return value):\n  - Type: `Object`\n  - Returns the current mouse position.\n\nGets the current mouse position on the form `{ x: 143.9375, y: 129.0625 }`.\n\n### startDrag(point)\n- **point**:\n  - Type: `Object`\n  - Object with `x` and `y` coordinates of the vanted mouse position to start the mouse drag from.\n\nStart to drag by pressing down on the left mouse button at the point (`x`, `y`). To do consecutive movement while dragging, use the [drag(point)](#dragpoint) method.\n\n### drag(point)\n- **point**:\n  - Type: `Object`\n  - Object with `x` and `y` coordinates of the vanted mouse position to end the mouse drag on.\n\nTo move the mouse that is activly dragging,  the point (`x`, `y`).\n\n### endDrag(point)\n- **point**:\n  - Type: `Object`\n  - Object with `x` and `y` coordinates of the vanted mouse position to end the mouse drag on.\n\nEnd a mouse drag by releasing the left mouse button at the point (`x`, `y`).\n\n## License\n\nmouse-controller is licensed under the [MIT License](https://github.com/andstor/mouse-controller/blob/master/LICENSE).  \nCopyright © [André Storhaug](https://github.com/andstor)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandstor%2Fmouse-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandstor%2Fmouse-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandstor%2Fmouse-controller/lists"}