diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/shapes/polyline.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/shapes/polyline.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/engine/shapes/polyline.js b/public/assets/javascripts/rectangles/engine/shapes/polyline.js index 7e3c04c..e853592 100644 --- a/public/assets/javascripts/rectangles/engine/shapes/polyline.js +++ b/public/assets/javascripts/rectangles/engine/shapes/polyline.js @@ -1,9 +1,12 @@ var Polyline = Fiber.extend(function(base){ var exports = {} - exports.init = function(){ - this.points = [] + exports.init = function(points){ + this.points = points this.mx_points = [] this.closed = false + if (points) { + this.build() + } } exports.add = function(p){ this.points.push( p ) @@ -134,6 +137,9 @@ var Polyline = Fiber.extend(function(base){ exports.rebuild = function(){ this.mx.rebuild() } + exports.serialize = function(){ + return this.points + } exports.reset = function(){ this.mx_points.forEach(function(mx){ scene.remove(mx) }) this.mx_points.length = 0 |
