diff options
author | Valerio Virgillito | 2012-05-22 15:41:51 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-22 15:41:51 -0700 |
commit | 2b207ef8b2594927f8cd6cd63a8483d205cb86c4 (patch) | |
tree | 8f19bb9b41e6fdc5d3ae9e00db8d0442a872c3df /js | |
parent | 3493df6f1b1eaa20bb4f391e19c19bb7f3c872a0 (diff) | |
download | ninja-2b207ef8b2594927f8cd6cd63a8483d205cb86c4.tar.gz |
fixing the selection in multiple documents and some code cleanup
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 2 | ||||
-rwxr-xr-x | js/document/document-html.js | 5 | ||||
-rwxr-xr-x | js/document/models/html.js | 5 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 2 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 27 |
5 files changed, 20 insertions, 21 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index d99fadbb..7758f346 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -500,7 +500,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
500 | if(currentDocument) { | 500 | if(currentDocument) { |
501 | if(currentDocument.currentView === "design") { | 501 | if(currentDocument.currentView === "design") { |
502 | currentDocument.serializeDocument(); | 502 | currentDocument.serializeDocument(); |
503 | this.application.ninja.selectionController._selectionContainer = null; | 503 | this.application.ninja._currentSelectedContainer = this.application.ninja.selectionController._selectionContainer = null; |
504 | currentDocument.model.views.design.propertiesPanel.clear(); | 504 | currentDocument.model.views.design.propertiesPanel.clear(); |
505 | } | 505 | } |
506 | 506 | ||
diff --git a/js/document/document-html.js b/js/document/document-html.js index d6b4ba95..f92a425c 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -147,9 +147,10 @@ exports.HtmlDocument = Montage.create(Component, { | |||
147 | this.model.userContentTop = this.application.ninja.stage._userContentTop; | 147 | this.model.userContentTop = this.application.ninja.stage._userContentTop; |
148 | 148 | ||
149 | 149 | ||
150 | // Serialize the selection | 150 | // Serialize the selection, the container and grid |
151 | //TODO: Move this property to the design view class | 151 | //TODO: Move this property to the design view class |
152 | this.model.selection = this.application.ninja.selectedElements.slice(0); | 152 | this.model.selection = this.application.ninja.selectedElements.slice(0); |
153 | this.model.selectionContainer = this.application.ninja.currentSelectedContainer; | ||
153 | this.draw3DGrid = this.application.ninja.appModel.show3dGrid; | 154 | this.draw3DGrid = this.application.ninja.appModel.show3dGrid; |
154 | 155 | ||
155 | // Serialize the undo | 156 | // Serialize the undo |
@@ -177,7 +178,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
177 | 178 | ||
178 | //TODO: Move this property to the design view class | 179 | //TODO: Move this property to the design view class |
179 | this.application.ninja.selectedElements = this.model.selection.slice(0); | 180 | this.application.ninja.selectedElements = this.model.selection.slice(0); |
180 | 181 | // this.application.ninja.currentSelectedContainer = this.model.selectionContainer; | |
181 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; | 182 | this.application.ninja.appModel.show3dGrid = this.draw3DGrid; |
182 | 183 | ||
183 | // Serialize the undo | 184 | // Serialize the undo |
diff --git a/js/document/models/html.js b/js/document/models/html.js index a97b4b5a..9cc8ce92 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -22,6 +22,11 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
22 | selection: { | 22 | selection: { |
23 | value: [] | 23 | value: [] |
24 | }, | 24 | }, |
25 | //////////////////////////////////////////////////////////////////// | ||
26 | // | ||
27 | selectionContainer: { | ||
28 | value: [] | ||
29 | }, | ||
25 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
26 | // | 31 | // |
27 | draw3DGrid: { | 32 | draw3DGrid: { |
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 80d1b406..9f1d1b3b 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -296,7 +296,7 @@ exports.Ninja = Montage.create(Component, { | |||
296 | this.currentDocument = this.documentController.activeDocument; | 296 | this.currentDocument = this.documentController.activeDocument; |
297 | 297 | ||
298 | if(this.currentDocument.documentRoot) { | 298 | if(this.currentDocument.documentRoot) { |
299 | this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; | 299 | this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.documentRoot; |
300 | } | 300 | } |
301 | 301 | ||
302 | NJevent("switchDocument"); | 302 | NJevent("switchDocument"); |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index f768f03a..69cfa7ba 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -468,26 +468,19 @@ exports.Stage = Montage.create(Component, { | |||
468 | */ | 468 | */ |
469 | handleScroll: { | 469 | handleScroll: { |
470 | value: function() { | 470 | value: function() { |
471 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK | ||
472 | if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { | ||
473 | this._scrollLeft = this._iframeContainer.scrollLeft; | ||
474 | this._scrollTop = this._iframeContainer.scrollTop; | ||
475 | 471 | ||
476 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | 472 | this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; |
477 | this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | 473 | this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; |
478 | } else { | ||
479 | this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; | ||
480 | this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; | ||
481 | 474 | ||
482 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; | 475 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; |
483 | this.userContentTop = this._documentOffsetTop - this._scrollTop; | 476 | this.userContentTop = this._documentOffsetTop - this._scrollTop; |
477 | |||
478 | // TODO - scroll events are not dependable. We may need to use a timer to simulate | ||
479 | // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values | ||
480 | // on mouse down. | ||
481 | // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; | ||
482 | // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; | ||
484 | 483 | ||
485 | // TODO - scroll events are not dependable. We may need to use a timer to simulate | ||
486 | // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values | ||
487 | // on mouse down. | ||
488 | // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; | ||
489 | // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; | ||
490 | } | ||
491 | 484 | ||
492 | // Need to clear the snap cache and set up the drag plane | 485 | // Need to clear the snap cache and set up the drag plane |
493 | //snapManager.setupDragPlaneFromPlane( workingPlane ); | 486 | //snapManager.setupDragPlaneFromPlane( workingPlane ); |