summaryrefslogtreecommitdiff
path: root/src/activity_replay.cc
diff options
context:
space:
mode:
authorDennis Kempin <denniskempin@chromium.org>2012-05-02 15:47:37 -0700
committerGerrit <chrome-bot@google.com>2012-05-02 16:21:26 -0700
commita3deb0225fa566ceca98e0c731af76fc32e14057 (patch)
tree4c7777d6442fbc6d7e3d556d5fce6c054a28cd16 /src/activity_replay.cc
parentc3809509d6c7af3f65d4a84c58d13ef094da2b2f (diff)
downloadlibchrome-gestures-a3deb0225fa566ceca98e0c731af76fc32e14057.tar.gz
immediate_interpreter: Added zoom gesture
Allowed the zoom gesture type to be supported all appropriate places: - Gesture definition and result. - Activity Log - Integral Filter - Immediate Filter A zoom gesture is detected when: No other gesture was detected. Both fingers are moving. And the distance between the fingers is increasing or decreasing. As soon as some thresholds for these movements are met the cursor movement will be suppressed until it is decided if we are zooming or moving just one finger. It is a requirement for the zoom gesture detection that no existing unit tests have to be modified, i.e. no existing expected behavior is influenced. The new gesture is tested with a unit test. BUG=chromium-os:855 TEST=unit and regression tests. manual test on alex machine. Change-Id: I55731f99aa4dbdeca0520fe2f44d7cd8cc66a296 Reviewed-on: https://gerrit.chromium.org/gerrit/21406 Commit-Ready: Dennis Kempin <denniskempin@chromium.org> Reviewed-by: Dennis Kempin <denniskempin@chromium.org> Tested-by: Dennis Kempin <denniskempin@chromium.org>
Diffstat (limited to 'src/activity_replay.cc')
-rw-r--r--src/activity_replay.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/activity_replay.cc b/src/activity_replay.cc
index 0e23de7..bad95f9 100644
--- a/src/activity_replay.cc
+++ b/src/activity_replay.cc
@@ -316,6 +316,9 @@ bool ActivityReplay::ParseGesture(DictionaryValue* entry) {
} else if (gesture_type == ActivityLog::kValueGestureTypeScroll) {
if (!ParseGestureScroll(entry, &gs))
return false;
+ } else if (gesture_type == ActivityLog::kValueGestureTypeZoom) {
+ if (!ParseGestureZoom(entry, &gs))
+ return false;
} else if (gesture_type == ActivityLog::kValueGestureTypeButtonsChange) {
if (!ParseGestureButtonsChange(entry, &gs))
return false;
@@ -362,6 +365,18 @@ bool ActivityReplay::ParseGestureScroll(DictionaryValue* entry,
return true;
}
+bool ActivityReplay::ParseGestureZoom(DictionaryValue* entry,
+ Gesture* out_gs) {
+ out_gs->type = kGestureTypeZoom;
+ double dbl;
+ if (!entry->GetDouble(ActivityLog::kKeyGestureZoomDZ, &dbl)) {
+ Err("can't parse zoom dz");
+ return false;
+ }
+ out_gs->details.zoom.dz = dbl;
+ return true;
+}
+
bool ActivityReplay::ParseGestureButtonsChange(DictionaryValue* entry,
Gesture* out_gs) {
out_gs->type = kGestureTypeButtonsChange;