diff options
author | Valerio Virgillito | 2012-05-18 00:21:56 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-18 00:21:56 -0700 |
commit | 7a94696e19b14e15261df516e2ba75e693b1313d (patch) | |
tree | ccb3cdff79be3ae5221779787bfbdcc5ca3d8e77 /js/document | |
parent | f227015e14b505dbd3fc4b030ca17cb6c50c5d88 (diff) | |
download | ninja-7a94696e19b14e15261df516e2ba75e693b1313d.tar.gz |
enabling basic document switching
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/document')
-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 |
3 files changed, 20 insertions, 80 deletions
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) { | 458 | value: function(x, y) { |
508 | return this._window.getElement(x,y); | 459 | return this._window.getElement(x,y); |
@@ -919,32 +870,5 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
919 | //Error | 870 | //Error |
920 | } | 871 | } |
921 | } | 872 | } |
922 | }, | 873 | } |
923 | |||
924 | //////////////////////////////////////////////////////////////////// | ||
925 | restoreAppState:{ | ||
926 | enumerable: false, | ||
927 | value: function () { | ||
928 | this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; | ||
929 | this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; | ||
930 | |||
931 | if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){ | ||
932 | this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; | ||
933 | this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; | ||
934 | this.application.ninja.stage.handleScroll(); | ||
935 | } | ||
936 | |||
937 | this.application.ninja.currentSelectedContainer = this.documentRoot; | ||
938 | if(this.selectionModel){ | ||
939 | this.application.ninja.selectedElements = this.selectionModel.slice(0); | ||
940 | } | ||
941 | |||
942 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; | ||
943 | |||
944 | this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0); | ||
945 | this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0); | ||
946 | |||
947 | |||
948 | } | ||
949 | } | ||
950 | }); \ No newline at end of file | 874 | }); \ No newline at end of file |
diff --git a/js/document/models/base.js b/js/document/models/base.js index 649539ea..df341b2f 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -30,7 +30,7 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
30 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
31 | // | 31 | // |
32 | _isActive: { | 32 | _isActive: { |
33 | value: null | 33 | value: true |
34 | }, | 34 | }, |
35 | //////////////////////////////////////////////////////////////////// | 35 | //////////////////////////////////////////////////////////////////// |
36 | // | 36 | // |