flatten-offset
Advanced tools
Comparing version 1.0.0 to 1.0.1
15
index.js
@@ -16,7 +16,12 @@ | ||
class Offset { | ||
static offsetPolygon(polygon, value) { | ||
/** | ||
* Offset polygon by given value | ||
* @param {Polygon} polygon - input polygon | ||
* @param {number} value - offset value, may be positive or negative | ||
*/ | ||
static offset(polygon, value) { | ||
let w = value; | ||
let edges = [...polygon.edges]; | ||
let offsetPolygon = polygon; | ||
let offsetPolygon = polygon.clone(); | ||
let offsetEdge; | ||
@@ -206,6 +211,6 @@ | ||
Flatten.Polygon.prototype.offset = function(value) { | ||
return Offset.offsetPolygon(this, value); | ||
} | ||
return Offset.offset(this, value); | ||
}; | ||
module.exports = {} | ||
module.exports = Offset; | ||
{ | ||
"name": "flatten-offset", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Offset polygon", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,2 +28,7 @@ [![npm version](https://badge.fury.io/js/flatten-offset.svg)](https://badge.fury.io/js/flatten-offset) | ||
``` | ||
When using umd minified package: | ||
```javascript | ||
let {offset} = Offset; | ||
let offsetPolygon = offset(polygon, offset_value) | ||
``` | ||
@@ -34,3 +39,3 @@ Example: | ||
require('flatten-offset'); | ||
let {segment, point, Polygon} = Flatten; | ||
// Create polygon | ||
@@ -37,0 +42,0 @@ let shapes = [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2082489
1611
62