diff options
author | Eric | 2012-03-12 14:27:24 -0700 |
---|---|---|
committer | Eric | 2012-03-12 14:27:24 -0700 |
commit | e50077ad43f18f16de106ff6547520f73746932e (patch) | |
tree | b2b3e7c5b948f210b9fcc5d3dbd39ae9752938f8 /js | |
parent | 1a70520402677cf3ba257921839a656dcf9a76c2 (diff) | |
parent | 8d62c5b896a1f86f2c7726b30310d6b1c7f535d5 (diff) | |
download | ninja-e50077ad43f18f16de106ff6547520f73746932e.tar.gz |
Merge pull request #4 from joseeight/FileIO-Integration
File IO Updates
Diffstat (limited to 'js')
-rwxr-xr-x | js/data/pi/pi-data.js | 22 | ||||
-rwxr-xr-x | js/document/html-document.js | 8 | ||||
-rw-r--r-- | js/io/system/ninjalibrary.js | 6 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 10 |
4 files changed, 35 insertions, 11 deletions
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index c42d9082..ba03c347 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -331,10 +331,11 @@ exports.PiData = Montage.create( Montage, { | |||
331 | id: "tlRadius", | 331 | id: "tlRadius", |
332 | prop : "tlRadius", | 332 | prop : "tlRadius", |
333 | label: "TL", | 333 | label: "TL", |
334 | valueMutator: parseFloat, | ||
334 | value : 0, | 335 | value : 0, |
335 | min : 0, | 336 | min : 0, |
336 | max : 100, | 337 | max : 100, |
337 | unit : "%", | 338 | unit : "px", |
338 | acceptableUnits: ["px", "pt", "%"] | 339 | acceptableUnits: ["px", "pt", "%"] |
339 | }, | 340 | }, |
340 | { | 341 | { |
@@ -342,10 +343,12 @@ exports.PiData = Montage.create( Montage, { | |||
342 | id : "trRadius", | 343 | id : "trRadius", |
343 | prop : "trRadius", | 344 | prop : "trRadius", |
344 | label : "TR", | 345 | label : "TR", |
346 | valueMutator: parseFloat, | ||
345 | min : 0, | 347 | min : 0, |
346 | max : 100, | 348 | max : 100, |
347 | unit : "%", | 349 | unit : "px", |
348 | acceptableUnits: ["px", "pt", "%"] | 350 | acceptableUnits: ["px", "pt", "%"], |
351 | divider: true | ||
349 | } | 352 | } |
350 | ], | 353 | ], |
351 | [ | 354 | [ |
@@ -354,9 +357,10 @@ exports.PiData = Montage.create( Montage, { | |||
354 | id : "blRadius", | 357 | id : "blRadius", |
355 | prop : "blRadius", | 358 | prop : "blRadius", |
356 | label : "BL", | 359 | label : "BL", |
360 | valueMutator: parseFloat, | ||
357 | min : 0, | 361 | min : 0, |
358 | max : 100, | 362 | max : 100, |
359 | unit : "%", | 363 | unit : "px", |
360 | acceptableUnits: ["px", "pt", "%"] | 364 | acceptableUnits: ["px", "pt", "%"] |
361 | }, | 365 | }, |
362 | { | 366 | { |
@@ -364,9 +368,10 @@ exports.PiData = Montage.create( Montage, { | |||
364 | id : "brRadius", | 368 | id : "brRadius", |
365 | prop : "brRadius", | 369 | prop : "brRadius", |
366 | label : "BR", | 370 | label : "BR", |
371 | valueMutator: parseFloat, | ||
367 | min : 0, | 372 | min : 0, |
368 | max : 100, | 373 | max : 100, |
369 | unit : "%", | 374 | unit : "px", |
370 | acceptableUnits: ["px", "pt", "%"] | 375 | acceptableUnits: ["px", "pt", "%"] |
371 | } | 376 | } |
372 | ] | 377 | ] |
@@ -390,6 +395,7 @@ exports.PiData = Montage.create( Montage, { | |||
390 | { | 395 | { |
391 | type: "dropdown", | 396 | type: "dropdown", |
392 | id: "strokeMaterial", | 397 | id: "strokeMaterial", |
398 | prop: "strokeMaterial", | ||
393 | label: "Stroke", | 399 | label: "Stroke", |
394 | labelField: "_name", | 400 | labelField: "_name", |
395 | dataField: "_name", | 401 | dataField: "_name", |
@@ -402,6 +408,7 @@ exports.PiData = Montage.create( Montage, { | |||
402 | { | 408 | { |
403 | type: "dropdown", | 409 | type: "dropdown", |
404 | id: "fillMaterial", | 410 | id: "fillMaterial", |
411 | prop: "fillMaterial", | ||
405 | label: "Fill", | 412 | label: "Fill", |
406 | labelField: "_name", | 413 | labelField: "_name", |
407 | dataField: "_name", | 414 | dataField: "_name", |
@@ -524,7 +531,8 @@ exports.PiData = Montage.create( Montage, { | |||
524 | type: "hottext", | 531 | type: "hottext", |
525 | id: "innerRadius", | 532 | id: "innerRadius", |
526 | prop: "innerRadius", | 533 | prop: "innerRadius", |
527 | label: "Inner Radius", | 534 | label: "Inner R", |
535 | valueMutator: parseFloat, | ||
528 | value : 0, | 536 | value : 0, |
529 | min : 0, | 537 | min : 0, |
530 | max : 100, | 538 | max : 100, |
@@ -553,6 +561,7 @@ exports.PiData = Montage.create( Montage, { | |||
553 | { | 561 | { |
554 | type: "dropdown", | 562 | type: "dropdown", |
555 | id: "strokeMaterial", | 563 | id: "strokeMaterial", |
564 | prop: "strokeMaterial", | ||
556 | label: "Stroke", | 565 | label: "Stroke", |
557 | labelField: "_name", | 566 | labelField: "_name", |
558 | dataField: "_name", | 567 | dataField: "_name", |
@@ -565,6 +574,7 @@ exports.PiData = Montage.create( Montage, { | |||
565 | { | 574 | { |
566 | type: "dropdown", | 575 | type: "dropdown", |
567 | id: "fillMaterial", | 576 | id: "fillMaterial", |
577 | prop: "fillMaterial", | ||
568 | label: "Fill", | 578 | label: "Fill", |
569 | labelField: "_name", | 579 | labelField: "_name", |
570 | dataField: "_name", | 580 | dataField: "_name", |
diff --git a/js/document/html-document.js b/js/document/html-document.js index 79450494..051490f5 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -871,8 +871,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
871 | value: function () { | 871 | value: function () { |
872 | //TODO: Add logic to handle save before preview | 872 | //TODO: Add logic to handle save before preview |
873 | this.application.ninja.documentController.handleExecuteSaveAll(null); | 873 | this.application.ninja.documentController.handleExecuteSaveAll(null); |
874 | //Launching 'blank' tab for testing movie | 874 | //Temp check for webGL Hack |
875 | window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); | 875 | if (this.application.ninja.documentController.activeDocument.glData.length && this.application.ninja.documentController.activeDocument.glData.length > 0) { |
876 | setTimeout(function () {window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]);}.bind(this), 3500); | ||
877 | } else { | ||
878 | window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); | ||
879 | } | ||
876 | //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); | 880 | //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); |
877 | } | 881 | } |
878 | }, | 882 | }, |
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index ff949613..201598fc 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js | |||
@@ -82,7 +82,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
82 | // | 82 | // |
83 | copyLibToCloud: { | 83 | copyLibToCloud: { |
84 | enumerable: false, | 84 | enumerable: false, |
85 | value: function (path, libName) { | 85 | value: function (path, libName, callback) { |
86 | // | 86 | // |
87 | if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { | 87 | if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { |
88 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { | 88 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { |
@@ -91,7 +91,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
91 | //Getting contents of library to be copied | 91 | //Getting contents of library to be copied |
92 | this.chromeApi.directoryContents(contents[i], function (lib) { | 92 | this.chromeApi.directoryContents(contents[i], function (lib) { |
93 | //Creating directory structure from subfolders | 93 | //Creating directory structure from subfolders |
94 | this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); | 94 | this.copyDirectoryToCloud(path, contents[i], path, callback); |
95 | }.bind(this)); | 95 | }.bind(this)); |
96 | break; | 96 | break; |
97 | } | 97 | } |
@@ -138,6 +138,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
138 | } | 138 | } |
139 | }.bind(this)); | 139 | }.bind(this)); |
140 | } | 140 | } |
141 | //TODO Add logic for proper callback status(es) | ||
142 | if (callback) callback(true); | ||
141 | } | 143 | } |
142 | }, | 144 | }, |
143 | //////////////////////////////////////////////////////////////////// | 145 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index d26c7a88..e9661f20 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -355,7 +355,15 @@ exports.IoMediator = Montage.create(Component, { | |||
355 | if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { | 355 | if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { |
356 | rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); | 356 | rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); |
357 | rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; | 357 | rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; |
358 | this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName); | 358 | this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, rdgeDirName, hackRename.bind(this)); |
359 | //TODO: Remove, this is copying the library into a static name | ||
360 | function hackRename (status) { | ||
361 | if (status) { | ||
362 | setTimeout(function () { | ||
363 | this.application.ninja.coreIoApi.copyDirectory({sourceUri: template.document.root+rdgeDirName, destUri: template.document.root+'assets'}); | ||
364 | }.bind(this), 3000); | ||
365 | } | ||
366 | } | ||
359 | } else { | 367 | } else { |
360 | //TODO: Error handle no available library to copy | 368 | //TODO: Error handle no available library to copy |
361 | } | 369 | } |