aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.css10
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js76
2 files changed, 74 insertions, 12 deletions
diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.css b/js/panels/Materials/materials-popup.reel/materials-popup.css
index 2de03e91..b57d4a03 100755
--- a/js/panels/Materials/materials-popup.reel/materials-popup.css
+++ b/js/panels/Materials/materials-popup.reel/materials-popup.css
@@ -88,6 +88,16 @@
88 position: relative; 88 position: relative;
89} 89}
90 90
91.mp_property .gradientpicker
92{
93 top: 0;
94}
95
96.mp_property .gradientpicker .type
97{
98 display: none;
99}
100
91.mp_properties_list 101.mp_properties_list
92{ 102{
93 padding-bottom: 8px; 103 padding-bottom: 8px;
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