{"id":25412325,"url":"https://github.com/xty1992a/cropper","last_synced_at":"2025-10-28T23:42:55.416Z","repository":{"id":97626784,"uuid":"172479052","full_name":"xty1992a/cropper","owner":"xty1992a","description":"A tiny size image cropper","archived":false,"fork":false,"pushed_at":"2019-12-04T03:09:51.000Z","size":1426,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-03T20:56:34.416Z","etag":null,"topics":["canvas","cropper","javascript","tiny","typescript"],"latest_commit_sha":null,"homepage":"https://codepen.io/xty1992a/pen/KKKBoVm","language":"TypeScript","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/xty1992a.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-25T09:51:19.000Z","updated_at":"2022-07-30T17:35:59.000Z","dependencies_parsed_at":"2023-05-09T15:23:45.761Z","dependency_job_id":null,"html_url":"https://github.com/xty1992a/cropper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xty1992a/cropper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xty1992a%2Fcropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xty1992a%2Fcropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xty1992a%2Fcropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xty1992a%2Fcropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xty1992a","download_url":"https://codeload.github.com/xty1992a/cropper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xty1992a%2Fcropper/sbom","scorecard":{"id":1236930,"data":{"date":"2025-08-25","repo":{"name":"github.com/xty1992a/cropper","commit":"eb3603d898b829e52cfb4ecc8a37e668f46d91a2"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.6,"checks":[{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/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/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-09-03T20:56:35.592Z","repository_id":97626784,"created_at":"2025-09-03T20:56:35.592Z","updated_at":"2025-09-03T20:56:35.592Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279034127,"owners_count":26089426,"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-10-15T02:00:07.814Z","response_time":56,"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":["canvas","cropper","javascript","tiny","typescript"],"created_at":"2025-02-16T11:18:44.629Z","updated_at":"2025-10-15T02:12:52.509Z","avatar_url":"https://github.com/xty1992a.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 轻量截图库\n\n### 使用\n\n1. 安装: `npm install @redbuck/cropper` 或者 `yarn add @redbuck/cropper`.\n2. 引入:\n   1. 模块化\n      commonjs: `const Cropper = require('@redbuck/cropper')`.\n      ES6 module: `import Cropper from \"@redbuck/cropper\"`.\n   2. CDN\n      页面中添加`\u003cscript type=\"text/javascript\" src=\"to/path/cropper.js\"\u003e\u003c/script\u003e`\n3. 使用:`const cropper = new Cropper(el, options)`.\n\n---\n\n### 参数\n\n|    字段 |              类型 |    默认值 | 描述             |\n| ------: | ----------------: | --------: | ---------------- |\n|      el | Element 丨 string | undefined | 截图组件挂载位置 |\n| options |            Object |        {} | 配置对象         |\n\n#### options\n\n|             字段 |   类型 |                  默认值 |               描述 |\n| ---------------: | -----: | ----------------------: | -----------------: |\n|              url | string |                      \"\" | 需要截取的图片地址 |\n|            width | number |                     600 |           容器宽度 |\n|           height | number |                     375 |           容器高度 |\n|           window | object |                    null |      截图框的 rect |\n|       wheelSpeed | number |                    0.05 |           缩放步长 |\n|          maxRate | number |                      10 |       最大放大倍数 |\n|          minRate | number |                       1 |       最小放大倍数 |\n|         cropMode | string |                 'cover' |           截图模式 |\n|        maskColor | string |       'rgba(0,0,0,0.6)' |           蒙层颜色 |\n| devicePixelRatio | number | window.devicePixelRatio |                dpr |\n\n#### window 属性(window 类型可用)\n\n|       字段 |    类型 |          默认值 |               描述 |\n| ---------: | ------: | --------------: | -----------------: |\n|          x |  number |               0 |     截图框的横坐标 |\n|          y |  number |               0 |     截图框的纵坐标 |\n|      width |  number | options.width/2 |       截图框的宽度 |\n|     height |  number |               0 |       截图框的高度 |\n| resizeable | boolean |            true | 是否允许改变截图框 |\n|   moveable | boolean |            true | 是否允许移动截图框 |\n\n##### cropMode 详解\n\n- cover, 容器即截图框,图片只能在容器内部移动,最小只能缩小到容器的最长边.\n- contain, 容器即截图框,图片移动,缩放不限制\n- window, 显示截图框,截图框的移动限制在图片内(图片的缩放移动也受截图框的限制)\n- free-window,显示截图框,截图框的移动不受限制\n\n---\n\n### API\n\n#### output 同步输出 window 区域的图片\n\n接口定义: `output(options?: OutputType): string | Blob | Error;`\n参数定义:\n\n```javascript\ntype OutputType = {\n  mime?: string,\n  type?: string,\n  quality?: number\n};\n```\n\n#### moveTo 移动图片至指定位置\n\n接口定义: `moveTo(x: number, y: number): void;`\n\n#### zoom 在指定位置进行缩放\n\n接口定义: `zoom(origin: { x: number; y: number }, direction: number): void;`\n参数定义: origin 指缩放发生的坐标(canvas 坐标),delta 指方向(放大 1,缩小-1)\n\n#### changeImage 更换图片\n\n接口定义: `changeImage(img: HTMLImageElement | string, callback?: Function):void`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxty1992a%2Fcropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxty1992a%2Fcropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxty1992a%2Fcropper/lists"}