https://github.com/willfarrell/leaflet.clipper
Allows Union, Difference, Xor, and Intersection operations on two polygons.
https://github.com/willfarrell/leaflet.clipper
leaflet leaflet-plugin
Last synced: 10 months ago
JSON representation
Allows Union, Difference, Xor, and Intersection operations on two polygons.
- Host: GitHub
- URL: https://github.com/willfarrell/leaflet.clipper
- Owner: willfarrell
- License: mit
- Created: 2017-07-21T14:20:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-23T17:21:04.000Z (over 8 years ago)
- Last Synced: 2025-04-01T15:47:55.050Z (11 months ago)
- Topics: leaflet, leaflet-plugin
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 19
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Leaflet.Clipper
Allows Union, Difference, Xor, and Intersection operations on two polygons. This is a Leaflet wrapper around [JSClipper](https://sourceforge.net/projects/jsclipper).
## Install
You'll need:
- `leaflet`: `>=1.1.0`
- `clipper-lib`: `^6.2.1`
- `leaflet-clipper`: `^1.1.0` That's this library.
Need to run with an older version? Let me know, there was a breaking change regarding [Mixin.Events](https://github.com/Leaflet/Leaflet/issues/2280). Easy to modify.
## [Demo](https://willfarrell.github.io/Leaflet.Clipper)
## Usage
```javascript
var map = ...
var layer = ...
var drawState = new L.Clipper.OR( map, {
featureGroup: layer,
selectedPathOptions: {
color: '#FF3399'
}
} );
drawState.enable();
drawState.disable();
```
## TODO
- [ ] Add back in tooltip support
- [ ] Leaflet.draw integration
- [ ] Leaflet.Editable integration
- [ ] Extend functionality to circles
## Credits
- Original version written for [MyMobileCoverage](http://www.mymobilecoverage.com/)