| 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-keyset" attributes="nextKeyset isDefault" | 7 <polymer-element name="kb-keyset" attributes="nextKeyset isDefault" |
| 8 on-key-up="{{keyUp}}" on-key-longpress="{{keyLongpress}}"> | 8 on-key-up="{{keyUp}}" on-key-longpress="{{keyLongpress}}"> |
| 9 <template> | 9 <template> |
| 10 <style> | 10 <style> |
| 11 :host { | 11 :host { |
| 12 -webkit-box-flex: 1; | 12 -webkit-box-flex: 1; |
| 13 -webkit-box-orient: vertical; | 13 -webkit-box-orient: vertical; |
| 14 display: -webkit-box; | 14 display: -webkit-box; |
| 15 } | 15 } |
| 16 :host:not(.activeKeyset) { |
| 17 display: none; |
| 18 } |
| 16 </style> | 19 </style> |
| 17 <content select="kb-row"></content> | 20 <content select="kb-row"></content> |
| 18 <content select="kb-altkey-container" id="altkeyContainer" | 21 <content select="kb-altkey-container" id="altkeyContainer" |
| 19 touch-action="none"></content> | 22 touch-action="none"></content> |
| 20 <kb-altkey-data id="altkeyMetadata"></kb-altkey-data> | 23 <kb-altkey-data id="altkeyMetadata"></kb-altkey-data> |
| 21 </template> | 24 </template> |
| 22 <script> | 25 <script> |
| 23 Polymer('kb-keyset', { | 26 Polymer('kb-keyset', { |
| 24 isDefault: false, | 27 isDefault: false, |
| 25 nextKeyset: undefined, | 28 nextKeyset: undefined, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 activeAltKeySet.style.width = event.target.clientWidth * | 73 activeAltKeySet.style.width = event.target.clientWidth * |
| 71 activeAltKeySet.childElementCount + 'px'; | 74 activeAltKeySet.childElementCount + 'px'; |
| 72 activeAltKeySet.style.height = event.target.clientHeight + 'px'; | 75 activeAltKeySet.style.height = event.target.clientHeight + 'px'; |
| 73 activeAltKeySet.style.top = event.target.offsetTop + 'px'; | 76 activeAltKeySet.style.top = event.target.offsetTop + 'px'; |
| 74 var leftOffset = activeAltKeySet.offset * event.target.clientWidth; | 77 var leftOffset = activeAltKeySet.offset * event.target.clientWidth; |
| 75 activeAltKeySet.style.left = event.target.offsetLeft - leftOffset + | 78 activeAltKeySet.style.left = event.target.offsetLeft - leftOffset + |
| 76 'px'; | 79 'px'; |
| 77 var nodes = activeAltKeySet.childNodes; | 80 var nodes = activeAltKeySet.childNodes; |
| 78 nodes[activeAltKeySet.offset].classList.add('active'); | 81 nodes[activeAltKeySet.offset].classList.add('active'); |
| 79 altkeyContainer.hidden = false; | 82 altkeyContainer.hidden = false; |
| 83 }, |
| 84 |
| 85 show: function() { |
| 86 var old = $('keyboard').querySelector('.activeKeyset'); |
| 87 if (old && old != this) |
| 88 old.classList.remove('activeKeyset'); |
| 89 this.classList.add('activeKeyset'); |
| 90 this.fire('stateChange', { |
| 91 state: 'keysetChanged', |
| 92 value: this.id |
| 93 }); |
| 94 }, |
| 95 |
| 96 enteredView: function() { |
| 97 if (this.isDefault) { |
| 98 var self = this; |
| 99 Platform.endOfMicrotask(function() { |
| 100 self.show(); |
| 101 }); |
| 102 } |
| 80 } | 103 } |
| 81 }); | 104 }); |
| 82 </script> | 105 </script> |
| 83 </polymer-element> | 106 </polymer-element> |
| OLD | NEW |