blob: ffa2e0b331d8ee6b2bf8cbc30044eb7b5aa80e24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<!--
-- Copyright 2013 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-->
<polymer-element name="kb-key" extends="kb-key-base"
attributes="keyCode shiftModifier weight">
<template>
<style>
@host {
* {
-webkit-box-flex: {{weight}};
}
}
</style>
<div id="key" pseudo="x-key" inverted?={{invert}}>
<content></content>
</div>
<div pseudo="x-superscript" inverted?={{invert}}>{{superscript}}</div>
</template>
<script>
Polymer('kb-key', {
/**
* Key codes have been deprecated in DOM3 key events, but are required
* for legacy web content. The key codes depend on the position of the
* key on the keyboard and is independent of which modifier keys (shift,
* alt, ...) are active.
* @type {number|undefined}
*/
keyCode: undefined,
/**
* Whether the shift key is pressed when producing the key value.
* @type {boolean}
*/
shiftModifier: false,
/**
* Weighting to use for layout in order to properly size the key.
* Keys with a high weighting are wider than normal keys.
* @type {number}
*/
weight: 1
});
</script>
</polymer-element>
<!-- Special keys -->
<polymer-element name="kb-shift-key" attributes="unlockedCase lockedCase"
class="shift dark" char="Shift" extends="kb-key">
<script>
Polymer('kb-shift-key', {
/**
* Defines how capslock effects keyset transition. We always transition
* from the unlockedCase to the lockedCase if capslock is on.
* @type {string}
*/
unlockedCase: 'lower',
lockedCase: 'upper',
down: function(event) {
this.super();
var detail = {};
if (this.keysetRules && this.keysetRules.dbl != undefined) {
detail.char = this.char || this.textContent;
detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET];
detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET];
}
this.fire('enable-dbl', detail);
this.fire('enable-sel');
},
});
</script>
</polymer-element>
<!--
-- TODO(kevers): Display popup menu for selecting layout on keypress. Display
-- code for keyboard layout in place of image.
-->
<polymer-element name="kb-layout-selector" class="layout-selector dark" char="Invalid"
extends="kb-key">
<script>
Polymer('kb-layout-selector', {
toLayout: 'qwerty'
});
</script>
</polymer-element>
|