OLD | NEW |
1 <!-- | 1 <!-- |
2 -- Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 -- Copyright (c) 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 <element name="kb-key" attributes="toKeyset char repeat" on-pointerdown="down" | 7 <element name="kb-key" attributes="toKeyset char repeat" on-pointerdown="down" |
8 on-pointerup="up"> | 8 on-pointerup="up"> |
9 <template> | 9 <template> |
10 <style> | 10 <style> |
11 @host { | 11 @host { |
12 * { | 12 * { |
13 -webkit-box-flex: 1; | 13 -webkit-box-flex: 1; |
14 display: -webkit-box; | 14 display: -webkit-box; |
15 position: relative; | 15 position: relative; |
16 background-position: center center; | 16 background-position: center center; |
17 background-repeat: no-repeat; | 17 background-repeat: no-repeat; |
18 background-size: contain; | 18 background-size: contain; |
19 } | 19 } |
20 } | 20 } |
21 .key { | 21 .key { |
22 bottom: 0; | 22 bottom: 0; |
23 left: 0; | 23 left: 0; |
24 height: 1.2em; | 24 height: 1.2em; |
25 margin: auto; | 25 margin: auto; |
26 position: absolute; | 26 position: absolute; |
27 right: 0; | 27 right: 0; |
28 top: 0; | 28 top: 0; |
29 padding-left: 14px; | 29 padding-left: 10px; |
30 padding-right: 14px; | 30 padding-right: 10px; |
31 } | 31 } |
32 </style> | 32 </style> |
33 <div id="key" class="key"> | 33 <div id="key" class="key"> |
34 <content></content> | 34 <content></content> |
35 </div> | 35 </div> |
36 </template> | 36 </template> |
37 <script> | 37 <script> |
38 Polymer.register(this, { | 38 Polymer.register(this, { |
39 repeat: false, | 39 repeat: false, |
40 down: function(event) { | 40 down: function(event) { |
41 var detail = { | 41 var detail = { |
42 char: this.char || this.textContent, | 42 char: this.char || this.textContent, |
43 toKeyset: this.toKeyset, | 43 toKeyset: this.toKeyset, |
44 repeat: this.repeat | 44 repeat: this.repeat |
45 }; | 45 }; |
46 this.send('key-down', detail); | 46 this.send('key-down', detail); |
47 }, | 47 }, |
48 up: function(event) { | 48 up: function(event) { |
49 var detail = { | 49 var detail = { |
50 char: this.char || this.textContent, | 50 char: this.char || this.textContent, |
51 toKeyset: this.toKeyset | 51 toKeyset: this.toKeyset |
52 }; | 52 }; |
53 this.send('key-up', detail); | 53 this.send('key-up', detail); |
54 } | 54 } |
55 }); | 55 }); |
56 </script> | 56 </script> |
57 </element> | 57 </element> |
OLD | NEW |