aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/clipboard/external-apps-clipboard-agent.js6
-rw-r--r--js/controllers/clipboard-controller.js21
-rwxr-xr-xjs/controllers/elements/shapes-controller.js8
-rwxr-xr-xjs/lib/geom/circle.js57
-rwxr-xr-xjs/lib/geom/geom-obj.js20
-rwxr-xr-xjs/lib/geom/line.js26
-rwxr-xr-xjs/lib/geom/rectangle.js57
-rwxr-xr-xjs/mediators/element-mediator.js9
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.js20
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js2
-rwxr-xr-xjs/stage/stage.reel/stage.js4
-rwxr-xr-xjs/tools/ShapeTool.js34
12 files changed, 101 insertions, 163 deletions
diff --git a/js/clipboard/external-apps-clipboard-agent.js b/js/clipboard/external-apps-clipboard-agent.js
index 65410543..b82784d3 100644
--- a/js/clipboard/external-apps-clipboard-agent.js
+++ b/js/clipboard/external-apps-clipboard-agent.js
@@ -148,16 +148,12 @@ var ExternalAppsClipboardAgent = exports.ExternalAppsClipboardAgent = Montage.cr
148 data = htmlData ? htmlData : textData; 148 data = htmlData ? htmlData : textData;
149 149
150 if (data && data.length) { 150 if (data && data.length) {
151 //deselect current selections
152 this.application.ninja.selectedElements.length = 0;
153 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": true} );
154
155 divWrapper = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); 151 divWrapper = document.application.njUtils.make("div", null, this.application.ninja.currentDocument);
156 this.application.ninja.elementMediator.addElements(divWrapper, {"height": "68px", 152 this.application.ninja.elementMediator.addElements(divWrapper, {"height": "68px",
157 "left": "0px", 153 "left": "0px",
158 "position": "absolute", 154 "position": "absolute",
159 "top": "0px", 155 "top": "0px",
160 "width": "161px"}, false); 156 "width": "161px"}, false/*notify*/, false/*callAddDelegate*/);
161 157
162 divWrapper.innerHTML = data; 158 divWrapper.innerHTML = data;
163 159
diff --git a/js/controllers/clipboard-controller.js b/js/controllers/clipboard-controller.js
index c3543c95..3eba1bec 100644
--- a/js/controllers/clipboard-controller.js
+++ b/js/controllers/clipboard-controller.js
@@ -82,16 +82,11 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
82 82
83 // Don't do anything if an input or other control is focused except the copy menu button 83 // Don't do anything if an input or other control is focused except the copy menu button
84 if(document.activeElement.nodeName !== "BODY") { 84 if(document.activeElement.nodeName !== "BODY") {
85 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") { 85 if(!(document.activeElement.getAttribute("data-montage-id") === "menuItemButton")) {
86 return; 86 return;
87 } 87 }
88 } 88 }
89 89
90 //perform clipboard operations only if selection tool is selected
91 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
92 return;
93 }
94
95 if(this.clipboardContext === "stage"){ 90 if(this.clipboardContext === "stage"){
96 ElementsClipboardAgent.copy(clipboardEvent); 91 ElementsClipboardAgent.copy(clipboardEvent);
97 } 92 }
@@ -106,16 +101,11 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
106 101
107 // Don't do anything if an input or other control is focused 102 // Don't do anything if an input or other control is focused
108 if(document.activeElement.nodeName !== "BODY") { 103 if(document.activeElement.nodeName !== "BODY") {
109 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") { 104 if(!(document.activeElement.getAttribute("data-montage-id") === "menuItemButton")) {
110 return; 105 return;
111 } 106 }
112 } 107 }
113 108
114 //perform clipboard operations only if selection tool is selected
115 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
116 return;
117 }
118
119 if(this.clipboardContext === "stage"){ 109 if(this.clipboardContext === "stage"){
120 ElementsClipboardAgent.cut(clipboardEvent); 110 ElementsClipboardAgent.cut(clipboardEvent);
121 } 111 }
@@ -137,16 +127,11 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
137 127
138 // Don't do anything if an input or other control is focused 128 // Don't do anything if an input or other control is focused
139 if(document.activeElement.nodeName !== "BODY") { 129 if(document.activeElement.nodeName !== "BODY") {
140 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") { 130 if(!(document.activeElement.getAttribute("data-montage-id") === "menuItemButton")) {
141 return; 131 return;
142 } 132 }
143 } 133 }
144 134
145 //perform clipboard operations only if selection tool is selected
146 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
147 return;
148 }
149
150 //TODO: return if stage is not focussed 135 //TODO: return if stage is not focussed
151 136
152 if(this.clipboardContext === "stage"){ 137 if(this.clipboardContext === "stage"){
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 1d945066..6dabff47 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -841,10 +841,10 @@ exports.ShapesController = Montage.create(CanvasController, {
841 child.strokeMat = "Linear Gradient"; 841 child.strokeMat = "Linear Gradient";
842 } 842 }
843 } 843 }
844 else if( (child.strokeMat === "Radial Gradient") || 844 else if( !child.strokeMat || (child.strokeMat === "Radial Gradient") ||
845 (child.strokeMat === "Linear Gradient") ) 845 (child.strokeMat === "Linear Gradient") )
846 { 846 {
847 // Set Flat Material for children geometry if color has been changed to solid 847 // Set Flat Material for children geometry if no material defined or color has been changed to solid
848 child.strokeMat = "Flat"; 848 child.strokeMat = "Flat";
849 } 849 }
850 } 850 }
@@ -863,10 +863,10 @@ exports.ShapesController = Montage.create(CanvasController, {
863 child.fillMat = "Linear Gradient"; 863 child.fillMat = "Linear Gradient";
864 } 864 }
865 } 865 }
866 else if( (child.fillMat === "Radial Gradient") || 866 else if( !child.fillMat || (child.fillMat === "Radial Gradient") ||
867 (child.fillMat === "Linear Gradient") ) 867 (child.fillMat === "Linear Gradient") )
868 { 868 {
869 // Set Flat Material for children geometry if color has been changed to solid 869 // Set Flat Material for children geometry if no material defined or color has been changed to solid
870 child.fillMat = "Flat"; 870 child.fillMat = "Flat";
871 } 871 }
872 } 872 }
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, {
83 83
84 if(strokeMaterial) { 84 if(strokeMaterial) {
85 this._strokeMaterial = strokeMaterial.dup(); 85 this._strokeMaterial = strokeMaterial.dup();
86 } else {
87 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
88 }
89
90 if(strokeColor) {
91 if(this._strokeMaterial.hasProperty("color")) {
92 this._strokeMaterial.setProperty( "color", this._strokeColor );
93 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
94 this._strokeMaterial.setGradientData(this._strokeColor.color);
95 }
96 } 86 }
97 87
98 if(fillMaterial) { 88 if(fillMaterial) {
99 this._fillMaterial = fillMaterial.dup(); 89 this._fillMaterial = fillMaterial.dup();
100 } else {
101 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
102 } 90 }
103 91
104 if(fillColor) { 92 this.initColors();
105 if(this._fillMaterial.hasProperty("color")) {
106 this._fillMaterial.setProperty( "color", this._fillColor );
107 } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) {
108 this._fillMaterial.setGradientData(this._fillColor.color);
109 }
110 }
111 } 93 }
112 }, 94 },
113 95
@@ -770,8 +752,8 @@ exports.Circle = Object.create(GeomObj, {
770 'fillColor' : this._fillColor, 752 'fillColor' : this._fillColor,
771 'innerRadius' : this._innerRadius, 753 'innerRadius' : this._innerRadius,
772 'strokeStyle' : this._strokeStyle, 754 'strokeStyle' : this._strokeStyle,
773 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 755 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null,
774 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 756 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : null,
775 'materials' : this.exportMaterialsJSON() 757 'materials' : this.exportMaterialsJSON()
776 }; 758 };
777 759
@@ -790,27 +772,26 @@ exports.Circle = Object.create(GeomObj, {
790 this._fillColor = jObj.fillColor; 772 this._fillColor = jObj.fillColor;
791 this._innerRadius = jObj.innerRadius; 773 this._innerRadius = jObj.innerRadius;
792 this._strokeStyle = jObj.strokeStyle; 774 this._strokeStyle = jObj.strokeStyle;
793 var strokeMaterialName = jObj.strokeMat;
794 var fillMaterialName = jObj.fillMat;
795 775
796 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); 776 if(jObj.strokeMat) {
797 if (!strokeMat) { 777 var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup();
798 console.log( "object material not found in library: " + strokeMaterialName ); 778 if (!strokeMat) {
799 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 779 console.log("object material not found in library: " + jObj.strokeMat);
780 } else {
781 this._strokeMaterial = strokeMat;
782 }
800 } 783 }