@enact/spotlight 4.5.2 → 4.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accelerator/Accelerator.js +11 -31
- package/Accelerator/tests/Accelerrator-specs.js +62 -0
- package/CHANGELOG.md +6 -0
- package/Pause/Pause.js +8 -18
- package/Pause/tests/Pause-specs.js +6 -3
- package/SpotlightContainerDecorator/SpotlightContainer.js +19 -45
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +14 -58
- package/SpotlightContainerDecorator/tests/Element.prototype.closest.js +5 -10
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +17 -47
- package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +16 -53
- package/SpotlightContainerDecorator/useSpotlightContainer.js +4 -15
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +4 -58
- package/SpotlightRootDecorator/tests/SpotlightRootDecorator-specs.js +38 -0
- package/Spottable/Spottable.js +25 -84
- package/Spottable/SpottableCore.js +32 -71
- package/Spottable/tests/Spottable-specs.js +8 -31
- package/Spottable/tests/useSpot-specs.js +27 -105
- package/Spottable/useSpottable.js +7 -21
- package/package.json +8 -2
- package/src/container.js +94 -219
- package/src/navigate.js +5 -74
- package/src/pointer.js +16 -31
- package/src/spotlight.js +42 -171
- package/src/target.js +61 -139
- package/src/tests/container-specs.js +5 -11
- package/src/tests/navigate-specs.js +2 -10
- package/src/tests/pointer-specs.js +1 -3
- package/src/tests/spotlight-specs.js +42 -24
- package/src/tests/target-specs.js +23 -47
- package/src/tests/utils-specs.js +54 -0
- package/src/tests/utils.js +2 -27
- package/src/utils.js +18 -37
package/src/navigate.js
CHANGED
|
@@ -7,17 +7,14 @@ exports["default"] = void 0;
|
|
|
7
7
|
exports.navigate = navigate;
|
|
8
8
|
var obliqueMinDistance = 1;
|
|
9
9
|
var straightMinDistance = 0;
|
|
10
|
-
|
|
11
10
|
var calcGroupId = function calcGroupId(_ref) {
|
|
12
11
|
var x = _ref.x,
|
|
13
|
-
|
|
12
|
+
y = _ref.y;
|
|
14
13
|
return y * 3 + x;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
var calcNextGridPosition = function calcNextGridPosition(current, next) {
|
|
18
16
|
var center = current.center;
|
|
19
17
|
var x, y;
|
|
20
|
-
|
|
21
18
|
if (center.x < next.left) {
|
|
22
19
|
x = 0;
|
|
23
20
|
} else if (center.x <= next.right) {
|
|
@@ -25,7 +22,6 @@ var calcNextGridPosition = function calcNextGridPosition(current, next) {
|
|
|
25
22
|
} else {
|
|
26
23
|
x = 2;
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
if (center.y < next.top) {
|
|
30
26
|
y = 0;
|
|
31
27
|
} else if (center.y <= next.bottom) {
|
|
@@ -33,16 +29,13 @@ var calcNextGridPosition = function calcNextGridPosition(current, next) {
|
|
|
33
29
|
} else {
|
|
34
30
|
y = 2;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
return {
|
|
38
33
|
x: x,
|
|
39
34
|
y: y
|
|
40
35
|
};
|
|
41
36
|
};
|
|
42
|
-
|
|
43
37
|
var calcNextExtendedGridPosition = function calcNextExtendedGridPosition(current, next) {
|
|
44
38
|
var x, y;
|
|
45
|
-
|
|
46
39
|
if (current.right <= next.left) {
|
|
47
40
|
x = 0;
|
|
48
41
|
} else if (current.left < next.right) {
|
|
@@ -50,7 +43,6 @@ var calcNextExtendedGridPosition = function calcNextExtendedGridPosition(current
|
|
|
50
43
|
} else {
|
|
51
44
|
x = 2;
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
if (current.bottom <= next.top) {
|
|
55
47
|
y = 0;
|
|
56
48
|
} else if (current.top < next.bottom) {
|
|
@@ -58,19 +50,15 @@ var calcNextExtendedGridPosition = function calcNextExtendedGridPosition(current
|
|
|
58
50
|
} else {
|
|
59
51
|
y = 2;
|
|
60
52
|
}
|
|
61
|
-
|
|
62
53
|
return {
|
|
63
54
|
x: x,
|
|
64
55
|
y: y
|
|
65
56
|
};
|
|
66
57
|
};
|
|
67
|
-
|
|
68
58
|
function prioritize(priorities, targetEdge) {
|
|
69
59
|
var destGroup = [];
|
|
70
|
-
|
|
71
60
|
for (var index = 0; index < priorities.length; index++) {
|
|
72
61
|
var destPriority = priorities[index];
|
|
73
|
-
|
|
74
62
|
if (destPriority.group.length) {
|
|
75
63
|
(function () {
|
|
76
64
|
var destDistance = destPriority.distance;
|
|
@@ -81,20 +69,16 @@ function prioritize(priorities, targetEdge) {
|
|
|
81
69
|
for (var i = 0; i < destDistance.length; i++) {
|
|
82
70
|
var calcDistance = destDistance[i];
|
|
83
71
|
var delta = calcDistance(a) - calcDistance(b);
|
|
84
|
-
|
|
85
72
|
if (delta) {
|
|
86
73
|
return delta;
|
|
87
74
|
}
|
|
88
75
|
}
|
|
89
|
-
|
|
90
76
|
return 0;
|
|
91
77
|
});
|
|
92
78
|
target = destPriority.group[0];
|
|
93
|
-
|
|
94
79
|
for (var i = 0; i < destDifference.length; i++) {
|
|
95
80
|
distance += destDifference[i](target);
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
destGroup.push({
|
|
99
83
|
distance: Math.pow(destPriority.multiplier * (distance || destPriority.minDistance) / targetEdge, 2) + targetEdge,
|
|
100
84
|
target: target
|
|
@@ -102,44 +86,21 @@ function prioritize(priorities, targetEdge) {
|
|
|
102
86
|
})();
|
|
103
87
|
}
|
|
104
88
|
}
|
|
105
|
-
|
|
106
89
|
if (!destGroup.length) {
|
|
107
90
|
return null;
|
|
108
91
|
}
|
|
109
|
-
|
|
110
92
|
destGroup.sort(function (a, b) {
|
|
111
93
|
return a.distance - b.distance;
|
|
112
94
|
});
|
|
113
95
|
return destGroup;
|
|
114
96
|
}
|
|
115
|
-
|
|
116
97
|
function partition(rects, targetRect, straightOverlapThreshold, getGroupId) {
|
|
117
98
|
// a matrix of elements where the center of the element in relation to targetRect is:
|
|
118
|
-
var groups = [[
|
|
119
|
-
/* [0] => above/left */
|
|
120
|
-
], [
|
|
121
|
-
/* [1] => above/within */
|
|
122
|
-
], [
|
|
123
|
-
/* [2] => above/right */
|
|
124
|
-
], [
|
|
125
|
-
/* [3] => within/left */
|
|
126
|
-
], [
|
|
127
|
-
/* [4] => within */
|
|
128
|
-
], [
|
|
129
|
-
/* [5] => within/right */
|
|
130
|
-
], [
|
|
131
|
-
/* [6] => below/left */
|
|
132
|
-
], [
|
|
133
|
-
/* [7] => below and within */
|
|
134
|
-
], [
|
|
135
|
-
/* [8] => below/right */
|
|
136
|
-
]];
|
|
137
|
-
|
|
99
|
+
var groups = [[/* [0] => above/left */], [/* [1] => above/within */], [/* [2] => above/right */], [/* [3] => within/left */], [/* [4] => within */], [/* [5] => within/right */], [/* [6] => below/left */], [/* [7] => below and within */], [/* [8] => below/right */]];
|
|
138
100
|
for (var i = 0; i < rects.length; i++) {
|
|
139
101
|
var rect = rects[i];
|
|
140
102
|
var groupId = getGroupId(rect, targetRect);
|
|
141
103
|
groups[groupId].push(rect);
|
|
142
|
-
|
|
143
104
|
if ([0, 2, 6, 8].indexOf(groupId) !== -1) {
|
|
144
105
|
if (rect.left <= targetRect.right - targetRect.width * straightOverlapThreshold) {
|
|
145
106
|
if (groupId === 2) {
|
|
@@ -148,7 +109,6 @@ function partition(rects, targetRect, straightOverlapThreshold, getGroupId) {
|
|
|
148
109
|
groups[7].push(rect);
|
|
149
110
|
}
|
|
150
111
|
}
|
|
151
|
-
|
|
152
112
|
if (rect.right >= targetRect.left + targetRect.width * straightOverlapThreshold) {
|
|
153
113
|
if (groupId === 0) {
|
|
154
114
|
groups[1].push(rect);
|
|
@@ -156,7 +116,6 @@ function partition(rects, targetRect, straightOverlapThreshold, getGroupId) {
|
|
|
156
116
|
groups[7].push(rect);
|
|
157
117
|
}
|
|
158
118
|
}
|
|
159
|
-
|
|
160
119
|
if (rect.top <= targetRect.bottom - targetRect.height * straightOverlapThreshold) {
|
|
161
120
|
if (groupId === 6) {
|
|
162
121
|
groups[3].push(rect);
|
|
@@ -164,7 +123,6 @@ function partition(rects, targetRect, straightOverlapThreshold, getGroupId) {
|
|
|
164
123
|
groups[5].push(rect);
|
|
165
124
|
}
|
|
166
125
|
}
|
|
167
|
-
|
|
168
126
|
if (rect.bottom >= targetRect.top + targetRect.height * straightOverlapThreshold) {
|
|
169
127
|
if (groupId === 0) {
|
|
170
128
|
groups[3].push(rect);
|
|
@@ -174,76 +132,62 @@ function partition(rects, targetRect, straightOverlapThreshold, getGroupId) {
|
|
|
174
132
|
}
|
|
175
133
|
}
|
|
176
134
|
}
|
|
177
|
-
|
|
178
135
|
return groups;
|
|
179
136
|
}
|
|
180
|
-
|
|
181
137
|
function generateDistancefunction(targetRect) {
|
|
182
138
|
return {
|
|
183
139
|
nearPlumbLineIsBetter: function nearPlumbLineIsBetter(rect) {
|
|
184
140
|
var d;
|
|
185
|
-
|
|
186
141
|
if (rect.center.x < targetRect.center.x) {
|
|
187
142
|
d = targetRect.center.x - rect.right;
|
|
188
143
|
} else {
|
|
189
144
|
d = rect.left - targetRect.center.x;
|
|
190
145
|
}
|
|
191
|
-
|
|
192
146
|
return d < 0 ? 0 : d;
|
|
193
147
|
},
|
|
194
148
|
nearHorizonIsBetter: function nearHorizonIsBetter(rect) {
|
|
195
149
|
var d;
|
|
196
|
-
|
|
197
150
|
if (rect.center.y < targetRect.center.y) {
|
|
198
151
|
d = targetRect.center.y - rect.bottom;
|
|
199
152
|
} else {
|
|
200
153
|
d = rect.top - targetRect.center.y;
|
|
201
154
|
}
|
|
202
|
-
|
|
203
155
|
return d < 0 ? 0 : d;
|
|
204
156
|
},
|
|
205
157
|
nearTargetBottomIsBetter: function nearTargetBottomIsBetter(rect) {
|
|
206
158
|
var d;
|
|
207
|
-
|
|
208
159
|
if (rect.center.y < targetRect.center.y) {
|
|
209
160
|
d = targetRect.bottom - rect.top;
|
|
210
161
|
} else {
|
|
211
162
|
d = rect.top - targetRect.bottom;
|
|
212
163
|
}
|
|
213
|
-
|
|
214
164
|
return d < 0 ? 0 : d;
|
|
215
165
|
},
|
|
216
166
|
nearTargetLeftIsBetter: function nearTargetLeftIsBetter(rect) {
|
|
217
167
|
var d;
|
|
218
|
-
|
|
219
168
|
if (rect.center.x < targetRect.center.x) {
|
|
220
169
|
d = targetRect.left - rect.right;
|
|
221
170
|
} else {
|
|
222
171
|
d = rect.left - targetRect.left;
|
|
223
172
|
}
|
|
224
|
-
|
|
225
173
|
return d < 0 ? 0 : d;
|
|
226
174
|
},
|
|
227
175
|
nearTargetRightIsBetter: function nearTargetRightIsBetter(rect) {
|
|
228
176
|
var d;
|
|
229
|
-
|
|
230
177
|
if (rect.center.x < targetRect.center.x) {
|
|
231
178
|
d = targetRect.right - rect.left;
|
|
232
179
|
} else {
|
|
233
180
|
d = rect.left - targetRect.right;
|
|
234
181
|
}
|
|
235
|
-
|
|
236
182
|
return d < 0 ? 0 : d;
|
|
237
183
|
},
|
|
238
184
|
nearTargetTopIsBetter: function nearTargetTopIsBetter(rect) {
|
|
239
185
|
var d;
|
|
240
|
-
|
|
241
186
|
if (rect.center.y < targetRect.center.y) {
|
|
242
187
|
d = targetRect.top - rect.bottom;
|
|
243
188
|
} else {
|
|
244
189
|
d = rect.top - targetRect.top;
|
|
245
190
|
}
|
|
246
|
-
|
|
247
191
|
return d < 0 ? 0 : d;
|
|
248
192
|
},
|
|
249
193
|
topIsBetter: function topIsBetter(rect) {
|
|
@@ -260,19 +204,16 @@ function generateDistancefunction(targetRect) {
|
|
|
260
204
|
}
|
|
261
205
|
};
|
|
262
206
|
}
|
|
263
|
-
|
|
264
207
|
function navigate(targetRect, direction, rects, config) {
|
|
265
208
|
var partitionRect = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : targetRect;
|
|
266
|
-
|
|
267
209
|
if (!targetRect || !direction || !rects || !rects.length || !config) {
|
|
268
210
|
return null;
|
|
269
211
|
}
|
|
270
|
-
|
|
271
212
|
var distanceFunction = generateDistancefunction(targetRect);
|
|
272
213
|
var obliqueMultiplier = config.obliqueMultiplier,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
214
|
+
straightMultiplier = config.straightMultiplier,
|
|
215
|
+
straightOnly = config.straightOnly,
|
|
216
|
+
straightOverlapThreshold = config.straightOverlapThreshold;
|
|
276
217
|
var groups = partition(rects, partitionRect, straightOverlapThreshold, function (rect, destRect) {
|
|
277
218
|
return calcGroupId(direction === 'up' || direction === 'down' ? calcNextExtendedGridPosition(rect, destRect) : calcNextGridPosition(rect, destRect));
|
|
278
219
|
});
|
|
@@ -280,7 +221,6 @@ function navigate(targetRect, direction, rects, config) {
|
|
|
280
221
|
return calcGroupId(calcNextGridPosition(rect, destRect));
|
|
281
222
|
});
|
|
282
223
|
var priorities, targetEdge;
|
|
283
|
-
|
|
284
224
|
switch (direction) {
|
|
285
225
|
case 'left':
|
|
286
226
|
targetEdge = direction;
|
|
@@ -310,7 +250,6 @@ function navigate(targetRect, direction, rects, config) {
|
|
|
310
250
|
multiplier: obliqueMultiplier
|
|
311
251
|
}];
|
|
312
252
|
break;
|
|
313
|
-
|
|
314
253
|
case 'right':
|
|
315
254
|
targetEdge = direction;
|
|
316
255
|
priorities = [{
|
|
@@ -339,7 +278,6 @@ function navigate(targetRect, direction, rects, config) {
|
|
|
339
278
|
multiplier: obliqueMultiplier
|
|
340
279
|
}];
|
|
341
280
|
break;
|
|
342
|
-
|
|
343
281
|
case 'up':
|
|
344
282
|
targetEdge = 'top';
|
|
345
283
|
priorities = [{
|
|
@@ -368,7 +306,6 @@ function navigate(targetRect, direction, rects, config) {
|
|
|
368
306
|
multiplier: obliqueMultiplier
|
|
369
307
|
}];
|
|
370
308
|
break;
|
|
371
|
-
|
|
372
309
|
case 'down':
|
|
373
310
|
targetEdge = 'bottom';
|
|
374
311
|
priorities = [{
|
|
@@ -397,23 +334,17 @@ function navigate(targetRect, direction, rects, config) {
|
|
|
397
334
|
multiplier: obliqueMultiplier
|
|
398
335
|
}];
|
|
399
336
|
break;
|
|
400
|
-
|
|
401
337
|
default:
|
|
402
338
|
return null;
|
|
403
339
|
}
|
|
404
|
-
|
|
405
340
|
if (straightOnly) {
|
|
406
341
|
priorities.splice(2, 2);
|
|
407
342
|
}
|
|
408
|
-
|
|
409
343
|
var destGroup = prioritize(priorities, targetRect[targetEdge]);
|
|
410
|
-
|
|
411
344
|
if (!destGroup) {
|
|
412
345
|
return null;
|
|
413
346
|
}
|
|
414
|
-
|
|
415
347
|
return destGroup[0].target.element;
|
|
416
348
|
}
|
|
417
|
-
|
|
418
349
|
var _default = navigate;
|
|
419
350
|
exports["default"] = _default;
|
package/src/pointer.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updatePointerPosition = exports.setPointerMode = exports.notifyPointerMove = exports.notifyKeyDown = exports.hasPointerMoved = exports.getPointerMode = exports.getLastPointerPosition = void 0;
|
|
7
|
-
|
|
8
7
|
var _keymap = require("@enact/core/keymap");
|
|
9
|
-
|
|
10
8
|
var _util = require("@enact/core/util");
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Exports methods and members for working with pointer events in spotlight
|
|
14
11
|
*
|
|
@@ -24,6 +21,7 @@ var _util = require("@enact/core/util");
|
|
|
24
21
|
* @private
|
|
25
22
|
*/
|
|
26
23
|
var _pointerMode = true;
|
|
24
|
+
|
|
27
25
|
/**
|
|
28
26
|
* Sets the current pointer mode
|
|
29
27
|
*
|
|
@@ -31,10 +29,10 @@ var _pointerMode = true;
|
|
|
31
29
|
* @memberof spotlight/pointer
|
|
32
30
|
* @private
|
|
33
31
|
*/
|
|
34
|
-
|
|
35
32
|
var setPointerMode = function setPointerMode(pointerMode) {
|
|
36
33
|
_pointerMode = pointerMode;
|
|
37
34
|
};
|
|
35
|
+
|
|
38
36
|
/**
|
|
39
37
|
* Gets the current pointer mode
|
|
40
38
|
*
|
|
@@ -42,18 +40,16 @@ var setPointerMode = function setPointerMode(pointerMode) {
|
|
|
42
40
|
* @memberof spotlight/pointer
|
|
43
41
|
* @private
|
|
44
42
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
43
|
exports.setPointerMode = setPointerMode;
|
|
48
|
-
|
|
49
44
|
var getPointerMode = function getPointerMode() {
|
|
50
45
|
return _pointerMode;
|
|
51
|
-
};
|
|
52
|
-
|
|
46
|
+
};
|
|
53
47
|
|
|
48
|
+
// Cached pointer position
|
|
54
49
|
exports.getPointerMode = getPointerMode;
|
|
55
50
|
var _pointerX = null;
|
|
56
51
|
var _pointerY = null;
|
|
52
|
+
|
|
57
53
|
/**
|
|
58
54
|
* Returns whether or not the current pointer position matches the provided coordinates
|
|
59
55
|
*
|
|
@@ -64,10 +60,10 @@ var _pointerY = null;
|
|
|
64
60
|
* @memberof spotlight/pointer
|
|
65
61
|
* @private
|
|
66
62
|
*/
|
|
67
|
-
|
|
68
63
|
var hasPointerMoved = function hasPointerMoved(x, y) {
|
|
69
64
|
return x !== _pointerX || y !== _pointerY;
|
|
70
65
|
};
|
|
66
|
+
|
|
71
67
|
/**
|
|
72
68
|
* Updates the cached pointer position, updating the current pointer mode when the position has
|
|
73
69
|
* changed.
|
|
@@ -79,10 +75,7 @@ var hasPointerMoved = function hasPointerMoved(x, y) {
|
|
|
79
75
|
* @memberof spotlight/pointer
|
|
80
76
|
* @private
|
|
81
77
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
78
|
exports.hasPointerMoved = hasPointerMoved;
|
|
85
|
-
|
|
86
79
|
var updatePointerPosition = function updatePointerPosition(x, y) {
|
|
87
80
|
// Chrome emits mousemove on scroll, but client coordinates do not change.
|
|
88
81
|
if (hasPointerMoved(x, y)) {
|
|
@@ -91,9 +84,9 @@ var updatePointerPosition = function updatePointerPosition(x, y) {
|
|
|
91
84
|
_pointerY = y;
|
|
92
85
|
return true;
|
|
93
86
|
}
|
|
94
|
-
|
|
95
87
|
return false;
|
|
96
88
|
};
|
|
89
|
+
|
|
97
90
|
/**
|
|
98
91
|
* Returns the last known position of the pointer
|
|
99
92
|
*
|
|
@@ -101,29 +94,26 @@ var updatePointerPosition = function updatePointerPosition(x, y) {
|
|
|
101
94
|
* @memberof spotlight/pointer
|
|
102
95
|
* @private
|
|
103
96
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
97
|
exports.updatePointerPosition = updatePointerPosition;
|
|
107
|
-
|
|
108
98
|
var getLastPointerPosition = function getLastPointerPosition() {
|
|
109
99
|
return {
|
|
110
100
|
x: _pointerX,
|
|
111
101
|
y: _pointerY
|
|
112
102
|
};
|
|
113
|
-
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// 30ms (_pointerHiddenToKeyTimeout) is semi-arbitrary, to account for the time it takes for the
|
|
114
106
|
// following directional key event to fire, and to prevent momentary spotting of the last
|
|
115
107
|
// focused item - needs to be a value large enough to account for the potentially-trailing
|
|
116
108
|
// event, but not too large that another unrelated event can be fired inside the window
|
|
117
|
-
|
|
118
|
-
|
|
119
109
|
exports.getLastPointerPosition = getLastPointerPosition;
|
|
120
110
|
var hidePointerJob = new _util.Job(function (callback) {
|
|
121
111
|
setPointerMode(false);
|
|
122
|
-
|
|
123
112
|
if (callback) {
|
|
124
113
|
callback();
|
|
125
114
|
}
|
|
126
115
|
}, 30);
|
|
116
|
+
|
|
127
117
|
/**
|
|
128
118
|
* Notifies spotlight of a change in the pointer position
|
|
129
119
|
*
|
|
@@ -135,19 +125,18 @@ var hidePointerJob = new _util.Job(function (callback) {
|
|
|
135
125
|
* @memberof spotlight/pointer
|
|
136
126
|
* @private
|
|
137
127
|
*/
|
|
138
|
-
|
|
139
128
|
var notifyPointerMove = function notifyPointerMove(current, target, x, y) {
|
|
140
129
|
var priorPointerMode = getPointerMode();
|
|
141
|
-
|
|
142
130
|
if (updatePointerPosition(x, y)) {
|
|
143
131
|
// if we're entering pointer mode and the target element isn't within the currently
|
|
144
132
|
// focused element, there may be a new navigable target
|
|
145
133
|
return !priorPointerMode || !current || !current.contains(target);
|
|
146
|
-
}
|
|
147
|
-
|
|
134
|
+
}
|
|
148
135
|
|
|
136
|
+
// the pointer hasn't actually moved (surprise!)
|
|
149
137
|
return false;
|
|
150
138
|
};
|
|
139
|
+
|
|
151
140
|
/**
|
|
152
141
|
* Notifies the pointer module of key events. If the pointer should be hidden, a timer is set and
|
|
153
142
|
* `callback` is invoked after the timer has expired and pointer mode has been disabled. For any
|
|
@@ -160,13 +149,11 @@ var notifyPointerMove = function notifyPointerMove(current, target, x, y) {
|
|
|
160
149
|
* @memberof spotlight/pointer
|
|
161
150
|
* @private
|
|
162
151
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
152
|
exports.notifyPointerMove = notifyPointerMove;
|
|
166
|
-
|
|
167
153
|
var notifyKeyDown = function notifyKeyDown(keyCode, callback) {
|
|
168
|
-
var palmSystem = window.PalmSystem;
|
|
154
|
+
var palmSystem = window.PalmSystem;
|
|
169
155
|
|
|
156
|
+
// for hide/show pointer events, handle them and return true
|
|
170
157
|
if ((0, _keymap.is)('pointerHide', keyCode)) {
|
|
171
158
|
hidePointerJob.start(callback);
|
|
172
159
|
return true;
|
|
@@ -176,8 +163,6 @@ var notifyKeyDown = function notifyKeyDown(keyCode, callback) {
|
|
|
176
163
|
} else if (!(0, _keymap.is)('nonModal', keyCode) && !(0, _keymap.is)('cancel', keyCode) && !((0, _keymap.is)('enter', keyCode) && palmSystem && palmSystem.cursor && palmSystem.cursor.visibility)) {
|
|
177
164
|
setPointerMode(false);
|
|
178
165
|
}
|
|
179
|
-
|
|
180
166
|
return false;
|
|
181
167
|
};
|
|
182
|
-
|
|
183
168
|
exports.notifyKeyDown = notifyKeyDown;
|