Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: ui/touch_selection/touch_handle.h

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/touch_selection/touch_handle.h
diff --git a/ui/touch_selection/touch_handle.h b/ui/touch_selection/touch_handle.h
index 12c66d09983626db3c3f9b4a356aa80a2a9d9178..a668235cb963d91d06e43eea36c4e73cdf0d0cb1 100644
--- a/ui/touch_selection/touch_handle.h
+++ b/ui/touch_selection/touch_handle.h
@@ -24,7 +24,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandleDrawable {
public:
virtual ~TouchHandleDrawable() {}
virtual void SetEnabled(bool enabled) = 0;
- virtual void SetOrientation(TouchHandleOrientation orientation) = 0;
+ virtual void SetOrientation(TouchHandleOrientation orientation,
+ bool mirror_vertical,
+ bool mirror_horizontal) = 0;
virtual void SetAlpha(float alpha) = 0;
virtual void SetFocus(const gfx::PointF& position) = 0;
virtual gfx::RectF GetVisibleBounds() const = 0;
@@ -74,7 +76,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
// Update the handle visuals to |orientation|.
// Note: If the handle is being dragged, the orientation change will be
// deferred until the drag has ceased.
- void SetOrientation(TouchHandleOrientation orientation);
+ void SetOrientation(TouchHandleOrientation orientation,
+ const gfx::RectF viewport_rect,
+ const gfx::PointF handle_bottom);
// Allows touch-dragging of the handle. Returns true if the event was
// consumed, in which case the caller should cease further handling.
@@ -84,7 +88,12 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
// Returns true if an animation is active and requires further ticking.
bool Animate(base::TimeTicks frame_time);
+ // Returns the visible bounds of the handle
+ gfx::RectF GetHandleBounds();
jdduke (slow) 2015/04/23 15:22:39 Hmm, where is this method used? Can we remove it?
AviD 2015/04/24 16:19:07 Done.
+
bool is_dragging() const { return is_dragging_; }
+ bool is_inverted() const { return mirror_vertical_; }
jdduke (slow) 2015/04/23 15:22:39 These getter names should reflect the member varia
AviD 2015/04/24 16:19:07 Removed.
+ bool is_flipped() const { return mirror_horizontal_; }
const gfx::PointF& position() const { return position_; }
TouchHandleOrientation orientation() const { return orientation_; }
@@ -94,6 +103,8 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
void BeginFade();
void EndFade();
void SetAlpha(float alpha);
+ bool SetInvertHandleParameters(const gfx::RectF viewport_rect,
+ const gfx::PointF handle_bottom);
scoped_ptr<TouchHandleDrawable> drawable_;
@@ -102,6 +113,8 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
gfx::PointF position_;
TouchHandleOrientation orientation_;
TouchHandleOrientation deferred_orientation_;
+ gfx::RectF deferred_viewport_rect_;
+ gfx::PointF deferred_handle_bottom_;
gfx::PointF touch_down_position_;
gfx::Vector2dF touch_to_focus_offset_;
@@ -120,6 +133,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
bool is_dragging_;
bool is_drag_within_tap_region_;
+ // Mirror variables determine if the handles should be inverted or not.
+ bool mirror_vertical_;
+ bool mirror_horizontal_;
+
DISALLOW_COPY_AND_ASSIGN(TouchHandle);
};

Powered by Google App Engine
This is Rietveld 408576698