aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-10 22:41:47 -0700
committerValerio Virgillito2012-05-10 22:41:47 -0700
commit063252524696261bc347e2c3fb1ca82db80183e0 (patch)
tree78d22ad99979c5305481fd20a5ba59f327f9f057 /js/controllers
parentcba4e3615f9d922a4bee9a72b48db06694b9bb81 (diff)
parentf6f722feecf88c8afe59327eaf8557ce4012abc7 (diff)
downloadninja-063252524696261bc347e2c3fb1ca82db80183e0.tar.gz
Merge pull request #217 from mencio/dom-architecture
Dom architecture - Fixed the selection and timeline bugs.
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js4
-rwxr-xr-xjs/controllers/elements/shapes-controller.js4
-rwxr-xr-xjs/controllers/selection-controller.js17
3 files changed, 10 insertions, 15 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 84e9f4fc..0fd13be2 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -235,7 +235,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
235 fileSaveResult: { 235 fileSaveResult: {
236 value: function (result) { 236 value: function (result) {
237 if((result.status === 204) || (result.status === 404)){//204=>existing file || 404=>new file... saved 237 if((result.status === 204) || (result.status === 404)){//204=>existing file || 404=>new file... saved
238 this.activeDocument.needsSave = false; 238 this.activeDocument.model.needsSave = false;
239 if(this.application.ninja.currentDocument !== null){ 239 if(this.application.ninja.currentDocument !== null){
240 //clear Dirty StyleSheets for the saved document 240 //clear Dirty StyleSheets for the saved document
241 this.application.ninja.stylesController.clearDirtyStyleSheets(this.application.ninja.currentDocument); 241 this.application.ninja.stylesController.clearDirtyStyleSheets(this.application.ninja.currentDocument);
@@ -647,7 +647,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
647 647
648 handleStyleSheetDirty:{ 648 handleStyleSheetDirty:{
649 value:function(){ 649 value:function(){
650 this.activeDocument.needsSave = true; 650// this.activeDocument.model.needsSave = true;
651 } 651 }
652 }, 652 },
653 653
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e9a5f865..38f133b5 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -213,7 +213,7 @@ exports.ShapesController = Montage.create(CanvasController, {
213 default: 213 default:
214 CanvasController.setProperty(el, p, value); 214 CanvasController.setProperty(el, p, value);
215 } 215 }
216 this.application.ninja.documentController.activeDocument.needsSave = true; 216 this.application.ninja.documentController.activeDocument.model.needsSave = true;
217 } 217 }
218 }, 218 },
219 219
@@ -559,7 +559,7 @@ exports.ShapesController = Montage.create(CanvasController, {
559 } 559 }
560 } 560 }
561 el.elementModel.shapeModel.GLWorld.render(); 561 el.elementModel.shapeModel.GLWorld.render();
562 this.application.ninja.documentController.activeDocument.needsSave = true; 562 this.application.ninja.documentController.activeDocument.model.needsSave = true;
563 } 563 }
564 }, 564 },
565 565
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index a81cdf7f..6e40abb5 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -165,7 +165,7 @@ exports.SelectionController = Montage.create(Component, {
165 165
166 while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { 166 while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) {
167 // If element is higher up than current container then return 167 // If element is higher up than current container then return
168 if(outerElement.id === "UserContent") return; 168 if(outerElement.nodeName === "BODY") return;
169 // else keep going up the chain 169 // else keep going up the chain
170 outerElement = outerElement.parentNode; 170 outerElement = outerElement.parentNode;
171 } 171 }
@@ -246,25 +246,20 @@ exports.SelectionController = Montage.create(Component, {
246 } 246 }
247 }, 247 },
248 248
249 /**
250 * Looks into the selectionObject for the item to be found using it's id
251 *
252 * @return: Item index in the selectionObject if found
253 * -1 if not found
254 */
255 findSelectedElement: { 249 findSelectedElement: {
256 value: function(item) { 250 value: function(item) {
257 // TODO do the loop check in the select element and only use the index here 251 // TODO: Remove this function and use the stage selectable. Then only return a match in the array
258 // return this.application.ninja.selectedElements.indexOf(item); 252 //return this.application.ninja.selectedElements.indexOf(item);
259 253
254 //TODO: Make sure we don't need to loop back to the container element.
260 var itemUUID; 255 var itemUUID;
261 256
262 for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { 257 for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) {
263 // Check for multiple selection and excluding inner elements 258 // Check for multiple selection and excluding inner elements
264 if(item.parentNode && item.parentNode.id !== "UserContent") { 259 if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) {
265 var outerElement = item.parentNode; 260 var outerElement = item.parentNode;
266 261
267 while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { 262 while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) {
268 outerElement = outerElement.parentNode; 263 outerElement = outerElement.parentNode;
269 } 264 }
270 265