Revert MtFinger renaming
Previous cl rename MtFinger to TouchPoint. It seems to break some scripts. This
patch revert the renaming.
BUG=None
TEST=run webplot
Change-Id: I9e818b576a9ddf620dd5240a3e02aa1e06563f5f
Reviewed-on: https://chromium-review.googlesource.com/550577
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
diff --git a/webplot/webplot.js b/webplot/webplot.js
index 03020a5..ad14e0a 100644
--- a/webplot/webplot.js
+++ b/webplot/webplot.js
@@ -223,19 +223,19 @@
* MtbSnapshot(
* syn_time=1420522152.269537,
* button_pressed=False,
- * points =[
- * TouchPoint(tid=13, slot=0, syn_time=1420522152.269537, x=440, y=277,
- * pressure=33),
- * TouchPoint(tid=14, slot=1, syn_time=1420522152.269537, x=271, y=308,
- * pressure=38)
+ * fingers =[
+ * MtFinger(tid=13, slot=0, syn_time=1420522152.269537, x=440, y=277,
+ * pressure=33),
+ * MtFinger(tid=14, slot=1, syn_time=1420522152.269537, x=271, y=308,
+ * pressure=38)
* ]
* )
*/
Webplot.prototype.processSnapshot = function(snapshot) {
var edge = this.clickEdge;
- for (var i = 0; i < snapshot.points.length; i++) {
- var finger = snapshot.points[i];
+ for (var i = 0; i < snapshot.fingers.length; i++) {
+ var finger = snapshot.fingers[i];
// Update the color object if the finger is leaving.
if (finger.leaving) {
@@ -269,7 +269,7 @@
// In some special situation, the click comes with no fingers.
// This may happen if an insulated object is used to click the touchpad.
// Just draw the click at a random position.
- if (snapshot.points.length == 0 && snapshot.button_pressed == 1 &&
+ if (snapshot.fingers.length == 0 && snapshot.button_pressed == 1 &&
!this.clickDown) {
var x = Math.random() * this.canvas.innerWidth +
this.canvas.innerOffsetLeft;
diff --git a/webplot/webplot.py b/webplot/webplot.py
index f1115b8..c084d9c 100755
--- a/webplot/webplot.py
+++ b/webplot/webplot.py
@@ -439,10 +439,10 @@
MtSnapshot(
syn_time=1420524008.368854,
button_pressed=False,
- points=[
- TouchPoint(tid=162, slot=0, syn_time=1420524008.368854, x=524,
+ fingers=[
+ MtFinger(tid=162, slot=0, syn_time=1420524008.368854, x=524,
y=231, pressure=45, tilt_x=0, tilt_y=0),
- TouchPoint(tid=163, slot=1, syn_time=1420524008.368854, x=677,
+ MtFinger(tid=163, slot=1, syn_time=1420524008.368854, x=677,
y=135, pressure=57, tilt_x=0, tilt_y=0)
]
)
@@ -455,16 +455,16 @@
# Convert MtSnapshot.
converted = dict(snapshot.__dict__.items())
- # Convert TouchPoint.
- converted['points'] = [dict(point.__dict__.items())
- for point in converted['points']]
+ # Convert MtFinger.
+ converted['fingers'] = [dict(finger.__dict__.items())
+ for finger in converted['fingers']]
converted['raw_events'] = [str(event) for event in converted['raw_events']]
# Add leaving fingers to notify js for reclaiming the finger colors.
- curr_tids = [finger['tid'] for finger in converted['points']]
+ curr_tids = [finger['tid'] for finger in converted['fingers']]
for tid in set(self._prev_tids) - set(curr_tids):
leaving_finger = {'tid': tid, 'leaving': True}
- converted['points'].append(leaving_finger)
+ converted['fingers'].append(leaving_finger)
self._prev_tids = curr_tids
# Convert raw events from a list of classes to a list of its strings