diff options
author | Ananya Sen | 2012-07-03 13:02:06 -0700 |
---|---|---|
committer | Ananya Sen | 2012-07-03 13:02:06 -0700 |
commit | cbb39c7833994c6e1db3f5b445fbedf5c70b95cc (patch) | |
tree | bd74365dfd503bf245c1cffa779ef042ac336d31 /js/components/menu | |
parent | fcae5717dab144c4d961b94510aed11d01568345 (diff) | |
download | ninja-cbb39c7833994c6e1db3f5b445fbedf5c70b95cc.tar.gz |
fixed IKNINJA-1877 : Clicking on a menu item should commit on mouse up and not on mouse down.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components/menu')
-rwxr-xr-x | js/components/menu/menu-entry.reel/menu-entry.js | 13 | ||||
-rwxr-xr-x | js/components/menu/menu-item.reel/menu-item.css | 2 | ||||
-rwxr-xr-x | js/components/menu/menu-item.reel/menu-item.js | 30 |
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 0f5503f6..93628dec 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js | |||
@@ -78,10 +78,21 @@ exports.MenuEntry = Montage.create(Component, { | |||
78 | } | 78 | } |
79 | }, | 79 | }, |
80 | 80 | ||
81 | toggleOnMenuItemAction: { | ||
82 | value: function() { | ||
83 | // TODO: Hack! Rework this! | ||
84 | //for non menu headers only | ||
85 | this.parentComponent.ownerComponent.toggleActivation(this); | ||
86 | } | ||
87 | }, | ||
88 | |||
81 | captureMousedown: { | 89 | captureMousedown: { |
82 | value: function(event) { | 90 | value: function(event) { |
83 | // TODO: Hack! Rework this! | 91 | // TODO: Hack! Rework this! |
84 | this.parentComponent.ownerComponent.toggleActivation(this); | 92 | //for menu headers only |
93 | if(event.target.getAttribute("data-montage-id") === "topHeaderText"){ | ||
94 | this.parentComponent.ownerComponent.toggleActivation(this); | ||
95 | } | ||
85 | } | 96 | } |
86 | }, | 97 | }, |
87 | 98 | ||
diff --git a/js/components/menu/menu-item.reel/menu-item.css b/js/components/menu/menu-item.reel/menu-item.css index e5ceda5c..0b8092c1 100755 --- a/js/components/menu/menu-item.reel/menu-item.css +++ b/js/components/menu/menu-item.reel/menu-item.css | |||
@@ -9,10 +9,12 @@ | |||
9 | font-size: 10pt; | 9 | font-size: 10pt; |
10 | padding: 3px 12px 3px 8px; | 10 | padding: 3px 12px 3px 8px; |
11 | text-shadow : 1px 1px 1px #000000; | 11 | text-shadow : 1px 1px 1px #000000; |
12 | cursor:pointer; | ||
12 | } | 13 | } |
13 | 14 | ||
14 | .menuItem:hover { | 15 | .menuItem:hover { |
15 | background-color: #7f7f7f; | 16 | background-color: #7f7f7f; |
17 | cursor:pointer; | ||
16 | } | 18 | } |
17 | 19 | ||
18 | .menubg .subEntries { | 20 | .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 3a5bf4ab..cad833a0 100755 --- a/js/components/menu/menu-item.reel/menu-item.js +++ b/js/components/menu/menu-item.reel/menu-item.js | |||
@@ -96,18 +96,15 @@ exports.MenuItem = Montage.create(Component, { | |||
96 | 96 | ||
97 | if(this.data.submenu) { | 97 | if(this.data.submenu) { |
98 | this.submenu = true; | 98 | this.submenu = true; |
99 | |||
100 | this.subentries = this.data.entries; | 99 | this.subentries = this.data.entries; |
101 | |||
102 | this.subMenu.classList.add("subMenu"); | 100 | this.subMenu.classList.add("subMenu"); |
103 | this.element.addEventListener("mouseover", this, false); | ||
104 | this.element.addEventListener("mouseout", this, false); | ||
105 | |||
106 | } | 101 | } |
107 | 102 | ||
103 | this.element.addEventListener("mouseover", this, false); | ||
104 | this.element.addEventListener("mouseout", this, false); | ||
108 | 105 | ||
109 | this.itemText.innerHTML = this.data.displayText; | 106 | this.itemText.innerHTML = this.data.displayText; |
110 | this.element.addEventListener("mousedown", this, true); | 107 | this.element.addEventListener("mouseup", this, true); |
111 | } | 108 | } |
112 | }, | 109 | }, |
113 | 110 | ||
@@ -132,10 +129,13 @@ exports.MenuItem = Montage.create(Component, { | |||
132 | } | 129 | } |
133 | }, | 130 | }, |
134 | 131 | ||
135 | captureMousedown: { | 132 | captureMouseup: { |
136 | value: function(event) { | 133 | value: function(event) { |
137 | 134 | ||
138 | if(this.data.radio && this.checked) return; | 135 | if(this.data.radio && this.checked){ |
136 | this.parentComponent.ownerComponent.toggleOnMenuItemAction(); | ||
137 | return; | ||
138 | } | ||
139 | 139 | ||
140 | if( ( this.enabled === true || this.enabled > 0 ) && (this.submenu === false) ) { | 140 | if( ( this.enabled === true || this.enabled > 0 ) && (this.submenu === false) ) { |
141 | if(this.data.action) { | 141 | if(this.data.action) { |
@@ -143,6 +143,7 @@ exports.MenuItem = Montage.create(Component, { | |||
143 | } else if(this.checked !== null) { | 143 | } else if(this.checked !== null) { |
144 | this.checked = !this.checked; | 144 | this.checked = !this.checked; |
145 | } | 145 | } |
146 | this.parentComponent.ownerComponent.toggleOnMenuItemAction(); | ||
146 | } | 147 | } |
147 | 148 | ||
148 | } | 149 | } |
@@ -150,13 +151,22 @@ exports.MenuItem = Montage.create(Component, { | |||
150 | 151 | ||
151 | handleMouseover: { | 152 | handleMouseover: { |
152 | value: function() { | 153 | value: function() { |
153 | if(this.enabled) this.subMenu.style.display = "block"; | 154 | if(this.enabled){ |
155 | this.element.style.backgroundColor = "#7f7f7f"; | ||
156 | this.element.style.cursor = "pointer"; | ||
157 | if(this.data.submenu) { | ||
158 | this.subMenu.style.display = "block"; | ||
159 | } | ||
160 | } | ||
154 | } | 161 | } |
155 | }, | 162 | }, |
156 | 163 | ||
157 | handleMouseout: { | 164 | handleMouseout: { |
158 | value: function() { | 165 | value: function() { |
159 | this.subMenu.style.display = "none"; | 166 | this.element.style.backgroundColor = "#474747"; |
167 | if(this.data.submenu) { | ||
168 | this.subMenu.style.display = "none"; | ||
169 | } | ||
160 | } | 170 | } |
161 | } | 171 | } |
162 | 172 | ||