diff options
-rwxr-xr-x | js/components/layout/document-entry.reel/document-entry.js | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 37 | ||||
-rwxr-xr-x | js/controllers/selection-controller.js | 4 | ||||
-rwxr-xr-x | js/document/document-html.js | 20 | ||||
-rwxr-xr-x | js/document/html-document.js | 78 | ||||
-rwxr-xr-x | js/document/models/base.js | 2 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 17 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 16 | ||||
-rwxr-xr-x | js/stage/stage-deps.js | 13 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 22 |
10 files changed, 59 insertions, 154 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/controllers/document-controller.js b/js/controllers/document-controller.js index 50874725..fc1f2c0f 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -459,16 +459,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
459 | // There is a document currently opened | 459 | // There is a document currently opened |
460 | currentDocument = this.activeDocument; | 460 | currentDocument = this.activeDocument; |
461 | 461 | ||
462 | //this.application.ninja.stage.stageView.showCodeViewBar(false); | ||
463 | //this.application.ninja.stage.stageView.restoreAllPanels(); | 462 | //this.application.ninja.stage.stageView.restoreAllPanels(); |
464 | |||
465 | //this.activeDocument.saveAppState(); | ||
466 | |||
467 | // TODO: Do we need this? | ||
468 | //this.application.ninja.stage.hideCanvas(true); | ||
469 | //this.application.ninja.stage.stageView.hideRulers(); | ||
470 | |||
471 | //this.activeDocument.restoreAppState(); | ||
472 | } else { | 463 | } else { |
473 | // There is no document opened | 464 | // There is no document opened |
474 | 465 | ||
@@ -480,7 +471,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
480 | this.application.ninja.stage.hideCanvas(false); | 471 | this.application.ninja.stage.hideCanvas(false); |
481 | } | 472 | } |
482 | 473 | ||
483 | |||
484 | // Set the active document | 474 | // Set the active document |
485 | this.activeDocument = doc; | 475 | this.activeDocument = doc; |
486 | 476 | ||
@@ -489,22 +479,27 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
489 | // Flag to stop stylesheet dirty event | 479 | // Flag to stop stylesheet dirty event |
490 | this._hackInitialStyles = false; | 480 | this._hackInitialStyles = false; |
491 | 481 | ||
492 | this.switchDocuments(currentDocument, doc); | 482 | this.switchDocuments(currentDocument, doc, true); |
493 | |||
494 | NJevent("onOpenDocument", doc); | ||
495 | |||
496 | //Setting opacity to be viewable after load | ||
497 | //doc.model.views.design.iframe.style.opacity = 1; | ||
498 | |||
499 | } | 483 | } |
500 | }, | 484 | }, |
501 | 485 | ||
502 | switchDocuments: { | 486 | switchDocuments: { |
503 | value: function(current, newDocument) { | 487 | value: function(currentDocument, newDocument, didCreate) { |
504 | newDocument.model.views.design.iframe.style.opacity = 1; | 488 | |
489 | if(currentDocument) { | ||
490 | currentDocument.serializeDocument(); | ||
505 | 491 | ||
506 | if(current) { | 492 | currentDocument.model.views.design.hide(); |
507 | current.model.views.design.hide(); | 493 | } |
494 | |||
495 | if(didCreate) { | ||
496 | newDocument.model.views.design.iframe.style.opacity = 1; | ||
497 | NJevent("onOpenDocument", newDocument); | ||
498 | } else { | ||
499 | this.activeDocument = newDocument; | ||
500 | newDocument.model.views.design.show(); | ||
501 | newDocument.deserializeDocument(); | ||
502 | NJevent("switchDocument"); | ||
508 | } | 503 | } |
509 | } | 504 | } |
510 | }, | 505 | }, |
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 6e40abb5..1092615a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -81,10 +81,10 @@ exports.SelectionController = Montage.create(Component, { | |||
81 | 81 | ||
82 | handleSwitchDocument: { | 82 | handleSwitchDocument: { |
83 | value: function() { | 83 | value: function() { |
84 | if(this.application.ninja.documentController.activeDocument.currentView === "design"){ | 84 | // if(this.application.ninja.documentController.activeDocument.currentView === "design"){ |
85 | this._isDocument = this.application.ninja.selectedElements.length === 0; | 85 | this._isDocument = this.application.ninja.selectedElements.length === 0; |
86 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); | 86 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); |
87 | } | 87 | // } |
88 | } | 88 | } |
89 | }, | 89 | }, |
90 | 90 | ||
diff --git a/js/document/document-html.js b/js/document/document-html.js index c77ed7bc..0037c94d 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -134,7 +134,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
134 | // | 134 | // |
135 | serializeDocument: { | 135 | serializeDocument: { |
136 | value: function () { | 136 | value: function () { |
137 | // There are not needed for now ssince we cannot change them | 137 | // There are not needed for now since we cannot change them |
138 | //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; | 138 | //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; |
139 | //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; | 139 | //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; |
140 | 140 | ||
@@ -150,13 +150,29 @@ exports.HtmlDocument = Montage.create(Component, { | |||
150 | 150 | ||
151 | // Pause the videos | 151 | // Pause the videos |
152 | this.model.views.design.pauseVideos(); | 152 | this.model.views.design.pauseVideos(); |
153 | |||
154 | this.model.isActive = false; | ||
153 | } | 155 | } |
154 | }, | 156 | }, |
155 | //////////////////////////////////////////////////////////////////// | 157 | //////////////////////////////////////////////////////////////////// |
156 | // | 158 | // |
157 | deserializeDocument: { | 159 | deserializeDocument: { |
158 | value: function () { | 160 | value: function () { |
159 | //TODO: Import functionality | 161 | // There are not needed for now since we cannot change them |
162 | //this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; | ||
163 | //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; | ||
164 | |||
165 | // Deserialize the current scroll position | ||
166 | // TODO: Implement | ||
167 | |||
168 | this.application.ninja.selectedElements = this.model.selection.slice(0); | ||
169 | |||
170 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; | ||
171 | |||
172 | // Serialize the undo | ||
173 | // TODO: Save the montage undo queue | ||
174 | |||
175 | this.model.isActive = true; | ||
160 | } | 176 | } |
161 | } | 177 | } |
162 | //////////////////////////////////////////////////////////////////// | 178 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/document/html-document.js b/js/document/html-document.js index 68c2a9fb..bcf2b5c2 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -454,55 +454,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
454 | } | 454 | } |
455 | }, | 455 | }, |
456 | 456 | ||
457 | /** | ||
458 | * Return the specified inline attribute from the element. | ||
459 | */ | ||
460 | GetElementAttribute: { | ||
461 | value: function(element, attribute) { | ||
462 | |||
463 | var value; | ||
464 | |||
465 | if(attribute === "src") { | ||
466 | return element[attribute].replace(window.location.href, ''); | ||
467 | } | ||
468 | |||
469 | value = element[attribute]; | ||
470 | |||
471 | if(value !== undefined) return value; | ||
472 | // if(value || value === false) return [value, "inline"]; | ||
473 | |||
474 | // 3. | ||
475 | //value = this._document.defaultView.getComputedStyle(element,null).getPropertyValue(attribute); | ||
476 | //if(value) return value; | ||
477 | |||
478 | return null; | ||
479 | } | ||
480 | }, | ||
481 | |||
482 | GetElementStyle: { | ||
483 | value: function(element, style) { | ||
484 | // return this._queryStylesheets(element, style); | ||
485 | } | ||
486 | }, | ||
487 | |||
488 | SetStyle: { | ||
489 | value: function(type, selector, style, value) { | ||
490 | try { | ||
491 | for(var j=0; j<this._stylesheets.length;j++){ | ||
492 | for(var i=0; i<this._stylesheets[j].cssRules.length;i++) { | ||
493 | if(this._stylesheets[j].cssRules[i].selectorText === type + selector) { | ||
494 | this._stylesheets[j].cssRules[i].style[style] = value; | ||
495 | |||
496 | return true; | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | } catch(err) { | ||
501 | console.log("Cannot change the style of selector: " + selector + " " + err); | ||
502 | } | ||
503 | } | ||
504 | }, | ||
505 | |||
506 | GetElementFromPoint: { | 457 | GetElementFromPoint: { |
507 | value: function(x, y) { |