diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-18 20:05:56 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-18 20:05:56 -0400 |
| commit | 40fa450839a171cbfa1d9c8470d25eeeba337a27 (patch) | |
| tree | 0aded62c6ac2af50cf62f071f42ee34dfc88edc8 /public/assets/javascripts/rectangles/engine/shapes/shapelist.js | |
| parent | bbd62d9c7f3838d07e42e46c244c317a5dbdb5ae (diff) | |
serialize/deserialize polyline
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/shapes/shapelist.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/shapes/shapelist.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/engine/shapes/shapelist.js b/public/assets/javascripts/rectangles/engine/shapes/shapelist.js index e86c5d6..c3b5758 100644 --- a/public/assets/javascripts/rectangles/engine/shapes/shapelist.js +++ b/public/assets/javascripts/rectangles/engine/shapes/shapelist.js @@ -64,5 +64,16 @@ var ShapeList = Fiber.extend(function(base){ exports.forEach = function(fn){ this.shapes.forEach(fn) } + exports.serialize = function(){ + return this.shapes.map(function(shape){ + return shape.serialize() + }) + } + exports.deserialize = function(data){ + data.forEach(function(points){ + var line = new Polyline(points) + this.add(line) + }.bind(this)) + } return exports })
\ No newline at end of file |
