{"id":13798039,"url":"https://github.com/kapetan/electron-drag","last_synced_at":"2025-04-05T06:03:22.107Z","repository":{"id":32550406,"uuid":"36132724","full_name":"kapetan/electron-drag","owner":"kapetan","description":"Window dragging for electron applications","archived":false,"fork":false,"pushed_at":"2022-02-25T02:31:53.000Z","size":13,"stargazers_count":328,"open_issues_count":6,"forks_count":43,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T05:02:17.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kapetan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-23T16:50:29.000Z","updated_at":"2025-01-06T06:48:11.000Z","dependencies_parsed_at":"2022-09-01T10:41:20.999Z","dependency_job_id":null,"html_url":"https://github.com/kapetan/electron-drag","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Felectron-drag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Felectron-drag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Felectron-drag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Felectron-drag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapetan","download_url":"https://codeload.github.com/kapetan/electron-drag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294516,"owners_count":20915340,"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":[],"created_at":"2024-08-04T00:00:38.155Z","updated_at":"2025-04-05T06:03:22.088Z","avatar_url":"https://github.com/kapetan.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Library","Tools"],"sub_categories":["Position/Size","For Electron"],"readme":"# electron-drag\n\nImproved window dragging for `Electron` applications.\n\nFrameless windows can be dragged using the [-webkit-app-region][region] css property, but this disables all regular dom events and user interactions with the affected element, which makes it hard to emulate a native-like title bar in the application, as it's not possible to capture double clicks for maximizing the window.\n\nA workaround is to use a pure javascript solution, but dragging only works well when moving the mouse in less than normal speed, else the mouse pointer will move outside the window area and no events will be received by the dom.\n\nThis module uses [osx-mouse][osx] or [win-mouse][win] modules for tracking the mouse position on the entire screen, and thereby enabling consistent window dragging, while the affected element is still able to receive dom events.\n\n# Build\n\nThe module needs to be built with the correct `Electron` headers. See the [guide for using native Node modules with Electron][native] for more information.\n\nVersions of this library above version 2.0.0 require `Electron` which support `Node.js` version 9 and above.\n\n# Usage\n\n\tnpm install electron-drag\n\nRequire the module in an `Electron` web page.\n\n```javascript\nvar drag = require('electron-drag')\n\n// Pass a query selector or a dom element to the function.\n// Dragging the element will drag the whole window.\nvar clear = drag('#element')\n\n// Call the returned function to make the element undraggable again.\nclear()\n```\n\nThe module only works on OS X and Windows, but doesn't fail when installed on a non-supported platform.\n\n```javascript\n// Fallback to using -webkit-app-region property.\nif (!drag.supported) {\n\tdocument.querySelector('#element').style['-webkit-app-region'] = 'drag'\n}\n```\n\n[region]: https://github.com/atom/electron/blob/master/docs/api/frameless-window.md#draggable-region\n[osx]: https://github.com/kapetan/osx-mouse\n[win]: https://github.com/kapetan/win-mouse\n[native]: https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetan%2Felectron-drag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapetan%2Felectron-drag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetan%2Felectron-drag/lists"}