{"id":16836924,"url":"https://github.com/fil/d3-inertia","last_synced_at":"2025-09-07T10:38:55.553Z","repository":{"id":26750775,"uuid":"109702988","full_name":"Fil/d3-inertia","owner":"Fil","description":"Dragging stuff with inertia","archived":false,"fork":false,"pushed_at":"2023-07-18T20:28:09.000Z","size":6220,"stargazers_count":66,"open_issues_count":11,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-13T23:47:12.094Z","etag":null,"topics":["d3","d3-drag","d3-geo","earth","globe","quaternion","rotation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-06T14:05:12.000Z","updated_at":"2025-04-26T08:05:04.000Z","dependencies_parsed_at":"2022-08-07T12:00:55.052Z","dependency_job_id":"d4ee7700-182f-4849-9560-11848753eafb","html_url":"https://github.com/Fil/d3-inertia","commit_stats":{"total_commits":44,"total_committers":4,"mean_commits":11.0,"dds":0.25,"last_synced_commit":"0fb39d468b298d3e676348fd6c0ef8b0761d7875"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Fil/d3-inertia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fil%2Fd3-inertia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fil%2Fd3-inertia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fil%2Fd3-inertia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fil%2Fd3-inertia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fil","download_url":"https://codeload.github.com/Fil/d3-inertia/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fil%2Fd3-inertia/sbom","scorecard":{"id":50072,"data":{"date":"2025-08-11","repo":{"name":"github.com/Fil/d3-inertia","commit":"0fb39d468b298d3e676348fd6c0ef8b0761d7875"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 2/10 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.4.0 not signed: https://api.github.com/repos/Fil/d3-inertia/releases/36809234","Warn: release artifact v0.1.0 not signed: https://api.github.com/repos/Fil/d3-inertia/releases/22541932","Warn: release artifact v0.4.0 does not have provenance: https://api.github.com/repos/Fil/d3-inertia/releases/36809234","Warn: release artifact v0.1.0 does not have provenance: https://api.github.com/repos/Fil/d3-inertia/releases/22541932"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T23:33:30.241Z","repository_id":26750775,"created_at":"2025-08-14T23:33:30.241Z","updated_at":"2025-08-14T23:33:30.241Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026706,"owners_count":25209739,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["d3","d3-drag","d3-geo","earth","globe","quaternion","rotation"],"created_at":"2024-10-13T12:15:25.924Z","updated_at":"2025-09-07T10:38:55.517Z","avatar_url":"https://github.com/Fil.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inertia\n\nAn extension to [d3-drag](https://github.com/d3/d3-drag) that continues the mouse movement with some inertia (by default, 5 seconds).\n\nThe `inertia` object exposes a `position` and a `velocity`, that correspond to the mouse coordinates relative to the target of the `d3.drag` method. During the drag gesture, the position just follows the mouse, and the velocity accumulates the movement. When the drag gesture ends, the `render()` method is called repeatedly with a tweening argument `t` that goes from 0 to 1. It is up to you to know what to do with these vectors.\n\nThe most simple case is: `currentPosition = last position + t * velocity`.\n\nThis [example](https://bl.ocks.org/Fil/a034e32156b7b25ee9054c1bc50dc0ca) demonstrates a more creative use of the parameters. As you can see, `d3.inertia` can be used on its own, but you will need to manage quite a few parameters.\n\n(TODO: a helping function for common use cases).\n\n\n\n# Dragging the globe\n\n[\u003cimg alt=\"Versor Dragging with Inertia\" src=\"https://github.com/Fil/d3-inertia/raw/master/img/globe-inertia.gif\" width=\"600\" height=\"409\"\u003e](https://bl.ocks.org/Fil/f48de8e9207799017093a169031adb02/)\n\u003cbr\u003e*[Canvas example + code](https://bl.ocks.org/Fil/f48de8e9207799017093a169031adb02/)*\n\nThe naïve method to rotate a globe uses `mouse.x` and `mouse.y` as proxies for longitude and latitude. It works when the rotation is small, but try to put the globe \"upside-down\" and suddenly moving the mouse to the left rotates the globe to the right, and vice versa.\n\nThe correct solution is to track the spherical coordinates of the point that is under the mouse, and apply a rotation to the globe that will move the initial point to the current mouse position. Computing that rotation involves quaternions.\n\nThis method, introduced by [Jason Davies](https://www.jasondavies.com/maps/rotate/) and Mike Bostock, is called [versor dragging](https://bl.ocks.org/mbostock/7ea1dde508cec6d2d95306f92642bc42).\n\n**d3-inertia** packages this method.\n\nInclude the scripts in your page with\n```\n\u003cscript src=\"https://unpkg.com/versor\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/d3-inertia\"\u003e\u003c/script\u003e\n```\n\nThen, define a `render()` function that redraws the globe, and call:\n\n```\nvar inertia = d3.geoInertiaDrag(canvas, function() { render(); }, [projection], [opt]);\n```\n\n[\u003cimg alt=\"Versor Dragging with Inertia\" src=\"https://github.com/Fil/d3-inertia/raw/master/img/eclipses.gif\" width=\"400\" height=\"392\"\u003e](https://visionscarto.net/empreintes-d-eclipses)\n\u003cbr\u003e*[SVG example](https://visionscarto.net/empreintes-d-eclipses)  + [code](https://bl.ocks.org/Fil/63366253a5d2f00640c15b096c29a38c)*\n\n*canvas* is the target container (it can also be *svg*)\n\n*projection* is an object with two methods:\n\n- *projection.rotate([r])* gets and sets the rotation.\n\n- *projection.invert([x,y])* transforms screen coordinates into spherical coordinates *lambda, phi*; most [projections](https://github.com/d3/d3-geo-projection) have an exact invert, but for the few which do not, this doesn't have to be very accurate to give an “almost correct” movement.\n\nIf a projection is defined globally, and not specified in the function call, the plugin will use it.\n\n*opt* is an array of options, which can include:\n\n- *start*, *move*, *end*: callback functions on the corresponding events (*end* is invoked only if conditions for inertia are met)\n\n- *stop*, *finish*: extra callback functions invoked if the conditions for inertia are not met and after it finishes respectively\n\n- *time*: reference time for the inertia (in ms, default 5000)\n\n- *hold*: threshold time beteen the final *move* and *end* events after which inertia will be cancelled (in ms, default 100)\n\n\n# Credits\n\nThanks to [Jason Davies](https://www.jasondavies.com/), [Mike Bostock](https://bl.ocks.org/mbostock/) and [Widi Harsojo](https://github.com/earthjs/earthjs).\n\nThe quaternion \u0026 versor functions are taken from the [versor](https://github.com/Fil/versor) package.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffil%2Fd3-inertia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffil%2Fd3-inertia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffil%2Fd3-inertia/lists"}