aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-05-22 17:59:03 -0700
committerAnanya Sen2012-05-22 17:59:03 -0700
commitae9f289ab9c6fd17ae88fd272dfaa7beabcd649b (patch)
tree9e27878524eb2781a7f3094de0d5ed3f84624980
parentee54342b5f4fdd41c46543d6402e649e4b3d57cb (diff)
parenta341522e3603c18ab3b93defa894e3be702dd0f4 (diff)
downloadninja-ae9f289ab9c6fd17ae88fd272dfaa7beabcd649b.tar.gz
Merge branch 'refs/heads/master-dom-architecture' into dom-architecture
-rwxr-xr-xjs/controllers/document-controller.js2
-rwxr-xr-xjs/document/document-html.js5
-rwxr-xr-xjs/document/models/html.js5
-rwxr-xr-xjs/ninja.reel/ninja.js2
-rwxr-xr-xjs/panels/properties.reel/properties.js32
-rwxr-xr-xjs/panels/properties.reel/sections/custom.reel/custom.js2
-rwxr-xr-xjs/stage/stage.reel/stage.js27
7 files changed, 42 insertions, 33 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 91f4753d..afddaa19 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/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index eb362796..b292a66a 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -48,6 +48,7 @@ exports.Properties = Montage.create(Component, {
48 value : function() { 48 value : function() {
49 this.eventManager.addEventListener("openDocument", this, false); 49 this.eventManager.addEventListener("openDocument", this, false);
50 this.eventManager.addEventListener("selectionChange", this, false); 50 this.eventManager.addEventListener("selectionChange", this, false);
51 this.eventManager.addEventListener("closeDocument", this, false);
51 52
52 // This will be a toggle option 53 // This will be a toggle option
53 if(this.application.ninja.appData.PILiveUpdate) { 54 if(this.application.ninja.appData.PILiveUpdate) {
@@ -76,6 +77,12 @@ exports.Properties = Montage.create(Component, {
76 } 77 }
77 }, 78 },
78 79
80 handleCloseDocument: {
81 value: function(){
82 this.clear();
83 }
84 },
85
79 /** 86 /**
80 * Blur and Key up to handle change in the Element ID field. 87 * Blur and Key up to handle change in the Element ID field.
81 */ 88 */
@@ -172,6 +179,7 @@ exports.Properties = Montage.create(Component, {
172 this.elementId.value = ""; 179 this.elementId.value = "";
173 this.elementClass.value = ""; 180 this.elementClass.value = "";
174 this.customPi = null; 181 this.customPi = null;
182 this.customSections = [];
175 } 183 }
176 }, 184 },
177 185
@@ -211,27 +219,29 @@ exports.Properties = Montage.create(Component, {
211 controls = this.customSections[n].content.controls; 219 controls = this.customSections[n].content.controls;
212 if(controls["colorSelect"]) { 220 if(controls["colorSelect"]) {
213 controls["colorSelect"].destroy(); 221 controls["colorSelect"].destroy();
214 } else if(controls["stageBackground"]) { 222 } else if(controls["background"]) {
215 controls["stageBackground"].destroy(); 223 controls["background"].destroy();
216 } 224 }
217 } 225 }
218 226
219 this.customPi = el.elementModel.pi; 227 this.customPi = el.elementModel.pi;
220 this.displayCustomProperties(el, el.elementModel.pi); 228 this.displayCustomProperties(el, el.elementModel.pi);
221 }
222 229
223 // Root element color chip 230 // Root element color chip
224 if(isRoot) { 231 if(isRoot) {
225 var backgroundChip = this.customSections[0].content.controls["background"]; 232 var backgroundChip = this.customSections[0].content.controls["background"];
226 var rootBackgroundColor = ElementsMediator.getProperty(el, "background"); 233 var rootBackgroundColor = ElementsMediator.getProperty(el, "background");
227 234
228 if(rootBackgroundColor) { 235 if(rootBackgroundColor) {
229 backgroundChip.color = rootBackgroundColor; 236 backgroundChip.color = rootBackgroundColor;
230 } else { 237 } else {
231 backgroundChip.color = null; 238 backgroundChip.color = null;
239 }
232 } 240 }
233 } 241 }
234 242
243
244
235 var previousInput = this.application.ninja.colorController.colorModel.input; 245 var previousInput = this.application.ninja.colorController.colorModel.input;
236 customPI = PiData[this.customPi]; 246 customPI = PiData[this.customPi];
237 // Get all the custom section for the custom PI 247 // Get all the custom section for the custom PI
diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js
index 49b4414e..b1fd910d 100755
--- a/js/panels/properties.reel/sections/custom.reel/custom.js
+++ b/js/panels/properties.reel/sections/custom.reel/custom.js
@@ -400,7 +400,7 @@ exports.CustomSection = Montage.create(Component, {
400 this.controls[aField.id] = obj; 400 this.controls[aField.id] = obj;
401 401
402 // TODO - Hack for now to reference the color select object to unregister color chips 402 // TODO - Hack for now to reference the color select object to unregister color chips
403 this.controls["stageBackground"] = obj; 403 this.controls["background"] = obj;
404 404
405 return obj; 405 return obj;
406 } 406 }
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 /