aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel/bread-crumb.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /js/components/layout/bread-crumb.reel/bread-crumb.js
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-x[-rw-r--r--]js/components/layout/bread-crumb.reel/bread-crumb.js43
1 files changed, 21 insertions, 22 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 9782d9d1..1824c7c3 100644..100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -7,13 +7,12 @@
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
10exports.Breadcrumb = Montage.create(Component, { 10var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
11 11
12 _container:{ 12 _container:{
13 value:null 13 value:null
14 }, 14 },
15 15
16
17 container: { 16 container: {
18 set: function(value) { 17 set: function(value) {
19 if(this._container !== value) { 18 if(this._container !== value) {
@@ -30,10 +29,10 @@ exports.Breadcrumb = Montage.create(Component, {
30 value: [] 29 value: []
31 }, 30 },
32 31
32
33 deserializedFromTemplate : { 33 deserializedFromTemplate : {
34 value: function() { 34 value: function() {
35 this.eventManager.addEventListener( "appLoaded", this, false); 35 this.eventManager.addEventListener( "appLoaded", this, false);
36 this.eventManager.addEventListener( "openDocument", this, false);
37 this.eventManager.addEventListener( "breadCrumbTrail", this, false); 36 this.eventManager.addEventListener( "breadCrumbTrail", this, false);
38 } 37 }
39 }, 38 },
@@ -46,6 +45,7 @@ exports.Breadcrumb = Montage.create(Component, {
46 boundObjectPropertyPath: "currentSelectedContainer", 45 boundObjectPropertyPath: "currentSelectedContainer",
47 oneway: false 46 oneway: false
48 }); 47 });
48
49 } 49 }
50 }, 50 },
51 51
@@ -53,47 +53,47 @@ exports.Breadcrumb = Montage.create(Component, {
53 value: function() { 53 value: function() {
54 var parentNode; 54 var parentNode;
55 55
56 while(this.containerElements.pop()){ 56 this.containerElements.length = 0
57 // To empty the array to get the new parentNode of the new currentLevel
58 }
59 57
60 if(this.container.id === "UserContent") { 58 if(this.container.id === "UserContent") {
61 this.containerElements.push({selected:false,element:this.container}); 59 this.containerElements.push({selected:false, element:this.container});
62 } else { 60 } else {
63
64 parentNode = this.container; 61 parentNode = this.container;
65 62
66 while(parentNode.id !== "UserContent") { 63 while(parentNode.id!=="UserContent") {
67 this.containerElements.unshift ({selected:false,element:parentNode}); 64 this.containerElements.unshift({selected:false,element:parentNode});
68 parentNode = parentNode.parentNode; 65 parentNode = parentNode.parentNode;
69 } 66 }
70 67
71 this.containerElements.unshift({selected:false,element:parentNode}); 68 this.containerElements.unshift({selected:false,element:parentNode});
72
73 } 69 }
74 70
75 NJevent('layerBinding',this.container); 71 NJevent('layerBinding',{selected:false ,element:this.container})
76 } 72 }
77 }, 73 },
78 74
79
80 handleBreadCrumbTrail: { 75 handleBreadCrumbTrail: {
81 value: function(event) { 76 value: function(event) {
82 var newLength, revaluatedLength, tmpvalue, i=0; 77 var newLength,revaluatedLength,tmpvalue;
78 var i=0;
79
80 if(event.detail.setFlag ){
81 this.application.ninja.currentSelectedContainer = event.detail.element;
82 return;
83 }
83 84
84 newLength = this.containerElements.length; 85 newLength = this.containerElements.length;
85 86
86 while(i < newLength ) { 87 while(i < newLength ){
87 if(this.containerElements[i].selected){ 88 if(this.containerElements[i].selected){
88 tmpvalue = i ; 89 tmpvalue = i;
89 break; 90 break;
90 } 91 }
91
92 i++; 92 i++;
93 } 93 }
94 94
95 for(i = newLength -1 ; i >= 1 ; i--) { 95 for(i = newLength -1 ; i >= 1 ; i--) {
96 if(tmpvalue!==i) { 96 if(tmpvalue !== i) {
97 this.containerElements.pop(); 97 this.containerElements.pop();
98 } else { 98 } else {
99 break; 99 break;
@@ -105,6 +105,5 @@ exports.Breadcrumb = Montage.create(Component, {
105 105
106 } 106 }
107 } 107 }
108
109
110}); 108});
109