OLD | NEW |
1 <!-- | 1 <!-- |
2 -- Copyright 2013 The Chromium Authors. All rights reserved. | 2 -- Copyright 2013 The Chromium Authors. All rights reserved. |
3 -- Use of this source code is governed by a BSD-style license that can be | 3 -- Use of this source code is governed by a BSD-style license that can be |
4 -- found in the LICENSE file. | 4 -- found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <polymer-element name="kb-key-base" | 7 <polymer-element name="kb-key-base" |
8 on-pointerdown="down" on-pointerup="up" on-pointerout="out" | 8 on-pointerdown="down" on-pointerup="up" on-pointerout="out" |
9 attributes="accents char invert repeat hintText toKeyset toLayout"> | 9 attributes="accents char invert repeat hintText toKeyset toLayout"> |
10 <script> | 10 <script> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 this.fire('key-up', detail); | 131 this.fire('key-up', detail); |
132 }, | 132 }, |
133 | 133 |
134 /** | 134 /** |
135 * Character value associated with the key. Typically, the value is a | 135 * Character value associated with the key. Typically, the value is a |
136 * single character, but may be multi-character in cases like a ".com" | 136 * single character, but may be multi-character in cases like a ".com" |
137 * button. | 137 * button. |
138 * @return {string} | 138 * @return {string} |
139 */ | 139 */ |
140 get charValue() { | 140 get charValue() { |
141 return this.invert? this.hintText : (this.char || this.textContent); | 141 return this.invert ? this.hintText : (this.char || this.textContent); |
142 }, | 142 }, |
143 | 143 |
144 /* Hint text value associated with the key. Typically, the value is a | 144 /* Hint text value associated with the key. Typically, the value is a |
145 * single character. | 145 * single character. |
146 * @return {string} | 146 * @return {string} |
147 */ | 147 */ |
148 get hintTextValue() { | 148 get hintTextValue() { |
149 return this.invert? (this.char || this.textContent) : this.hintText; | 149 return this.invert ? (this.char || this.textContent) : this.hintText; |
150 }, | 150 }, |
151 | 151 |
152 populateDetails: function() { | 152 populateDetails: function() { |
153 return { | 153 return { |
154 char: this.charValue, | 154 char: this.charValue, |
155 toLayout: this.toLayout, | 155 toLayout: this.toLayout, |
156 repeat: this.repeat | 156 repeat: this.repeat |
157 }; | 157 }; |
158 }, | 158 }, |
159 | 159 |
160 generateLongPressTimer: function() { | 160 generateLongPressTimer: function() { |
161 return this.asyncMethod(function() { | 161 return this.asyncMethod(function() { |
162 var detail = { | 162 var detail = { |
163 char: this.charValue, | 163 char: this.charValue, |
164 hintText: this.hintTextValue | 164 hintText: this.hintTextValue |
165 }; | 165 }; |
166 if (this.keysetRules && this.keysetRules.long != undefined) { | 166 if (this.keysetRules && this.keysetRules.long != undefined) { |
167 detail.toKeyset = this.keysetRules.long[TO_KEYSET - OFFSET]; | 167 detail.toKeyset = this.keysetRules.long[TO_KEYSET - OFFSET]; |
168 detail.nextKeyset = this.keysetRules.long[NEXT_KEYSET - OFFSET]; | 168 detail.nextKeyset = this.keysetRules.long[NEXT_KEYSET - OFFSET]; |
169 } | 169 } |
170 this.fire('key-longpress', detail); | 170 this.fire('key-longpress', detail); |
171 }, null, LONGPRESS_DELAY_MSEC); | 171 }, null, LONGPRESS_DELAY_MSEC); |
172 }, | 172 }, |
173 }); | 173 }); |
174 </script> | 174 </script> |
175 </polymer-element> | 175 </polymer-element> |
OLD | NEW |