diff options
author | Jose Antonio Marquez | 2012-07-23 17:15:47 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-07-23 17:15:47 -0700 |
commit | 6908422084dbfef5420e1a9ce584d56aad9a2c14 (patch) | |
tree | c5e74cc54e1d4d38ee08378998ce1c93453489b3 /js/lib/geom | |
parent | afc7ad4f240fdf7890a79c2d4d7f8eb2e7c30a34 (diff) | |
parent | a3f04ac0a68e428017dc51a1ba28c33f250adaf6 (diff) | |
download | ninja-6908422084dbfef5420e1a9ce584d56aad9a2c14.tar.gz |
Merge branch 'refs/heads/Ninja-Master' into Document
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 12f5c5a1..164d31ee 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -864,6 +864,17 @@ BrushStroke.prototype.drawToContext = function(ctx, drawStageWorldPts, stageWorl | |||
864 | }; //this.drawToCanvas() | 864 | }; //this.drawToCanvas() |
865 | 865 | ||
866 | 866 | ||
867 | |||
868 | BrushStroke.prototype._fixCoordPrecision = function(coord, precision){ | ||
869 | var i=0; | ||
870 | var numPoints = coord.length; | ||
871 | for (i=0;i<numPoints;i++){ | ||
872 | coord[i][0] = parseFloat((coord[i][0]).toFixed(precision)); | ||
873 | coord[i][1] = parseFloat((coord[i][1]).toFixed(precision)); | ||
874 | coord[i][2] = parseFloat((coord[i][2]).toFixed(precision)); | ||
875 | } | ||
876 | }; | ||
877 | |||
867 | BrushStroke.prototype.exportJSON = function(){ | 878 | BrushStroke.prototype.exportJSON = function(){ |
868 | var retObject= new Object(); | 879 | var retObject= new Object(); |
869 | //the type of this object | 880 | //the type of this object |
@@ -873,9 +884,10 @@ BrushStroke.prototype.exportJSON = function(){ | |||
873 | //the geometry for this object | 884 | //the geometry for this object |
874 | retObject.localPoints = this._LocalPoints.slice(0); | 885 | retObject.localPoints = this._LocalPoints.slice(0); |
875 | this._copyCoordinates3D(this._LocalPoints, retObject.localPoints); //todo is this necessary in addition to the slice(0) above? | 886 | this._copyCoordinates3D(this._LocalPoints, retObject.localPoints); //todo is this necessary in addition to the slice(0) above? |
887 | this._fixCoordPrecision(retObject.localPoints, 4); | ||
876 | retObject.origLocalPoints = this._OrigLocalPoints.slice(0); | 888 | retObject.origLocalPoints = this._OrigLocalPoints.slice(0); |
877 | this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> | 889 | this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> |
878 | 890 | this._fixCoordPrecision(retObject.origLocalPoints, 4); | |
879 | retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; | 891 | retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; |
880 | retObject.planeMat = this._planeMat; | 892 | retObject.planeMat = this._planeMat; |
881 | retObject.planeMatInv = this._planeMatInv; | 893 | retObject.planeMatInv = this._planeMatInv; |