{"id":19966643,"url":"https://github.com/engineersmith/isdropping","last_synced_at":"2026-05-06T16:15:20.504Z","repository":{"id":116642344,"uuid":"609952669","full_name":"EngineerSmith/isdropping","owner":"EngineerSmith","description":"love.isdropping event","archived":false,"fork":false,"pushed_at":"2023-05-09T17:31:15.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-03T12:15:51.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/EngineerSmith.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-05T18:11:20.000Z","updated_at":"2024-04-18T03:12:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb2557ed-5a25-4ba0-aa37-c2d37cff6d69","html_url":"https://github.com/EngineerSmith/isdropping","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineerSmith/isdropping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerSmith%2Fisdropping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerSmith%2Fisdropping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerSmith%2Fisdropping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerSmith%2Fisdropping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineerSmith","download_url":"https://codeload.github.com/EngineerSmith/isdropping/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerSmith%2Fisdropping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32701604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-11-13T02:37:26.015Z","updated_at":"2026-05-06T16:15:20.481Z","avatar_url":"https://github.com/EngineerSmith.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# love.isdropping\r\nThis is a simple library which adds a `love.isdropping` event to go with `love.filedropped`! This can be used to estimate if a file is being held over the window and where about it is being held. Read below for more information in what functions and events are added.\r\n\r\n# Known disadvantages\r\nAs there isn't an event in SDL for when a file is being held above the window. This library works by finding out if the mouse is held down outside of the window and then passes over the love window. So it is possible to trigger it without grabbing a file; by holding the mouse down and then putting it over the window. Such situations could occur by moving a window title bar over the love's window; this will trigger the `love.isdropping` event.\r\n\r\n# Docs\r\nYou can check out `main.lua` for a working example. \r\n\r\n### Events\r\n\r\n#### `love.isdropping(x: number, y: number)`\r\nCalled each frame (or each cycle of `dropping.eventUpdate` is called) when a grabbed cursor is over the love window\r\n\r\n#### `love.stoppeddropping()`\r\nCalled once in place of `love.filedropped` or `love.directorydropped` if the cursor leaves the window after `love.isdropping` has been called but nothing has been dropped. (`love.isdropping` will resume being called if it returns to the window)\r\n\r\n### Functions\r\n#### `dropping.eventUpdate()`\r\nTo be called once per cycle; this can be placed anywhere such as within `love.update`, but I recommend just putting it above the event polling in `love.run`. \r\n\r\n#### `dropping.stop`\r\nThis variable can be set to true to stop the code from checking for a grab. E.g. when you aren't listening for either `love.filedropped` or `love.directorydropped`. Equally can be set to true, as is default to let it test if there is a grab.\r\n\r\n#### `love.window.focus`\r\nThis function forces the focus of the window - useful to grab focus once a successful file or directory has been dropped.\r\n```lua\r\nlove.directorydropped = function(path)\r\n  if validDirectory(path) then\r\n    love.window.focus() -- with this function the user will avoid having to click on the window after a file or directory is dropped to then use the window\r\n\tloadDroppedDirectory(path)\r\n  end\r\nend\r\n```\r\n\r\n## Important notes\r\nThis library overwrites the `love.handlers` for both `love.filedropped` and `love.directorydropped`. This is to ensure `love.stoppeddropping` isn't called if there has been a successful drop.\r\n\r\n# Example\r\n\r\nYou can check out `main.lua` for a working example. \r\n```lua\r\nlocal dropping = require(\"isdropping\") -- Require the library\r\n\r\nlove.keyboardpressed = function()\r\n  dropping.stop = not dropping.stop -- easily stop the event from being check when not needed\r\nend\r\n\r\nlove.update = function()\r\n  dropping.eventUpdate() -- Call the update function each frame\r\nend -- I  recommend putting it in your love.run before events are polled; see main.lua; but can be placed anywhere\r\n\r\nlocal dropX, dropY = -50, -50\r\nlove.isdropping = function(x, y) -- add callback\r\n  dropX, dropY = x, y\r\nend\r\n\r\nlove.stoppeddropping = function() -- called when mouse leaves window, but doesn't drop\r\n\tdropX, dropY = -50, -50\r\nend\r\n\r\nlove.draw = function()\r\n  love.graphics.setColor(1,0,0,1)\r\n  love.graphics.circle(\"fill\", dropX, dropY, 5)\r\nend\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersmith%2Fisdropping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineersmith%2Fisdropping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersmith%2Fisdropping/lists"}