diff options
author | Valerio Virgillito | 2012-02-28 00:47:46 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-28 00:47:46 -0800 |
commit | 19e94dc51a279501352a08d511b18144f83500e5 (patch) | |
tree | 03d94dee053cb61da4568b8ace9c6123dbc35bf7 /js/components/layout/bread-crumb.reel/bread-crumb.js | |
parent | db5db0a92c1fb67eac262c33d4fbf776ceabbb3c (diff) | |
download | ninja-19e94dc51a279501352a08d511b18144f83500e5.tar.gz |
cleanup and fixing selecting each bread crumb
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 59 |
1 files changed, 20 insertions, 39 deletions
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, { | |||
29 | value: [] | 29 | value: [] |
30 | }, | 30 | }, |
31 | 31 | ||
32 | 32 | prepareForDraw: { | |
33 | deserializedFromTemplate : { | ||
34 | value: function() { | 33 | value: function() { |
35 | this.eventManager.addEventListener( "breadCrumbTrail", this, false); | 34 | this.breadcrumbBt.addEventListener("action", this, false); |
36 | } | 35 | } |
37 | }, | 36 | }, |
38 | 37 | ||
@@ -40,56 +39,38 @@ exports.Breadcrumb = Montage.create(Component, { | |||
40 | value: function() { | 39 | value: function() { |
41 | var parentNode; | 40 | var parentNode; |
42 | 41 | ||
43 | this.containerElements.length = 0 | 42 | this.containerElements.length = 0; |
44 | |||
45 | if(this.container.id === "UserContent") { | ||
46 | this.containerElements.push({selected:false, element:this.container}); | ||
47 | } else { | ||
48 | parentNode = this.container; | ||
49 | 43 | ||
50 | while(parentNode.id!=="UserContent") { | 44 | parentNode = this.container; |
51 | this.containerElements.unshift({selected:false,element:parentNode}); | ||
52 | parentNode = parentNode.parentNode; | ||
53 | } | ||
54 | 45 | ||
55 | this.containerElements.unshift({selected:false,element:parentNode}); | 46 | while(parentNode.id !== "UserContent") { |
47 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | ||
48 | parentNode = parentNode.parentNode; | ||
56 | } | 49 | } |
57 | 50 | ||
58 | 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 | |||
59 | } | 57 | } |
60 | }, | 58 | }, |
61 | 59 | ||
62 | handleBreadCrumbTrail: { | 60 | handleAction: { |
63 | value: function(event) { | 61 | value: function(evt) { |
64 | var newLength,revaluatedLength,tmpvalue; | ||
65 | var i=0; | ||
66 | 62 | ||
67 | if(event.detail.setFlag ){ | 63 | if(evt.target.value === this.container.uuid) { |
68 | this.application.ninja.currentSelectedContainer = event.detail.element; | ||
69 | return; | 64 | return; |
70 | } | 65 | } |
71 | 66 | ||
72 | 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; | ||
73 | 69 | ||
74 | while(i < newLength ){ | 70 | this.containerElements.pop(); |
75 | if(this.containerElements[i].selected){ | ||
76 | tmpvalue = i; | ||
77 | break; | ||
78 | } | ||
79 | i++; | ||
80 | } | 71 | } |
81 | 72 | ||
82 | for(i = newLength -1 ; i >= 1 ; i--) { | 73 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; |
83 | if(tmpvalue !== i) { | ||
84 | this.containerElements.pop(); | ||
85 | } else { | ||
86 | break; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | revaluatedLength = this.containerElements.length; | ||
91 | this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; | ||
92 | |||
93 | } | 74 | } |
94 | } | 75 | } |
95 | }); | 76 | }); |