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

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: cleanup 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..6bcf4e8834fa896716049f5d0f937dae95c99fd8 100644
--- a/ui/touch_selection/touch_handle.h
+++ b/ui/touch_selection/touch_handle.h
@@ -24,9 +24,11 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandleDrawable {
public:
virtual ~TouchHandleDrawable() {}
virtual void SetEnabled(bool enabled) = 0;
- virtual void SetOrientation(TouchHandleOrientation orientation) = 0;
+ virtual void SetLayout(const gfx::PointF& position,
+ ui::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;
};
@@ -66,10 +68,14 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
// If an animation is in-progress, it will be overriden appropriately.
void SetVisible(bool visible, AnimationStyle animation_style);
- // Update the handle placement to |position|.
+ // Update the focus points for the handles. The Handle will be positioned
+ // either |top| or |bottom| based on the mirror parameters.
// Note: If a fade out animation is active or the handle is invisible, the
// handle position will not be updated until the handle regains visibility.
- void SetPosition(const gfx::PointF& position);
+ void SetFocus(const gfx::PointF& top, const gfx::PointF& bottom);
mfomitchev 2015/05/13 22:19:14 We always call both SetFocus and SetViewportRect,
jdduke (slow) 2015/05/14 15:20:10 Hmm, but we would only do the layout twice if the
AviD 2015/05/19 16:26:28 SetSelectionParams() ?
AviD 2015/05/21 09:23:14 I have changed this to update the viewport rect on
+
+ // Update the Viewport rect, based on which the handle decide its inversion
+ void SetViewportRect(const gfx::RectF viewport_rect);
// Update the handle visuals to |orientation|.
// Note: If the handle is being dragged, the orientation change will be
@@ -85,10 +91,11 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
bool Animate(base::TimeTicks frame_time);
bool is_dragging() const { return is_dragging_; }
- const gfx::PointF& position() const { return position_; }
+ const gfx::PointF& position() const { return focus_bottom_; }
mfomitchev 2015/05/13 22:19:14 rename to focus_bottom()?
AviD 2015/05/19 16:26:28 Done.
TouchHandleOrientation orientation() const { return orientation_; }
private:
+ void UpdateLayout();
void BeginDrag();
void EndDrag();
void BeginFade();
@@ -99,7 +106,9 @@ class UI_TOUCH_SELECTION_EXPORT TouchHandle {
TouchHandleClient* const client_;
- gfx::PointF position_;
+ gfx::PointF focus_bottom_;
+ gfx::PointF focus_top_;
+ gfx::RectF viewport_rect_;
TouchHandleOrientation orientation_;
TouchHandleOrientation deferred_orientation_;
@@ -120,6 +129,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