aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js16
-rwxr-xr-xjs/controllers/elements/element-controller.js6
-rwxr-xr-xjs/controllers/selection-controller.js9
-rwxr-xr-xjs/document/html-document.js53
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js20
-rwxr-xr-xjs/mediators/keyboard-mediator.js8
-rwxr-xr-xjs/stage/layout.js5
-rwxr-xr-xjs/stage/stage-deps.js38
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js21
-rwxr-xr-xjs/stage/stage.reel/stage.js14
10 files changed, 164 insertions, 26 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index d5d0cf42..02031922 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -195,6 +195,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
195 value:function(doc){ 195 value:function(doc){
196 var response = doc || null;//default just for testing 196 var response = doc || null;//default just for testing
197 if(!!response && response.success && (response.status!== 500) && !!response.uri){ 197 if(!!response && response.success && (response.status!== 500) && !!response.uri){
198 this.creatingNewFile = true;//flag for timeline to identify new file flow
198 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 199 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
199 }else if(!!response && !response.success){ 200 }else if(!!response && !response.success){
200 //Todo: restrict directory path to the sandbox, in the dialog itself 201 //Todo: restrict directory path to the sandbox, in the dialog itself
@@ -222,6 +223,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
222 value:function(response){ 223 value:function(response){
223 //TODO: Add UI to handle error codes, shouldn't be alert windows 224 //TODO: Add UI to handle error codes, shouldn't be alert windows
224 if(!!response && (response.status === 204)) { 225 if(!!response && (response.status === 204)) {
226
227 if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow
228 this.creatingNewFile = false;
229 }
230
225 //Sending full response object 231 //Sending full response object
226 this.openDocument(response); 232 this.openDocument(response);
227 } else if (!!response && (response.status === 404)){ 233 } else if (!!response && (response.status === 404)){
@@ -332,6 +338,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
332 338
333 this.application.ninja.stage.hideCanvas(true); 339 this.application.ninja.stage.hideCanvas(true);
334 } 340 }
341
342 NJevent("closeDocument", doc.uri);
343
344 doc=null;
335 } 345 }
336 }, 346 },
337 347
@@ -339,7 +349,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
339 // Event Detail: Contains the current ActiveDocument 349 // Event Detail: Contains the current ActiveDocument
340 _onOpenDocument: { 350 _onOpenDocument: {
341 value: function(doc){ 351 value: function(doc){
342 //var data = DocumentManager.activeDocument; 352 this.application.ninja.currentDocument = doc;
343 this._hideCurrentDocument(); 353 this._hideCurrentDocument();
344 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); 354 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
345 355
@@ -423,7 +433,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
423 value: function() { 433 value: function() {
424 if(this.activeDocument) { 434 if(this.activeDocument) {
425 if(this.activeDocument.currentView === "design"){ 435 if(this.activeDocument.currentView === "design"){
426 this.application.ninja.stage.saveScroll(); 436 this.activeDocument.saveAppState();
427 this.activeDocument.container.parentNode.style["display"] = "none"; 437 this.activeDocument.container.parentNode.style["display"] = "none";
428 this.application.ninja.stage.hideCanvas(true); 438 this.application.ninja.stage.hideCanvas(true);
429 this.application.ninja.stage.stageView.hideRulers(); 439 this.application.ninja.stage.stageView.hideRulers();
@@ -440,7 +450,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
440 this.activeDocument.container.style["display"] = "block"; 450 this.activeDocument.container.style["display"] = "block";
441 if(this.activeDocument.currentView === "design"){ 451 if(this.activeDocument.currentView === "design"){
442 this.activeDocument.container.parentNode.style["display"] = "block"; 452 this.activeDocument.container.parentNode.style["display"] = "block";
443 this.application.ninja.stage.restoreScroll(); 453 this.activeDocument.restoreAppState();
444 this.application.ninja.stage.hideCanvas(false); 454 this.application.ninja.stage.hideCanvas(false);
445 this.application.ninja.stage.stageView.showRulers(); 455 this.application.ninja.stage.stageView.showRulers();
446 }else{ 456 }else{
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 46e82ace..ec0335b4 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -27,7 +27,11 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
27 27
28 getProperty: { 28 getProperty: {
29 value: function(el, prop, fallbackOnComputed, isStageElement) { 29 value: function(el, prop, fallbackOnComputed, isStageElement) {
30 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement); 30 if(el.nodeType !== 3){
31 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement);
32 }else{
33 return null;
34 }
31 } 35 }
32 }, 36 },
33 37
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index d69b53e0..f50762f3 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -58,6 +58,7 @@ exports.SelectionController = Montage.create(Component, {
58 handleOpenDocument: { 58 handleOpenDocument: {
59 value: function() { 59 value: function() {
60 // Handle initializing the selection array here. 60 // Handle initializing the selection array here.
61 this.initWithDocument([]);
61 } 62 }
62 }, 63 },
63 64
@@ -70,6 +71,14 @@ exports.SelectionController = Montage.create(Component, {
70 if(currentSelectionArray.length >= 1) { 71 if(currentSelectionArray.length >= 1) {
71 this._selectedItems = currentSelectionArray; 72 this._selectedItems = currentSelectionArray;
72 this._isDocument = false; 73 this._isDocument = false;
74
75
76
77 this.application.ninja.selectedElements = currentSelectionArray;
78 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
79
80
81
73 } 82 }
74 } 83 }
75 84
diff --git a/js/document/html-document.js b/js/document/html-document.js
index ca1b0886..1901079d 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -54,6 +54,11 @@ exports.HTMLDocument = Montage.create(TextDocument, {
54 }, 54 },
55 55
56 56
57 //drawUtils state
58 _gridHorizontalSpacing: {value:0},
59 _gridVerticalSpacing: {value:0},
60 //end - drawUtils state
61
57 62
58 // GETTERS / SETTERS 63 // GETTERS / SETTERS
59 64
@@ -72,6 +77,16 @@ exports.HTMLDocument = Montage.create(TextDocument, {
72 set: function(value) { this._savedTopScroll = value} 77 set: function(value) { this._savedTopScroll = value}
73 }, 78 },
74 79
80 gridHorizontalSpacing:{
81 get: function() { return this._gridHorizontalSpacing; },
82 set: function(value) { this._gridHorizontalSpacing = value}
83 },
84
85 gridVerticalSpacing:{
86 get: function() { return this._gridVerticalSpacing; },
87 set: function(value) { this._gridVerticalSpacing = value}
88 },
89
75 selectionExclude: { 90 selectionExclude: {
76 get: function() { return this._selectionExclude; }, 91 get: function() { return this._selectionExclude; },
77 set: function(value) { this._selectionExclude = value; } 92 set: function(value) { this._selectionExclude = value; }
@@ -616,7 +631,43 @@ exports.HTMLDocument = Montage.create(TextDocument, {
616 //Error 631 //Error
617 } 632 }
618 } 633 }
619 } 634 },
620 //////////////////////////////////////////////////////////////////// 635 ////////////////////////////////////////////////////////////////////
636 saveAppState:{
637 enumerable: false,
638 value: function () {
639
640 this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft;
641 this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop;
642
643 this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
644 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
645
646 if(typeof this.application.ninja.selectedElements !== 'undefined'){
647 this.selectionModel = this.application.ninja.selectedElements;
648 }
649 }
650 },
651
652 ////////////////////////////////////////////////////////////////////
653 restoreAppState:{
654 enumerable: false,
655 value: function () {
656 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
657 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
658
659 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null) && (this.selectionModel.length > 0)){
660 this.application.ninja.selectionController.initWithDocument(this.selectionModel);
661 }
662
663 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){
664 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
665 this.application.ninja.stage._scrollLeft = this.savedLeftScroll;
666 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
667 this.application.ninja.stage._scrollLeft = this.savedTopScroll;
668 }
669 this.application.ninja.stage.handleScroll();
670 }
671 }
621 //////////////////////////////////////////////////////////////////// 672 ////////////////////////////////////////////////////////////////////
622}); \ No newline at end of file 673}); \ No newline at end of file
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index c07391db..85870097 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/