diff options
author | Valerio Virgillito | 2012-07-23 17:06:31 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-23 17:06:31 -0700 |
commit | 448668262b3e91ff5b8931c38c99631bcd25cd57 (patch) | |
tree | 981e350e5cc1238286c8d47afd6e5445a5a39500 /js/lib/geom/brush-stroke.js | |
parent | 8c411448bc595a5bebd75382ea2cff31fc045151 (diff) | |
parent | e9d08c7af751d75af16371fcac06fd1af8a60fac (diff) | |
download | ninja-448668262b3e91ff5b8931c38c99631bcd25cd57.tar.gz |
Merge branch 'SevenDotOneCommits' of https://github.com/ericmueller/ninja into v0.7.1
Diffstat (limited to 'js/lib/geom/brush-stroke.js')
-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; |