From 431b6fa7610e59074b4ebb3e9e712672f185b8ad Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 19 Jul 2012 11:44:50 -0700 Subject: Renamed Raiders material to Dark Blur, and Paris to Blue Sky. --- js/lib/geom/geom-obj.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/lib/geom') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 3cd3a89b..e0ed51fb 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -385,8 +385,8 @@ exports.GeomObj = Object.create(Object.prototype, { case "plasma": case "deform": case "water": - case "paris": - case "raiders": + case "blueSky": + case "darkBlur": case "tunnel": case "reliefTunnel": case "squareTunnel": -- cgit v1.2.3 From 4648e2eda9aa8c8f9b0aed4d12fef8b1d00f1769 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 19 Jul 2012 16:26:03 -0700 Subject: IKNINJA-1780 - [Shape] Error when opening document that contains a shape with gradient color or no color. Signed-off-by: Nivesh Rajbhandari --- js/lib/geom/circle.js | 57 ++++++++++++++++-------------------------------- js/lib/geom/geom-obj.js | 20 +++++++++++++++++ js/lib/geom/line.js | 26 +++++++++------------- js/lib/geom/rectangle.js | 57 ++++++++++++++++-------------------------------- 4 files changed, 68 insertions(+), 92 deletions(-) (limited to 'js/lib/geom') diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js index ba47603b..4995c2cb 100755 --- a/js/lib/geom/circle.js +++ b/js/lib/geom/circle.js @@ -83,31 +83,13 @@ exports.Circle = Object.create(GeomObj, { if(strokeMaterial) { this._strokeMaterial = strokeMaterial.dup(); - } else { - this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); - } - - if(strokeColor) { - if(this._strokeMaterial.hasProperty("color")) { - this._strokeMaterial.setProperty( "color", this._strokeColor ); - } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) { - this._strokeMaterial.setGradientData(this._strokeColor.color); - } } if(fillMaterial) { this._fillMaterial = fillMaterial.dup(); - } else { - this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); } - if(fillColor) { - if(this._fillMaterial.hasProperty("color")) { - this._fillMaterial.setProperty( "color", this._fillColor ); - } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) { - this._fillMaterial.setGradientData(this._fillColor.color); - } - } + this.initColors(); } }, @@ -770,8 +752,8 @@ exports.Circle = Object.create(GeomObj, { 'fillColor' : this._fillColor, 'innerRadius' : this._innerRadius, 'strokeStyle' : this._strokeStyle, - 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), - 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : MaterialsModel.getDefaultMaterialName(), + 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null, + 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : null, 'materials' : this.exportMaterialsJSON() }; @@ -790,27 +772,26 @@ exports.Circle = Object.create(GeomObj, { this._fillColor = jObj.fillColor; this._innerRadius = jObj.innerRadius; this._strokeStyle = jObj.strokeStyle; - var strokeMaterialName = jObj.strokeMat; - var fillMaterialName = jObj.fillMat; - var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); - if (!strokeMat) { - console.log( "object material not found in library: " + strokeMaterialName ); - strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); + if(jObj.strokeMat) { + var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup(); + if (!strokeMat) { + console.log("object material not found in library: " + jObj.strokeMat); + } else { + this._strokeMaterial = strokeMat; + } } - this._strokeMaterial = strokeMat; - if (this._strokeMaterial.hasProperty( 'color' )) - this._strokeMaterial.setProperty( 'color', this._strokeColor ); - - var fillMat = MaterialsModel.getMaterial( fillMaterialName ).dup(); - if (!fillMat) { - console.log( "object material not found in library: " + fillMaterialName ); - fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); + + if(jObj.fillMat) { + var fillMat = MaterialsModel.getMaterial(jObj.fillMat).dup(); + if (!fillMat) { + console.log("object material not found in library: " + jObj.fillMat); + } else { + this._fillMaterial = fillMat; + } } - this._fillMaterial = fillMat; - if (this._fillMaterial.hasProperty( 'color' )) - this._fillMaterial.setProperty( 'color', this._fillColor ); + this.initColors(); this.importMaterialsJSON( jObj.materials ); } }, diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 3cd3a89b..dd60cdec 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -205,6 +205,26 @@ exports.GeomObj = Object.create(Object.prototype, { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// + initColors: { + value: function() { + if(this._strokeColor && this._strokeMaterial) { + if(this._strokeMaterial.hasProperty("color")) { + this._strokeMaterial.setProperty( "color", this._strokeColor ); + } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) { + this._strokeMaterial.setGradientData(this._strokeColor.color); + } + } + + if(this._fillColor && this._fillMaterial) { + if(this._fillMaterial.hasProperty("color")) { + this._fillMaterial.setProperty( "color", this._fillColor ); + } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) { + this._fillMaterial.setGradientData(this._fillColor.color); + } + } + } + }, + setMaterialColor: { value: function(c, type) { var i = 0, diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js index c0322f46..eec4f6d9 100755 --- a/js/lib/geom/line.js +++ b/js/lib/geom/line.js @@ -89,17 +89,9 @@ exports.Line = Object.create(GeomObj, { if(strokeMaterial) { this._strokeMaterial = strokeMaterial.dup(); - } else { - this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); } - if(strokeColor) { - if(this._strokeMaterial.hasProperty("color")) { - this._strokeMaterial.setProperty( "color", this._strokeColor ); - } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) { - this._strokeMaterial.setGradientData(this._strokeColor.color); - } - } + this.initColors(); } }, @@ -245,7 +237,7 @@ exports.Line = Object.create(GeomObj, { 'strokeWidth' : this._strokeWidth, 'strokeColor' : this._strokeColor, 'strokeStyle' : this._strokeStyle, - 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), + 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null, 'materials' : this.exportMaterialsJSON() }; @@ -265,15 +257,17 @@ exports.Line = Object.create(GeomObj, { this._slope = jObj.slope; this._strokeStyle = jObj.strokeStyle; this._strokeColor = jObj.strokeColor; - var strokeMaterialName = jObj.strokeMat; - var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); - if (!strokeMat) { - console.log( "object material not found in library: " + strokeMaterialName ); - strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); + if(jObj.strokeMat) { + var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup(); + if (!strokeMat) { + console.log("object material not found in library: " + jObj.strokeMat); + } else { + this._strokeMaterial = strokeMat; + } } - this._strokeMaterial = strokeMat; + this.initColors(); this.importMaterialsJSON( jObj.materials ); } }, diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index f1da4918..f3db92af 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js @@ -99,31 +99,13 @@ exports.Rectangle = Object.create(GeomObj, { if(strokeMaterial) { this._strokeMaterial = strokeMaterial.dup(); - } else { - this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); - } - - if(strokeColor) { - if(this._strokeMaterial.hasProperty("color")) { - this._strokeMaterial.setProperty( "color", this._strokeColor ); - } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) { - this._strokeMaterial.setGradientData(this._strokeColor.color); - } } if(fillMaterial) { this._fillMaterial = fillMaterial.dup(); - } else { - this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); } - if(fillColor) { - if(this._fillMaterial.hasProperty("color")) { - this._fillMaterial.setProperty( "color", this._fillColor ); - } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) { - this._fillMaterial.setGradientData(this._fillColor.color); - } - } + this.initColors(); } }, @@ -303,8 +285,8 @@ exports.Rectangle = Object.create(GeomObj, { 'brRadius' : this._brRadius, 'innerRadius' : this._innerRadius, 'strokeStyle' : this._strokeStyle, - 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), - 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : MaterialsModel.getDefaultMaterialName(), + 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null, + 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : null, 'materials' : this.exportMaterialsJSON() }; @@ -327,27 +309,26 @@ exports.Rectangle = Object.create(GeomObj, { this._brRadius = jObj.brRadius; this._innerRadius = jObj.innerRadius; this._strokeStyle = jObj.strokeStyle; - var strokeMaterialName = jObj.strokeMat; - var fillMaterialName = jObj.fillMat; - var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); - if (!strokeMat) { - console.log( "object material not found in library: " + strokeMaterialName ); - strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); + if(jObj.strokeMat) { + var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup(); + if (!strokeMat) { + console.log("object material not found in library: " + jObj.strokeMat); + } else { + this._strokeMaterial = strokeMat; + } } - this._strokeMaterial = strokeMat; - if (this._strokeMaterial.hasProperty( 'color' )) - this._strokeMaterial.setProperty( 'color', this._strokeColor ); - - var fillMat = MaterialsModel.getMaterial( fillMaterialName ).dup(); - if (!fillMat) { - console.log( "object material not found in library: " + fillMaterialName ); - fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); + + if(jObj.fillMat) { + var fillMat = MaterialsModel.getMaterial(jObj.fillMat).dup(); + if (!fillMat) { + console.log("object material not found in library: " + jObj.fillMat); + } else { + this._fillMaterial = fillMat; + } } - this._fillMaterial = fillMat; - if (this._fillMaterial.hasProperty( 'color' )) - this._fillMaterial.setProperty( 'color', this._fillColor ); + this.initColors(); this.importMaterialsJSON( jObj.materials ); } }, -- cgit v1.2.3 From e9d08c7af751d75af16371fcac06fd1af8a60fac Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 23 Jul 2012 14:37:51 -0700 Subject: Bugs fixed: 1915 - Data.JSON too large. Reduced mesh size and limited precision of fp numbers 1381 - Background transparency in preview. 1740 - File Save As caused WebGL to stop animating. Crossed RDGE IDs 1954 - Texture change from material popup broke screen rendering. Set correct context on property change. --- js/lib/geom/brush-stroke.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'js/lib/geom') 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 }; //this.drawToCanvas() + +BrushStroke.prototype._fixCoordPrecision = function(coord, precision){ + var i=0; + var numPoints = coord.length; + for (i=0;i - + this._fixCoordPrecision(retObject.origLocalPoints, 4); retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; retObject.planeMat = this._planeMat; retObject.planeMatInv = this._planeMatInv; -- cgit v1.2.3