aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js2
-rwxr-xr-xjs/controllers/document-controller.js18
-rwxr-xr-xjs/controllers/selection-controller.js5
-rwxr-xr-xjs/controllers/styles-controller.js2
-rwxr-xr-xjs/document/document-html.js2
-rwxr-xr-xjs/document/views/design.js29
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js19
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js7
-rwxr-xr-xjs/helper-classes/3D/view-utils.js13
-rwxr-xr-xjs/mediators/keyboard-mediator.js4
-rwxr-xr-xjs/panels/Splitter.js7
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js6
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js11
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js6
-rwxr-xr-xjs/stage/layout.js6
-rwxr-xr-xjs/stage/stage-deps.js46
-rwxr-xr-xjs/stage/stage.reel/stage.js95
17 files changed, 126 insertions, 152 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 2db775eb..49dbe3cb 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -21,7 +21,7 @@ exports.Breadcrumb = Montage.create(Component, {
21 21
22 handleCloseDocument: { 22 handleCloseDocument: {
23 value: function(){ 23 value: function(){
24 if(!this.application.ninja.documentController.activeDocument) { 24 if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") {
25 this.disabled = true; 25 this.disabled = true;
26 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); 26 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null);
27 } 27 }
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index eecf9146..2c34eedf 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -377,10 +377,10 @@ exports.DocumentController = Montage.create(Component, {
377 377
378 if(this._documents.length > 0) { 378 if(this._documents.length > 0) {
379 previousFocusedDocument = this._documents[this._documents.length - 1]; 379 previousFocusedDocument = this._documents[this._documents.length - 1];
380 this._activeDocument = previousFocusedDocument; 380 this.activeDocument = previousFocusedDocument;
381 this.switchDocuments(this.activeDocument, previousFocusedDocument, true); 381 this.switchDocuments(this.activeDocument, previousFocusedDocument, false);
382 } else { 382 } else {
383 this._activeDocument = null; 383 this.activeDocument = null;
384 this.application.ninja.stage.hideRulers(); 384 this.application.ninja.stage.hideRulers();
385 385
386 this.application.ninja.stage.hideCanvas(true); 386 this.application.ninja.stage.hideCanvas(true);
@@ -502,14 +502,16 @@ exports.DocumentController = Montage.create(Component, {
502 this.application.ninja.stage.restoreAllPanels(); 502 this.application.ninja.stage.restoreAllPanels();
503 this.application.ninja.stage.hideCanvas(false); 503 this.application.ninja.stage.hideCanvas(false);
504 this.application.ninja.stage.showRulers(); 504 this.application.ninja.stage.showRulers();
505 } else if(currentDocument.currentView === "design" && newDocument.currentView === "code") {
506 this.application.ninja.stage.showCodeViewBar(true);
507 this.application.ninja.stage.collapseAllPanels();
508 this.application.ninja.stage.hideCanvas(true);
509 this.application.ninja.stage.hideRulers();
510 } 505 }
511 } 506 }
512 507
508 if(newDocument.currentView === "code") {
509 this.application.ninja.stage.showCodeViewBar(true);
510 this.application.ninja.stage.collapseAllPanels();
511 this.application.ninja.stage.hideCanvas(true);
512 this.application.ninja.stage.hideRulers();
513 }
514
513 this.application.ninja.stage.clearAllCanvas(); 515 this.application.ninja.stage.clearAllCanvas();
514 516
515 if(didCreate) { 517 if(didCreate) {
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 7bef0db8..75bffc5c 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -67,10 +67,9 @@ exports.SelectionController = Montage.create(Component, {
67 this._isDocument = true; 67 this._isDocument = true;
68 68
69 if(currentSelectionArray) { 69 if(currentSelectionArray) {
70 if(currentSelectionArray.length >= 1) { 70 this.application.ninja.selectedElements = currentSelectionArray;
71 if(currentSelectionArray.length) {
71 this._isDocument = false; 72 this._isDocument = false;
72
73 this.application.ninja.selectedElements = currentSelectionArray;
74 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); 73 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument});
75 } 74 }
76 } 75 }
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 04e87ba7..534f77c7 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -81,7 +81,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
81 set : function(document) { 81 set : function(document) {
82 ///// If the document is null set default stylesheets to null 82 ///// If the document is null set default stylesheets to null
83 83
84 if(!document) { 84 if(!document || document.currentView === "code") {
85 this._activeDocument = null; 85 this._activeDocument = null;
86 this._stageStylesheet = null; 86 this._stageStylesheet = null;
87 this.defaultStylesheet = null; 87 this.defaultStylesheet = null;
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 2375632c..157d7a0e 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -84,7 +84,7 @@ exports.HtmlDocument = Montage.create(Component, {
84 //Rendering design view, using observers to know when template is ready 84 //Rendering design view, using observers to know when template is ready
85 this.model.views.design.render(function () { 85 this.model.views.design.render(function () {
86 //TODO: Why is this needed? 86 //TODO: Why is this needed?
87 this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); 87 this.model.views.design._liveNodeList = this.documentRoot.getElementsByTagName('*');
88 //Adding observer to know when template is ready 88 //Adding observer to know when template is ready
89 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 89 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
90 this._observer.observe(this.model.views.design.document.head, {childList: true}); 90 this._observer.observe(this.model.views.design.document.head, {childList: true});
diff --git a/js/document/views/design.js b/js/document/views/design.js
index d1c75c01..06708957 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -67,8 +67,34 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
67 propertiesPanel: { 67 propertiesPanel: {
68 value: null 68 value: null
69 }, 69 },
70
70 //////////////////////////////////////////////////////////////////// 71 ////////////////////////////////////////////////////////////////////
71 // 72 //
73 _liveNodeList: {
74 value: null
75 },
76
77 getLiveNodeList: {
78 value: function(useFilter) {
79 if(useFilter) {
80 var filteredNodes = [],
81 childNodes = Array.prototype.slice.call(this._liveNodeList, 0);
82
83 childNodes.forEach(function(item) {
84 if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) {
85 filteredNodes.push(item);
86 }
87 });
88 return filteredNodes;
89 } else {
90 return Array.prototype.slice.call(this._liveNodeList, 0);
91 }
92 }
93 },
94 ////////////////////////////////////////////////////////////////////
95 //
96
97 //
72 initialize: { 98 initialize: {
73 value: function (parent) { 99 value: function (parent) {
74 //Creating iFrame for view 100 //Creating iFrame for view
@@ -190,9 +216,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
190 this._bodyFragment = null; 216 this._bodyFragment = null;
191 //Calling standard method to finish opening document 217 //Calling standard method to finish opening document
192 this.bodyContentLoaded(null); 218 this.bodyContentLoaded(null);
193 //TODO: Move this to be set via the controller
194 this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2);
195 this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2);
196 } 219 }
197 }, 220 },
198 //////////////////////////////////////////////////////////////////// 221 ////////////////////////////////////////////////////////////////////
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 9de85216..871b832d 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -119,7 +119,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
119 119
120 initializeFromDocument:{ 120 initializeFromDocument:{
121 value:function(){ 121 value:function(){
122 var documentRootChildren = null, i, stage = this.application.ninja.stage; 122 var i,
123 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
124 stage = this.application.ninja.stage,
125 len = documentRootChildren.length;
123 //initialize with current document 126 //initialize with current document
124 this._eltArray = []; 127 this._eltArray = [];
125 this._planesArray = []; 128 this._planesArray = [];
@@ -128,11 +131,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
128 this.setWorkingPlane( [0,0,1,0] ); 131 this.setWorkingPlane( [0,0,1,0] );
129 132
130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 133 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
131 if(this.application.ninja.currentDocument._liveNodeList.length > 0){ 134 if(len > 0) {
132 documentRootChildren = this.application.ninja.currentDocument._liveNodeList; 135 var initL = 0,
133 var len = documentRootChildren.length, 136 initT = 0,
134 minLeft = stage.userPaddingLeft, 137 minLeft = 0,
135 minTop = stage.userPaddingTop, 138 minTop = 0,
136 docLeft = stage.documentOffsetLeft, 139 docLeft = stage.documentOffsetLeft,
137 docTop = stage.documentOffsetTop, 140 docTop = stage.documentOffsetTop,
138 l, 141 l,
@@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {