diff options
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-x | js/document/html-document.js | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index eaf56146..d38709e3 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; } |
@@ -618,7 +633,47 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
618 | //Error | 633 | //Error |
619 | } | 634 | } |
620 | } | 635 | } |
621 | } | 636 | }, |
622 | //////////////////////////////////////////////////////////////////// | 637 | //////////////////////////////////////////////////////////////////// |
638 | saveAppState:{ | ||
639 | enumerable: false, | ||
640 | value: function () { | ||
641 | |||
642 | this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft; | ||
643 | this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop; | ||
644 | |||
645 | this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; | ||
646 | this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; | ||
647 | |||
648 | //TODO:selection should be saved as an element state data, to avoid duplicate dom elements store in memory | ||
649 | if(typeof this.application.ninja.selectedElements !== 'undefined'){ | ||
650 | this.selectionModel = this.application.ninja.selectedElements; | ||
651 | } | ||
652 | } | ||
653 | }, | ||
654 | |||
655 | //////////////////////////////////////////////////////////////////// | ||
656 | restoreAppState:{ | ||
657 | enumerable: false, | ||
658 | value: function () { | ||
659 | if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ | ||
660 | this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; | ||
661 | this.application.ninja.stage._scrollLeft = this.savedLeftScroll; | ||
662 | this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; | ||
663 | this.application.ninja.stage._scrollTop = this.savedTopScroll; | ||
664 | } | ||
665 | |||
666 | this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; | ||
667 | this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; | ||
668 | |||
669 | //TODO:selectionController.initWithDocument should loop over elements in documentRoot to repopulate | ||
670 | if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null) && (this.selectionModel.length > 0)){ | ||
671 | this.application.ninja.selectionController.initWithDocument(this.selectionModel); | ||
672 | } | ||
673 | |||
674 | |||
675 | } | ||
676 | } | ||
677 | |||
623 | //////////////////////////////////////////////////////////////////// | 678 | //////////////////////////////////////////////////////////////////// |
624 | }); \ No newline at end of file | 679 | }); \ No newline at end of file |