summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/shared/js/cr/ui/touch_handler.js
diff options
context:
space:
mode:
authorbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 15:50:16 +0000
committerbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 15:50:16 +0000
commitc7ce8ed6da3c72d2f4de3c2d0a6569ac3be5004b (patch)
tree9af36813123be2741e4541b4a58ff8b68ecf3814 /chrome/browser/resources/shared/js/cr/ui/touch_handler.js
parent444449a7be317f2c580c03d47d908d5de94c03e1 (diff)
downloadchromium_src-c7ce8ed6da3c72d2f4de3c2d0a6569ac3be5004b.zip
chromium_src-c7ce8ed6da3c72d2f4de3c2d0a6569ac3be5004b.tar.gz
chromium_src-c7ce8ed6da3c72d2f4de3c2d0a6569ac3be5004b.tar.bz2
Tap to open a file/folder in file manager
BUG=chromium-os:25931 TEST=Build an chromeos image and hook up with a touch screen, verify if tap to open files/folders work. Review URL: http://codereview.chromium.org/9903006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/shared/js/cr/ui/touch_handler.js')
-rw-r--r--chrome/browser/resources/shared/js/cr/ui/touch_handler.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/resources/shared/js/cr/ui/touch_handler.js b/chrome/browser/resources/shared/js/cr/ui/touch_handler.js
index 7744260..85b4fa8 100644
--- a/chrome/browser/resources/shared/js/cr/ui/touch_handler.js
+++ b/chrome/browser/resources/shared/js/cr/ui/touch_handler.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -119,7 +119,11 @@ cr.define('cr.ui', function() {
// Fired whenever a touch that is being tracked has been released.
// Correlates 1:1 with a TOUCH_START.
- TOUCH_END: 'touchHandler:touch_end'
+ TOUCH_END: 'touchHandler:touch_end',
+
+ // Fired whenever the element is tapped in a short time and no dragging is
+ // detected.
+ TAP: 'touchHandler:tap'
};
@@ -479,6 +483,8 @@ cr.define('cr.ui', function() {
if (this.swallowNextClick_)
this.swallowNextClick_ = false;
+ this.disableTap_ = false;
+
// Sign up for end/cancel notifications for this touch.
// Note that we do this on the document so that even if the user drags
// their finger off the element, we'll still know what they're doing.
@@ -591,6 +597,7 @@ cr.define('cr.ui', function() {
this.startTouchX_ = clientX;
this.startTouchY_ = clientY;
this.startTime_ = e.timeStamp;
+ this.disableTap_ = true;
} else {
this.endTracking_();
}
@@ -705,6 +712,8 @@ cr.define('cr.ui', function() {
// drag-and-drop events are nested inside of the mouse events that trigger
// them).
this.dispatchEvent_(TouchHandler.EventType.TOUCH_END, touch);
+ if (!this.disableTap_)
+ this.dispatchEvent_(TouchHandler.EventType.TAP, touch);
},
/**
@@ -766,6 +775,7 @@ cr.define('cr.ui', function() {
// touch start event. This simple click-busting technique should be
// sufficient here since a real click should have a touchstart first.
this.swallowNextClick_ = true;
+ this.disableTap_ = true;
// Dispatch to the LONG_PRESS
this.dispatchEventXY_(TouchHandler.EventType.LONG_PRESS, this.element_,