From db5db0a92c1fb67eac262c33d4fbf776ceabbb3c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 27 Feb 2012 21:17:29 -0800 Subject: breadcrumb cleanup and moving the resized on top of the timeline panel Signed-off-by: Valerio Virgillito --- js/components/layout/bread-crumb.reel/bread-crumb.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 1824c7c3..d071e48a 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -7,7 +7,7 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; -var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { +exports.Breadcrumb = Montage.create(Component, { _container:{ value:null @@ -32,23 +32,10 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { deserializedFromTemplate : { value: function() { - this.eventManager.addEventListener( "appLoaded", this, false); this.eventManager.addEventListener( "breadCrumbTrail", this, false); } }, - handleAppLoaded : { - value: function() { - - Object.defineBinding(this, "container", { - boundObject: this.application.ninja, - boundObjectPropertyPath: "currentSelectedContainer", - oneway: false - }); - - } - }, - createContainerElements: { value: function() { var parentNode; -- cgit v1.2.3 From 19e94dc51a279501352a08d511b18144f83500e5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 28 Feb 2012 00:47:46 -0800 Subject: cleanup and fixing selecting each bread crumb Signed-off-by: Valerio Virgillito --- .../layout/bread-crumb.reel/bread-crumb.js | 59 ++++++++-------------- 1 file changed, 20 insertions(+), 39 deletions(-) (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index d071e48a..b2fa42b1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -29,10 +29,9 @@ exports.Breadcrumb = Montage.create(Component, { value: [] }, - - deserializedFromTemplate : { + prepareForDraw: { value: function() { - this.eventManager.addEventListener( "breadCrumbTrail", this, false); + this.breadcrumbBt.addEventListener("action", this, false); } }, @@ -40,56 +39,38 @@ exports.Breadcrumb = Montage.create(Component, { value: function() { var parentNode; - this.containerElements.length = 0 - - if(this.container.id === "UserContent") { - this.containerElements.push({selected:false, element:this.container}); - } else { - parentNode = this.container; + this.containerElements.length = 0; - while(parentNode.id!=="UserContent") { - this.containerElements.unshift({selected:false,element:parentNode}); - parentNode = parentNode.parentNode; - } + parentNode = this.container; - this.containerElements.unshift({selected:false,element:parentNode}); + while(parentNode.id !== "UserContent") { + this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); + parentNode = parentNode.parentNode; } - NJevent('layerBinding',{selected:false ,element:this.container}) + // This is always the top container which is now hardcoded to body + this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); + + // This is for the timeline -- Disable it since the timeline should not know about this object + // NJevent('layerBinding',{selected:false ,element:this.container}) + } }, - handleBreadCrumbTrail: { - value: function(event) { - var newLength,revaluatedLength,tmpvalue; - var i=0; + handleAction: { + value: function(evt) { - if(event.detail.setFlag ){ - this.application.ninja.currentSelectedContainer = event.detail.element; + if(evt.target.value === this.container.uuid) { return; } - newLength = this.containerElements.length; + for(var i = this.containerElements.length - 1; i >= 0; i--) { + if(evt.target.value === this.containerElements[i].nodeUuid) break; - while(i < newLength ){ - if(this.containerElements[i].selected){ - tmpvalue = i; - break; - } - i++; + this.containerElements.pop(); } - for(i = newLength -1 ; i >= 1 ; i--) { - if(tmpvalue !== i) { - this.containerElements.pop(); - } else { - break; - } - } - - revaluatedLength = this.containerElements.length; - this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; - + this.application.ninja.currentSelectedContainer = this.containerElements[i].node; } } }); -- cgit v1.2.3