aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials/materials-popup.reel/materials-popup.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-07-09 11:43:36 -0700
committerNivesh Rajbhandari2012-07-09 11:43:36 -0700
commitac27d538af33ca8d67d3d88729f49c05793afda7 (patch)
tree4be9251ff087e93a37b1f463ae9eaaaf779caeeb /js/panels/Materials/materials-popup.reel/materials-popup.js
parenteff1851b2189bea8b89065980d02541cecea5ddf (diff)
downloadninja-ac27d538af33ca8d67d3d88729f49c05793afda7.tar.gz
PI, drawing and editing fixes for shapes and materials.
IKNinja-1841 - Cannot change webgl shape with LinearGradient and RadialGradient to solid color. IKNINJA-1851 - Cannot draw webgl shapes with Linear/RadialGradient material. IKNINJA-1864 - PI doesn't update the color of shape if WebGL material switches to Flat. IKNINJA-1886 - Gradient edits not applied to WebGL Stage object. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/panels/Materials/materials-popup.reel/materials-popup.js')
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js76
1 files changed, 64 insertions, 12 deletions
diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js
index 9b7b031b..a1415343 100755
--- a/js/panels/Materials/materials-popup.reel/materials-popup.js
+++ b/js/panels/Materials/materials-popup.reel/materials-popup.js
@@ -9,7 +9,8 @@ var Montage = require("montage/core/core").Montage,
9 MaterialsModel = require("js/models/materials-model").MaterialsModel, 9 MaterialsModel = require("js/models/materials-model").MaterialsModel,
10 NJUtils = require("js/lib/NJUtils").NJUtils, 10 NJUtils = require("js/lib/NJUtils").NJUtils,
11 World = require("js/lib/drawing/world").World, 11 World = require("js/lib/drawing/world").World,
12 Rectangle = require("js/lib/geom/rectangle").Rectangle; 12 Rectangle = require("js/lib/geom/rectangle").Rectangle,
13 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController;
13 14
14//////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////
15//Exporting as MaterialsPopup 16//Exporting as MaterialsPopup
@@ -341,6 +342,10 @@ exports.MaterialsPopup = Montage.create(Component, {
341 rtnValue = value; 342 rtnValue = value;
342 break; 343 break;
343 344
345 case "gradient":
346 rtnValue = value;
347 break;
348
344 default: 349 default:
345 console.log( "unrecognized material control type: " + type ); 350 console.log( "unrecognized material control type: " + type );
346 break; 351 break;
@@ -432,7 +437,11 @@ exports.MaterialsPopup = Montage.create(Component, {
432 { 437 {
433 this._material = material; 438 this._material = material;
434 this._originalValues = material.exportJSON(); 439 this._originalValues = material.exportJSON();
435 this.materialsData = this.getMaterialData( material ); 440 if((materialID === "Linear Gradient") || (materialID === "Radial Gradient")) {
441 this.materialsData = this.getEditableProperties( material );
442 } else {
443 this.materialsData = this.getMaterialData( material );
444 }
436 } 445 }
437 else 446 else
438 { 447 {
@@ -442,6 +451,26 @@ exports.MaterialsPopup = Montage.create(Component, {
442 } 451 }
443 }, 452 },
444 453
454 getEditableProperties: {
455 value: function(material) {
456 // declare the array to hold the results
457 var rtnArray = [],
458 obj,
459 colorObj = ShapesController.getMaterialColor(material.getName());
460
461 this._propNames = ["gradient"];
462 this._propValues = ["gradient"];
463 this._propTypes = ["gradient"];
464 this._propLabels = ["gradient"];
465
466 obj = this.createGradientData("gradient", colorObj);
467
468 rtnArray.push(obj);
469
470 return rtnArray;
471 }
472 },
473
445 getMaterialData: 474 getMaterialData:
446 { 475 {
447 value: function( material ) 476 value: function( material )
@@ -489,17 +518,21 @@ exports.MaterialsPopup = Montage.create(Component, {
489 obj = this.createCheckboxData( propLabels[i], propValues[i] ); 518 obj = this.createCheckboxData( propLabels[i], propValues[i] );
490 break; 519 break;
491 520
492 default: 521 case "gradient":
493 console.log( "unrecognized material control type: " + propType[i] ); 522 obj = this.createGradientData( propLabels[i], propValues[i] );
494 break; 523 break;
495 }
496 524
497 if (obj) 525 default:
498 { 526 console.log( "unrecognized material control type: " + propType[i] );
499 rtnArray.push( obj ); 527 break;
500 obj = null; 528 }
501 } 529
502 } 530 if (obj)
531 {
532 rtnArray.push( obj );
533 obj = null;
534 }
535 }
503 536
504 return rtnArray; 537 return rtnArray;
505 } 538 }
@@ -650,6 +683,25 @@ exports.MaterialsPopup = Montage.create(Component, {
650 } 683 }
651 }, 684 },
652 685
686 createGradientData:
687 {
688 value: function( label, colorObj )
689 {
690 var obj = {
691 "label": label,
692 "description": "a gradient",
693 "controlType": "GradientPicker",
694 "defaults":
695 {
696 "_mode": colorObj.gradientMode,
697 "value": colorObj.color
698 }
699 };
700
701 return obj;
702 }
703 },
704
653 materialsProperties: { 705 materialsProperties: {
654 serializable: true, 706 serializable: true,
655 value: null 707 value: null