aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel/bread-crumb.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-03-02 12:36:34 -0800
committerPushkar Joshi2012-03-02 12:36:34 -0800
commitdc3c813320c8d3fb837d5d18e70ab35a53b116c1 (patch)
treeda417684de5e302d302ea617854015bd9a8ca17a /js/components/layout/bread-crumb.reel/bread-crumb.js
parentd7d78d4a4e8cf82c56379d25efbe679b3b823abc (diff)
parent4419209a1fd850ab468209b562b66b0242b42a9c (diff)
downloadninja-dc3c813320c8d3fb837d5d18e70ab35a53b116c1.tar.gz
Merge branch 'brushtool' into pentool
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js74
1 files changed, 21 insertions, 53 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 1824c7c3..b2fa42b1 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 @@
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { 10exports.Breadcrumb = Montage.create(Component, {
11 11
12 _container:{ 12 _container:{
13 value:null 13 value:null
@@ -29,23 +29,9 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
29 value: [] 29 value: []
30 }, 30 },
31 31
32 32 prepareForDraw: {
33 deserializedFromTemplate : {
34 value: function() { 33 value: function() {
35 this.eventManager.addEventListener( "appLoaded", this, false); 34 this.breadcrumbBt.addEventListener("action", this, false);
36 this.eventManager.addEventListener( "breadCrumbTrail", this, false);
37 }
38 },
39
40 handleAppLoaded : {
41 value: function() {
42
43 Object.defineBinding(this, "container", {
44 boundObject: this.application.ninja,
45 boundObjectPropertyPath: "currentSelectedContainer",
46 oneway: false
47 });
48
49 } 35 }
50 }, 36 },
51 37
@@ -53,56 +39,38 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
53 value: function() { 39 value: function() {
54 var parentNode; 40 var parentNode;
55 41
56 this.containerElements.length = 0 42 this.containerElements.length = 0;
57 43
58 if(this.container.id === "UserContent") { 44 parentNode = this.container;
59 this.containerElements.push({selected:false, element:this.container});
60 } else {
61 parentNode = this.container;
62 45
63 while(parentNode.id!=="UserContent") { 46 while(parentNode.id !== "UserContent") {
64 this.containerElements.unshift({selected:false,element:parentNode}); 47 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
65 parentNode = parentNode.parentNode; 48 parentNode = parentNode.parentNode;
66 }
67
68 this.containerElements.unshift({selected:false,element:parentNode});
69 } 49 }
70 50
71 NJevent('layerBinding',{selected:false ,element:this.container}) 51 // This is always the top container which is now hardcoded to body
52 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"});
53
54 // This is for the timeline -- Disable it since the timeline should not know about this object
55 // NJevent('layerBinding',{selected:false ,element:this.container})
56
72 } 57 }
73 }, 58 },
74 59
75 handleBreadCrumbTrail: { 60 handleAction: {
76 value: function(event) { 61 value: function(evt) {
77 var newLength,revaluatedLength,tmpvalue;
78 var i=0;
79 62
80 if(event.detail.setFlag ){ 63 if(evt.target.value === this.container.uuid) {
81 this.application.ninja.currentSelectedContainer = event.detail.element;
82 return; 64 return;
83 } 65 }
84 66
85 newLength = this.containerElements.length; 67 for(var i = this.containerElements.length - 1; i >= 0; i--) {
68 if(evt.target.value === this.containerElements[i].nodeUuid) break;
86 69
87 while(i < newLength ){ 70 this.containerElements.pop();
88 if(this.containerElements[i].selected){
89 tmpvalue = i;
90 break;
91 }
92 i++;
93 } 71 }
94 72
95 for(i = newLength -1 ; i >= 1 ; i--) { 73 this.application.ninja.currentSelectedContainer = this.containerElements[i].node;
96 if(tmpvalue !== i) {
97 this.containerElements.pop();
98 } else {
99 break;
100 }
101 }
102
103 revaluatedLength = this.containerElements.length;
104 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element;
105
106 } 74 }
107 } 75 }
108}); 76});