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
4 -- found in the LICENSE file.
7 <element name=
"kb-key" on-pointerdown=
"down" on-pointerup=
"up" on-pointerout=
"out"
8 attributes=
"accents char invert repeat superscript toKeyset">
16 background-position: center center;
17 background-repeat: no-repeat;
18 background-size: contain;
42 div.superscript[inverted] {
46 <div id=
"key" class=
"key" inverted?={{invert}}
>
49 <div class=
"superscript" inverted?={{invert}}
>{{superscript}}
</div>
53 * The long-press delay in milliseconds before long-press handler is
57 var LONGPRESS_DELAY_MSEC
= 500;
59 Polymer
.register(this, {
63 down: function(event
) {
65 char: this.char || this.textContent
,
66 toKeyset
: this.toKeyset
,
69 this.send('key-down', detail
);
71 this.longPressTimer
= this.asyncMethod(function() {
73 char: this.char || this.textContent
,
76 this.classList
.remove('active');
77 this.send('key-longpress', detail
);
78 }, null, LONGPRESS_DELAY_MSEC
);
81 out: function(event
) {
82 clearTimeout(this.longPressTimer
);
85 clearTimeout(this.longPressTimer
);
87 char: this.char || this.textContent
,
88 toKeyset
: this.toKeyset
90 this.send('key-up', detail
);