aboutsummaryrefslogtreecommitdiff
path: root/js/components
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 12:18:41 -0700
committerValerio Virgillito2012-07-09 12:18:41 -0700
commitb7eb5e948a911ab78461eb77a7ff1b55da2c3d8d (patch)
treedc45ebb1e9b77acad6c8062d7d0faf5658d5ba08 /js/components
parent961d9f223b279bf0f81468dca6b075e7a4be0e30 (diff)
parentcbb39c7833994c6e1db3f5b445fbedf5c70b95cc (diff)
downloadninja-b7eb5e948a911ab78461eb77a7ff1b55da2c3d8d.tar.gz
Merge pull request #371 from ananyasen/menu-bug-fix
fixed IKNINJA-1877 : Clicking on a menu item should commit on mouse up a...
Diffstat (limited to 'js/components')
-rwxr-xr-xjs/components/menu/menu-entry.reel/menu-entry.js13
-rwxr-xr-xjs/components/menu/menu-item.reel/menu-item.css2
-rwxr-xr-xjs/components/menu/menu-item.reel/menu-item.js30
3 files changed, 34 insertions, 11 deletions
diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js
index 17f847d4..6c49af8f 100755
--- a/js/components/menu/menu-entry.reel/menu-entry.js
+++ b/js/components/menu/menu-entry.reel/menu-entry.js
@@ -102,10 +102,21 @@ exports.MenuEntry = Montage.create(Component, {
102 } 102 }
103 }, 103 },
104 104
105 toggleOnMenuItemAction: {
106 value: function() {
107 // TODO: Hack! Rework this!
108 //for non menu headers only
109 this.parentComponent.ownerComponent.toggleActivation(this);
110 }
111 },
112
105 captureMousedown: { 113 captureMousedown: {
106 value: function(event) { 114 value: function(event) {
107 // TODO: Hack! Rework this! 115 // TODO: Hack! Rework this!
108 this.parentComponent.ownerComponent.toggleActivation(this); 116 //for menu headers only
117 if(event.target.getAttribute("data-montage-id") === "topHeaderText"){
118 this.parentComponent.ownerComponent.toggleActivation(this);
119 }
109 } 120 }
110 }, 121 },
111 122
diff --git a/js/components/menu/menu-item.reel/menu-item.css b/js/components/menu/menu-item.reel/menu-item.css
index 298d706d..59f04675 100755
--- a/js/components/menu/menu-item.reel/menu-item.css
+++ b/js/components/menu/menu-item.reel/menu-item.css
@@ -33,10 +33,12 @@ POSSIBILITY OF SUCH DAMAGE.
33 font-size: 10pt; 33 font-size: 10pt;
34 padding: 3px 12px 3px 8px; 34 padding: 3px 12px 3px 8px;
35 text-shadow : 1px 1px 1px #000000; 35 text-shadow : 1px 1px 1px #000000;
36 cursor:pointer;
36} 37}
37 38
38.menuItem:hover { 39.menuItem:hover {
39 background-color: #7f7f7f; 40 background-color: #7f7f7f;
41 cursor:pointer;
40} 42}
41 43
42.menubg .subEntries { 44.menubg .subEntries {
diff --git a/js/components/menu/menu-item.reel/menu-item.js b/js/components/menu/menu-item.reel/menu-item.js
index 320611c5..fbac149c 100755
--- a/js/components/menu/menu-item.reel/menu-item.js
+++ b/js/components/menu/menu-item.reel/menu-item.js
@@ -120,18 +120,15 @@ exports.MenuItem = Montage.create(Component, {
120 120
121 if(this.data.submenu) { 121 if(this.data.submenu) {
122 this.submenu = true; 122 this.submenu = true;
123
124 this.subentries = this.data.entries; 123 this.subentries = this.data.entries;
125
126 this.subMenu.classList.add("subMenu"); 124 this.subMenu.classList.add("subMenu");
127 this.element.addEventListener("mouseover", this, false);
128 this.element.addEventListener("mouseout", this, false);
129
130 } 125 }
131 126
127 this.element.addEventListener("mouseover", this, false);
128 this.element.addEventListener("mouseout", this, false);
132 129
133 this.itemText.innerHTML = this.data.displayText; 130 this.itemText.innerHTML = this.data.displayText;
134 this.element.addEventListener("mousedown", this, true); 131 this.element.addEventListener("mouseup", this, true);
135 } 132 }
136 }, 133 },
137 134
@@ -156,10 +153,13 @@ exports.MenuItem = Montage.create(Component, {
156 } 153 }
157 }, 154 },
158 155
159 captureMousedown: { 156 captureMouseup: {
160 value: function(event) { 157 value: function(event) {
161 158
162 if(this.data.radio && this.checked) return; 159 if(this.data.radio && this.checked){
160 this.parentComponent.ownerComponent.toggleOnMenuItemAction();
161 return;
162 }
163 163
164 if( ( this.enabled === true || this.enabled > 0 ) && (this.submenu === false) ) { 164 if( ( this.enabled === true || this.enabled > 0 ) && (this.submenu === false) ) {
165 if(this.data.action) { 165 if(this.data.action) {
@@ -167,6 +167,7 @@ exports.MenuItem = Montage.create(Component, {
167 } else if(this.checked !== null) { 167 } else if(this.checked !== null) {
168 this.checked = !this.checked; 168 this.checked = !this.checked;
169 } 169 }
170 this.parentComponent.ownerComponent.toggleOnMenuItemAction();
170 } 171 }
171 172
172 } 173 }
@@ -174,13 +175,22 @@ exports.MenuItem = Montage.create(Component, {
174 175
175 handleMouseover: { 176 handleMouseover: {
176 value: function() { 177 value: function() {
177 if(this.enabled) this.subMenu.style.display = "block"; 178 if(this.enabled){
179 this.element.style.backgroundColor = "#7f7f7f";
180 this.element.style.cursor = "pointer";
181 if(this.data.submenu) {
182 this.subMenu.style.display = "block";
183 }
184 }
178 } 185 }
179 }, 186 },
180 187
181 handleMouseout: { 188 handleMouseout: {
182 value: function() { 189 value: function() {
183 this.subMenu.style.display = "none"; 190 this.element.style.backgroundColor = "#474747";
191 if(this.data.submenu) {
192 this.subMenu.style.display = "none";
193 }
184 } 194 }
185 } 195 }
186 196