aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-18 09:52:15 -0700
committerJose Antonio Marquez2012-05-18 09:52:15 -0700
commit6c70c8bf28c2239d29f3abecc8a7ea59b2860bab (patch)
treec506b28bc82f74072f324d920105737726d5ecaf /js
parent015df99dff8306f8839affd22cdd7689eb00e180 (diff)
parent24d1873302b2fffc25d254e15e8aa36f59eedb88 (diff)
downloadninja-6c70c8bf28c2239d29f3abecc8a7ea59b2860bab.tar.gz
Merge branch 'refs/heads/Ninja-DOM-Architecture' into Document
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js4
-rwxr-xr-xjs/components/layout/tool-button.reel/tool-button.html4
-rwxr-xr-xjs/components/layout/tool-button.reel/tool-button.js11
-rwxr-xr-xjs/components/layout/tools-list.reel/tools-list.html12
-rwxr-xr-xjs/controllers/document-controller.js78
-rwxr-xr-xjs/controllers/selection-controller.js4
-rwxr-xr-xjs/data/tools-data.js13
-rwxr-xr-xjs/document/document-html.js22
-rwxr-xr-xjs/document/html-document.js78
-rwxr-xr-xjs/document/models/base.js2
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js4
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js20
-rwxr-xr-xjs/helper-classes/3D/view-utils.js53
-rwxr-xr-xjs/ninja.reel/ninja.js32
-rwxr-xr-xjs/panels/properties.reel/properties.js16
-rwxr-xr-xjs/stage/stage-deps.js73
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js22
-rwxr-xr-xjs/stage/stage.reel/stage.html3
-rwxr-xr-xjs/stage/stage.reel/stage.js8
-rwxr-xr-xjs/tools/drawing-tool-base.js39
20 files changed, 174 insertions, 324 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index ad0236c6..50b3624c 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -121,8 +121,8 @@ exports.DocumentEntry = Montage.create(Component, {
121 if(event._event.target.nodeName === "IMG") { 121 if(event._event.target.nodeName === "IMG") {
122 this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 122 this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid));
123 } else { 123 } else {
124 if(!this._document.isActive) { 124 if(!this.active) {
125 this.application.ninja.stage.stageView.switchDocument(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 125 this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid));
126 } 126 }
127 } 127 }
128 } 128 }
diff --git a/js/components/layout/tool-button.reel/tool-button.html b/js/components/layout/tool-button.reel/tool-button.html
index 84a6d34e..a329f646 100755
--- a/js/components/layout/tool-button.reel/tool-button.html
+++ b/js/components/layout/tool-button.reel/tool-button.html
@@ -16,6 +16,10 @@
16 "prototype": "js/components/layout/tool-button.reel", 16 "prototype": "js/components/layout/tool-button.reel",
17 "properties": { 17 "properties": {
18 "element": {"#": "toolBarButton"} 18 "element": {"#": "toolBarButton"}
19 },
20 "bindings": {
21 "selected": {"<<->": "@owner.data.selected"},
22 "subselected": {"<-": "@owner.data.subtools.selected"}
19 } 23 }
20 } 24 }
21 } 25 }
diff --git a/js/components/layout/tool-button.reel/tool-button.js b/js/components/layout/tool-button.reel/tool-button.js
index 6cea0dc3..6008c4ec 100755
--- a/js/components/layout/tool-button.reel/tool-button.js
+++ b/js/components/layout/tool-button.reel/tool-button.js
@@ -48,19 +48,8 @@ exports.ToolButton = Montage.create(Component, {
48 this.element.addEventListener("mousedown", this, false); 48 this.element.addEventListener("mousedown", this, false);
49 this.element.addEventListener("dblclick", this, false); 49 this.element.addEventListener("dblclick", this, false);
50 50
51 Object.defineBinding(this, "selected", {
52 boundObject: this.data,
53 boundObjectPropertyPath: "selected",
54 oneway: false
55 });
56
57 if(this.data.container) { 51 if(this.data.container) {
58 this.element.title = this.data.subtools[this._subselected].toolTip; 52 this.element.title = this.data.subtools[this._subselected].toolTip;
59 Object.defineBinding(this, "subselected", {
60 boundObject: this.data.subtools,
61 boundObjectPropertyPath: "selected",
62 oneway: true
63 });
64 } 53 }
65 54
66 this.element.classList.add(this.data.id) 55 this.element.classList.add(this.data.id)
diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html
index d5c33624..df603bf8 100755
--- a/js/components/layout/tools-list.reel/tools-list.html
+++ b/js/components/layout/tools-list.reel/tools-list.html
@@ -16,11 +16,7 @@
16 "element": {"#": "toolbutton"} 16 "element": {"#": "toolbutton"}
17 }, 17 },
18 "bindings": { 18 "bindings": {
19 "data": { 19 "data": {"<-": "@repetition1.objectAtCurrentIteration"}
20 "boundObject": {"@": "repetition1"},
21 "boundObjectPropertyPath": "objectAtCurrentIteration",
22 "oneway": true
23 }
24 } 20 }
25 }, 21 },
26 22
@@ -30,11 +26,7 @@
30 "element": {"#": "groupLine"} 26 "element": {"#": "groupLine"}
31 }, 27 },
32 "bindings": { 28 "bindings": {
33 "condition": { 29 "condition": {"<-": "@repetition1.objectAtCurrentIteration.lastInGroup"}
34 "boundObject": {"@": "repetition1"},
35 "boundObjectPropertyPath": "objectAtCurrentIteration.lastInGroup",
36 "oneway": true
37 }
38 } 30 }
39 }, 31 },
40 32
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index cf46e73e..f1523d87 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -177,8 +177,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
177 value: function(event) { 177 value: function(event) {
178 var saveAsSettings = event._event.settings || {}; 178 var saveAsSettings = event._event.settings || {};
179 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ 179 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
180 saveAsSettings.fileName = this.activeDocument.name; 180 saveAsSettings.fileName = this.activeDocument.model.file.name;
181 saveAsSettings.folderUri = this.activeDocument.uri.substring(0, this.activeDocument.uri.lastIndexOf("/")); 181 saveAsSettings.folderUri = this.activeDocument.model.file.uri.substring(0, this.activeDocument.model.file.uri.lastIndexOf("/"));
182 saveAsSettings.callback = this.saveAsCallback.bind(this); 182 saveAsSettings.callback = this.saveAsCallback.bind(this);
183 this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings); 183 this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings);
184 } 184 }
@@ -454,58 +454,54 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
454 // Open document callback 454 // Open document callback
455 _onOpenDocument: { 455 _onOpenDocument: {
456 value: function(doc){ 456 value: function(doc){
457 457 var currentDocument;
458 if(this.activeDocument) { 458 if(this.activeDocument) {
459 // There is a document currently opened 459 // There is a document currently opened
460 currentDocument = this.activeDocument;
460 461
461
462
463 //this.application.ninja.stage.stageView.showCodeViewBar(false);
464 //this.application.ninja.stage.stageView.restoreAllPanels(); 462 //this.application.ninja.stage.stageView.restoreAllPanels();
465
466 //
467 /*
468 if(this.activeDocument.currentView === "design"){
469 this.activeDocument.saveAppState();
470 this.activeDocument.container.parentNode.style["display"] = "none";
471 this.application.ninja.stage.hideCanvas(true);
472 this.application.ninja.stage.stageView.hideRulers();
473 }
474
475 this.activeDocument.container.style["display"] = "none";
476 */
477
478 /*
479 this.activeDocument.container.style["display"] = "block";
480 if(this.activeDocument.currentView === "design"){
481 this.activeDocument.container.parentNode.style["display"] = "block";
482 this.activeDocument.restoreAppState();
483 }else{
484 //hide the iframe when switching to code view
485 document.getElementById("iframeContainer").style.display = "none";
486 }
487
488 */
489 // hide current document
490 } else { 463 } else {
491 // There is no document opened 464 // There is no document opened
492 465
493 // Set the active document 466 // Show the rulers
494 this.activeDocument = doc; 467 // TODO: Move this indo design view
468 this.application.ninja.stage.stageView.showRulers();
495 469
496 // Show the canvas 470 // Show the canvas
497 this.application.ninja.stage.hideCanvas(false); 471 this.application.ninja.stage.hideCanvas(false);
472 }
498 473
499 // Show the rulers 474 // Set the active document
500 // TODO: Move this indo design view 475 this.activeDocument = doc;
501 this.application.ninja.stage.stageView.showRulers(); 476
477 // Initialize the documentRoot styles
478 this.initializeRootStyles(doc.documentRoot);
479 // Flag to stop stylesheet dirty event
480 this._hackInitialStyles = false;
481
482 this.switchDocuments(currentDocument, doc, true);
483 }
484 },
502 485
503 // Initialize the documentRoot styles 486 switchDocuments: {
504 this.initializeRootStyles(doc.documentRoot); 487 value: function(currentDocument, newDocument, didCreate) {
505 // Flag to stop stylesheet dirty event