• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5var RowAlignment = {
6  STRETCH: "stretch",
7  LEFT: "left",
8  RIGHT: "right",
9  CENTER: "center",
10}
11
12/**
13 * Ratio of key height and font size.
14 * @type {number}
15 */
16var FONT_SIZE_RATIO = 2.5;
17
18/**
19 * @type {enum}
20 * Possible layout alignments.
21 */
22var LayoutAlignment = {
23  CENTER: "center",
24  STRETCH: "stretch",
25};
26
27/**
28 * The enumerations of key sounds.
29 * @const
30 * @type {enum}
31 */
32var Sound = {
33  NONE: "none",
34  DEFAULT: "keypress-standard",
35};
36
37/**
38 * The enumeration of swipe directions.
39 * @const
40 * @type {Enum}
41 */
42var SwipeDirection = {
43  RIGHT: 0x1,
44  LEFT: 0x2,
45  UP: 0x4,
46  DOWN: 0x8
47};
48
49/**
50 * The ratio between the width and height of the key when in portrait mode.
51 * @type {number}
52 */
53var KEY_ASPECT_RATIO_PORTRAIT = 1;
54
55/**
56 * The ratio between the width and height of the key when in landscape mode.
57 * @type {number}
58 */
59var KEY_ASPECT_RATIO_LANDSCAPE = 1.46;
60
61/**
62 * The ratio between the height and width of the compact keyboard.
63 * @type {number}
64 */
65var DEFAULT_KEYBOARD_ASPECT_RATIO = 0.41;
66
67/**
68 * The default weight of a key.
69 * @type {number}
70 */
71var DEFAULT_KEY_WEIGHT = 100;
72
73/**
74 * The default volume for keyboard sounds.
75 * @type {number}
76 */
77var DEFAULT_VOLUME = 0.2;
78
79/**
80 * The top padding on each key.
81 * @type {number}
82 */
83// TODO(rsadam): Remove this variable once figure out how to calculate this
84// number before the key is rendered.
85var KEY_PADDING_TOP = 1;
86var KEY_PADDING_BOTTOM = 1;
87
88/**
89 * The greatest distance between a key and a touch point for a PointerEvent
90 * to be processed.
91 * @type {number}
92 */
93var MAX_TOUCH_FUZZ_DISTANCE = 20;
94
95/**
96 * The maximum number of extra pixels before a resize is triggered.
97 * @type {number}
98 */
99var RESIZE_THRESHOLD = 20;
100
101/**
102 * The size of the pool to use for playing audio sounds on key press. This is to
103 * enable the same sound to be overlayed, for example, when a repeat key is
104 * pressed.
105 * @type {number}
106 */
107var SOUND_POOL_SIZE = 10;
108
109/**
110 * Whether or not to enable sounds on key press.
111 * @type {boolean}
112 */
113var SOUND_ENABLED = false;
114