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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
// Copyright (c) 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.
var RowAlignment = {
STRETCH: "stretch",
LEFT: "left",
RIGHT: "right",
CENTER: "center",
}
/**
* Ratio of key height and font size.
* @type {number}
*/
var FONT_SIZE_RATIO = 2.5;
/**
* @type {enum}
* Possible layout alignments.
*/
var LayoutAlignment = {
CENTER: "center",
STRETCH: "stretch",
};
/**
* The enumerations of key sounds.
* @const
* @type {enum}
*/
var Sound = {
NONE: "none",
DEFAULT: "keypress-standard",
};
/**
* The enumeration of swipe directions.
* @const
* @type {Enum}
*/
var SwipeDirection = {
RIGHT: 0x1,
LEFT: 0x2,
UP: 0x4,
DOWN: 0x8
};
/**
* The ratio between the width and height of the key when in portrait mode.
* @type {number}
*/
var KEY_ASPECT_RATIO_PORTRAIT = 1;
/**
* The ratio between the width and height of the key when in landscape mode.
* @type {number}
*/
var KEY_ASPECT_RATIO_LANDSCAPE = 1.46;
/**
* The ratio between the height and width of the compact keyboard.
* @type {number}
*/
var DEFAULT_KEYBOARD_ASPECT_RATIO = 0.41;
/**
* The default weight of a key.
* @type {number}
*/
var DEFAULT_KEY_WEIGHT = 100;
/**
* The default volume for keyboard sounds.
* @type {number}
*/
var DEFAULT_VOLUME = 0.2;
/**
* The top padding on each key.
* @type {number}
*/
// TODO(rsadam): Remove this variable once figure out how to calculate this
// number before the key is rendered.
var KEY_PADDING_TOP = 1;
var KEY_PADDING_BOTTOM = 1;
/**
* The greatest distance between a key and a touch point for a PointerEvent
* to be processed.
* @type {number}
*/
var MAX_TOUCH_FUZZ_DISTANCE = 20;
/**
* The maximum number of extra pixels before a resize is triggered.
* @type {number}
*/
var RESIZE_THRESHOLD = 20;
/**
* The size of the pool to use for playing audio sounds on key press. This is to
* enable the same sound to be overlayed, for example, when a repeat key is
* pressed.
* @type {number}
*/
var SOUND_POOL_SIZE = 10;
/**
* Whether or not to enable sounds on key press.
* @type {boolean}
*/
var SOUND_ENABLED = false;
|