{"id":20854349,"url":"https://github.com/w8r/leaflet.path.transform","last_synced_at":"2025-05-15T16:03:08.743Z","repository":{"id":37743274,"uuid":"53532627","full_name":"w8r/Leaflet.Path.Transform","owner":"w8r","description":"Drag/rotate/resize handler for leaflet vector features.","archived":false,"fork":false,"pushed_at":"2025-01-22T07:34:26.000Z","size":5584,"stargazers_count":173,"open_issues_count":48,"forks_count":58,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-07T23:27:08.249Z","etag":null,"topics":["edit","geometry","leaflet","leaflet-plugins","rotate","scale","transformations"],"latest_commit_sha":null,"homepage":"http://w8r.github.io/Leaflet.Path.Transform","language":"CSS","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/w8r.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":"2016-03-09T21:20:04.000Z","updated_at":"2025-05-07T13:08:53.000Z","dependencies_parsed_at":"2024-06-18T15:32:52.028Z","dependency_job_id":"a3f05e02-ec1c-4a56-bfd4-6a2c5f6630c8","html_url":"https://github.com/w8r/Leaflet.Path.Transform","commit_stats":{"total_commits":94,"total_committers":10,"mean_commits":9.4,"dds":"0.37234042553191493","last_synced_commit":"b6af21f147c6b15d7b4662dbc00495cd5478a5ff"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2FLeaflet.Path.Transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2FLeaflet.Path.Transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2FLeaflet.Path.Transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8r%2FLeaflet.Path.Transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w8r","download_url":"https://codeload.github.com/w8r/Leaflet.Path.Transform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374400,"owners_count":22060609,"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":["edit","geometry","leaflet","leaflet-plugins","rotate","scale","transformations"],"created_at":"2024-11-18T03:25:25.922Z","updated_at":"2025-05-15T16:03:08.714Z","avatar_url":"https://github.com/w8r.png","language":"CSS","readme":"# Leaflet.Path.Transform [![npm version](https://badge.fury.io/js/leaflet-path-transform.svg)](https://badge.fury.io/js/leaflet-path-transform)\n\nDrag/rotate/resize handler for [leaflet](http://leafletjs.com) vector features.\n\n![screenshot 2016-03-21 15 31 48](https://cloud.githubusercontent.com/assets/26884/13921863/4470b97c-ef7a-11e5-8ea2-46161fffaedd.png)\n\nIncludes [L.Path.Drag](https://github.com/w8r/Leaflet.Path.Drag), so you don't\nneed to include it once again.\n\n[**Open on codesandbox.io**](https://codesandbox.io/p/sandbox/2vz49q)\n \n\n### Requirements\n\nLeaflet 1.0+\n\n### API\n```shell\nnpm install leaflet-path-transform --save\n```\nor include `dist/L.Path.Transform.js` file\n\n```js\nrequire('leaflet-path-transform');\n\nvar map = L.map('map-canvas').setView(center, zoom);\nvar polygon = L.polygon([..., ...], { transform: true }).addTo(map);\n\npolygon.transform.enable();\n// or partially:\npolygon.transform.enable({rotation: true, scaling: false});\n// or, on an already enabled handler:\npolygon.transform.setOptions({rotation: true, scaling: false});\n```\n\nIf you have changed the geometry of the transformed layer and want the tool to reflect the changes, use:\n\n```js\n// you have changed the geometry here\nlayer.setLatLngs([...]);\n// and want to update handlers:\nlayer.transform.reset();\n```\n\n### `options`\n\n* **`options.handlerOptions`** - **\u003c[Path_options](http://leafletjs.com/reference.html#path-options)\u003e** - edge markers options\n* **`options.boundsOptions`** - **\u003c[Polyline_options](http://leafletjs.com/reference.html#polyline-options)\u003e** - bounding rectangle options\n* **`options.rotateHandleOptions`** - **\u003c[Polyline_options](http://leafletjs.com/reference.html#polyline-options)\u003e** - rotation handle line styles\n* **`options.handleLength`** - **Number** - Length of the rotation handle in pixels. Defaults to 20.\n* **`options.rotation`** - **Boolean** - Enable/disable rotation. Default `true`\n* **`options.scaling`** - **Boolean** - Enable/disable scaling. Default `true`\n* **`options.uniformScaling`** - **Boolean** - Use uniform scaling (maintain aspect ratio). Default `true`\n\n**Handles**\n\nFor the corner and rotation handles plugin provides 2 classes:\n`L.PathTransform.Handle` and `L.PathTransform.RotateHandle`, they are derived from `L.CircleMarker` and you can adjust them as you want. Also you can use some other compatible marker types by providing respective constructors through `options.handleClass` and `options.rotateHandleClass`.\n\n**Cursors:**\n\nHandler assigns `resize` cursors to handles. You can override that by setting `options.handlerOptions.setCursor` and `options.rotateHandleOptions.setCursor` to `false`\n\n\n### Events\n\nFollowing events are fired on the transformed layer\n\n* **`rotatestart`, `rotate`, `rotateend`** - `{ rotation: \u003cRadians\u003e }`\n* **`scalestart`, `scale`, `scaleend`** - `{ scale: \u003cL.Point\u003e }`\n* **`transformstart`, `transform`, `transformed`** - `{ rotation: ..., scale: ..., matrix: \u003cL.Matrix\u003e }`\n\n\n### Dragging\n\nTo control features dragging, see\n[L.Path.Drag docs](https://github.com/w8r/Leaflet.Path.Drag).\n\n```js\npolygon.dragging.disable();\npolygon.dragging.enable();\n```\n\n\n\n### TODO\n\n - [ ] Tests\n - [ ] Precision fix for rotation\n - [x] Leaflet 1.x support\n - [x] [Leaflet.Editable](https://github.com/Leaflet/Leaflet.Editable) adapter\n - [ ] [Leaflet.draw](https://github.com/Leaflet/Leaflet.draw) adapter\n - [x] Canvas renderer support\n\n### License\n\n Copyright (c) \u003cyear\u003e \u003ccopyright holders\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8r%2Fleaflet.path.transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw8r%2Fleaflet.path.transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8r%2Fleaflet.path.transform/lists"}