aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorAnanya Sen2012-02-17 14:26:56 -0800
committerAnanya Sen2012-02-17 14:26:56 -0800
commit2980816130a44cd478b2a9d6606e021efbcebd4a (patch)
tree762d98ba8852b858c03760f4b9bef294fae6486c /js/mediators
parent96178309ddcdb54c0c451b69ea6fb8cdf76fcf62 (diff)
parenta42c536c2b3209afc058eabd31167bd0aa6f71c8 (diff)
downloadninja-2980816130a44cd478b2a9d6606e021efbcebd4a.tar.gz
Merge branch 'refs/heads/FileIO-jose' into FileIO
Conflicts: css/ninja.css js/controllers/document-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/drag-drop-mediator.js17
-rw-r--r--js/mediators/io-mediator.js11
2 files changed, 22 insertions, 6 deletions
diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js
index ede71383..bf22aed2 100755
--- a/js/mediators/drag-drop-mediator.js
+++ b/js/mediators/drag-drop-mediator.js
@@ -24,6 +24,10 @@ exports.DragDropMediator = Montage.create(Component, {
24 writable: true 24 writable: true
25 }, 25 },
26 26
27 dropDelegate: {
28 value: null
29 },
30
27 deserializedFromTemplate: { 31 deserializedFromTemplate: {
28 value: function() { 32 value: function() {
29 this.eventManager.addEventListener("appLoaded", this, false); 33 this.eventManager.addEventListener("appLoaded", this, false);
@@ -69,13 +73,14 @@ exports.DragDropMediator = Montage.create(Component, {
69 73
70 xferString = evt.dataTransfer.getData("text/plain"); 74 xferString = evt.dataTransfer.getData("text/plain");
71 if(xferString) { 75 if(xferString) {
72 76 // If the drop is a component, call the delegate with the top,left coordinates
73 if(xferString.lastIndexOf("-Component") !== -1) { 77 if(xferString.indexOf("componentDrop") > -1) {
74 component = xferString.substring(0, xferString.lastIndexOf("-Component")); 78 if(this.dropDelegate && typeof this.dropDelegate === 'object') {
75 NJevent( "executeAddComponent", { "component": component, "dropX": this.baseX, "dropY": this.baseY }); 79 this.dropDelegate.handleComponentDrop(this.baseX, this.baseY);
76// ComponentPanelModule.ComponentsPanelBase.addComponentToStage(componentStr.substring(0, compInd), this.baseX, this.baseY); 80 return;
81 }
77 } 82 }
78 return; 83
79 } 84 }
80 85
81 // Verify that browser supports FileReader API. 86 // Verify that browser supports FileReader API.
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 2008e40f..56869839 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -86,6 +86,7 @@ exports.IoMediator = Montage.create(Component, {
86 case 204: 86 case 204:
87 //Creating and formatting result object for callbak 87 //Creating and formatting result object for callbak
88 result = read.file.details; 88 result = read.file.details;
89 result.root = read.file.details.uri.replace(read.file.details.name, "");
89 //Checking for type of content to returns 90 //Checking for type of content to returns
90 if (result.extension !== 'html' && result.extension !== 'htm') { 91 if (result.extension !== 'html' && result.extension !== 'htm') {
91 //Simple string 92 //Simple string
@@ -142,6 +143,16 @@ exports.IoMediator = Montage.create(Component, {
142 // 143 //
143 switch (file.mode) { 144 switch (file.mode) {
144 case 'html': 145 case 'html':
146 //Copy webGL library if needed
147 if (file.webgl.length > 0) {
148 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
149 //if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Assets' || this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
150 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') {
151 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(file.document.root, (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase());
152 }
153 }
154 }
155 //
145 contents = this.parseNinjaTemplateToHtml(file); 156 contents = this.parseNinjaTemplateToHtml(file);
146 break; 157 break;
147 default: 158 default: