aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-29 11:46:19 -0800
committerAnanya Sen2012-02-29 11:46:19 -0800
commit03ea76700cb8bee3f4f58acf3e3503b0642d13fb (patch)
tree74995df24eb96461c6f7aa3287239ce550bab567
parent7a9c2a91dfbbdd0cd7c79d81be5aeecd7887e7f1 (diff)
downloadninja-03ea76700cb8bee3f4f58acf3e3503b0642d13fb.tar.gz
fixed selection which click after switching to a document
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xjs/controllers/selection-controller.js4
-rwxr-xr-xjs/document/html-document.js11
2 files changed, 10 insertions, 5 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 0f2a16e0..184c4899 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -92,12 +92,14 @@ exports.SelectionController = Montage.create(Component, {
92 handleSwitchDocument: { 92 handleSwitchDocument: {
93 value: function() { 93 value: function() {
94 this._selectedItems = this.application.ninja.selectedElements.slice(0); 94 this._selectedItems = this.application.ninja.selectedElements.slice(0);
95 if(this._selectedItems.length === 0){ 95 if(this._selectedItems.length === 0 ){
96 this._isDocument = true; 96 this._isDocument = true;
97 }else{ 97 }else{
98 this._isDocument = false; 98 this._isDocument = false;
99 } 99 }
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101
102 this._selectionContainer = this.application.ninja.currentSelectedContainer;
101 } 103 }
102 }, 104 },
103 105
diff --git a/js/document/html-document.js b/js/document/html-document.js
index aac03606..9e3f0cdd 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -717,9 +717,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
717 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; 717 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
718 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; 718 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
719 719
720 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ 720
721 this.application.ninja.selectedElements = this.selectionModel.slice(0);
722 }
723 721
724 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ 722 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){
725 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; 723 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
@@ -727,12 +725,17 @@ exports.HTMLDocument = Montage.create(TextDocument, {
727 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; 725 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
728 this.application.ninja.stage._scrollLeft = this.savedTopScroll; 726 this.application.ninja.stage._scrollLeft = this.savedTopScroll;
729 } 727 }
730 this.application.ninja.stage.handleScroll(); 728
729 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){
730 this.application.ninja.selectedElements = this.selectionModel.slice(0);
731 }
731 732
732 this.application.ninja.appModel.show3dGrid = this.draw3DGrid; 733 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
733 734
734 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0); 735 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
735 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0); 736 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
737
738 this.application.ninja.currentSelectedContainer = this.documentRoot;
736 } 739 }
737 } 740 }
738 //////////////////////////////////////////////////////////////////// 741 ////////////////////////////////////////////////////////////////////