{"id":20392759,"url":"https://github.com/g3th/compose-desktop-drag-and-drop","last_synced_at":"2026-05-28T13:03:25.127Z","repository":{"id":239087320,"uuid":"798494626","full_name":"g3th/Compose-Desktop-Drag-And-Drop","owner":"g3th","description":"Drag And Drop operation in Compose Desktop, utilising compositionLocalOf","archived":false,"fork":false,"pushed_at":"2024-05-22T21:53:05.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-22T22:45:48.981Z","etag":null,"topics":["compose-desktop","drag-and-drop-programming","example","graphical-user-interface","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/g3th.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":"2024-05-09T22:26:11.000Z","updated_at":"2024-05-22T21:53:09.000Z","dependencies_parsed_at":"2024-05-15T18:36:45.988Z","dependency_job_id":"fcf52410-ae0f-4a8f-bdde-d2cc80c8e9eb","html_url":"https://github.com/g3th/Compose-Desktop-Drag-And-Drop","commit_stats":null,"previous_names":["g3th/compose-desktop-drag-and-drop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g3th%2FCompose-Desktop-Drag-And-Drop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g3th%2FCompose-Desktop-Drag-And-Drop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g3th%2FCompose-Desktop-Drag-And-Drop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g3th%2FCompose-Desktop-Drag-And-Drop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g3th","download_url":"https://codeload.github.com/g3th/Compose-Desktop-Drag-And-Drop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241942012,"owners_count":20046223,"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":["compose-desktop","drag-and-drop-programming","example","graphical-user-interface","kotlin"],"created_at":"2024-11-15T03:45:28.232Z","updated_at":"2026-05-28T13:03:20.088Z","avatar_url":"https://github.com/g3th.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compose Desktop - Drag And Drop Example\n## Drag And Drop using the Compose declarative framework\n\n\nSince some features are missing or currently not supported for Desktop, implementing Drag-And-Drop operations results in more convoluted code than in Android, for instance. The absence of \"Modifier.dragAndDropTarget\" or \"View.OnDragListener\" for Desktop makes matters more complicated as implementing a target listener takes more lines of code.\n\n\nThis is an example of how to implement a Drag-and-Drop operation using ```pointerInput```, ```detectDragGestures``` and ```CompositionLocalOf``` to pass data between composable functions, such as current Offsets or Booleans. Although there are probably other ways of implementing such an operation, I have found this was the easiest and most popular\n\n\nThe app also implements:\n\n\n- ```Modifier.clip``` in order to draw a custom shape using ```PathParser()``` to parse an svg path as a String, originally obtained by using InkScape in Linux.\n\n- ```Modifier.clickable``` so that the custom shape is clickable\n\n- ```Brush.lineargradient``` to generate a gradient once the animal shape is clicked. A function generates random colors each time the shape is clicked.\n\n- A \"Debug\" feature which displays offsets and DragListener states in real time. \n\n\nAdditional functionality will probably be added in the future, such as more shapes, but this example serves mainly as a reference.\n\n\nBuild with IntelliJ or Android Studio.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg3th%2Fcompose-desktop-drag-and-drop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg3th%2Fcompose-desktop-drag-and-drop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg3th%2Fcompose-desktop-drag-and-drop/lists"}