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

Unified Diff: ui/touch_selection/touch_selection_controller.cc

Issue 1404163004: Swap touch selection handles when they are interchanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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_selection_controller.cc
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc
index c98d485160c4be3aa4e05dc3c1195e0ddbd1b9cd..364d0555f6413c7f3e7908e4c2d015ea669b1919 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -89,6 +89,16 @@ void TouchSelectionController::OnSelectionBoundsChanged(
client_->OnSelectionEvent(SELECTION_DISSOLVED);
}
+ // Swap the Handles when the start and end selection points cross each other.
+ if (active_status_ == SELECTION_ACTIVE) {
+ if ((start_selection_handle_->IsActive() &&
+ end_.edge_bottom() == start.edge_bottom()) ||
+ (end_selection_handle_->IsActive() &&
+ end.edge_bottom() == start_.edge_bottom())) {
+ start_selection_handle_.swap(end_selection_handle_);
+ }
+ }
+
start_ = start;
end_ = end;
start_orientation_ = ToTouchHandleOrientation(start_.type());
@@ -649,6 +659,20 @@ bool TouchSelectionController::GetEndVisible() const {
return !temporarily_hidden_ && !longpress_drag_selector_.IsActive();
}
+TouchHandleOrientation TouchSelectionController::GetStartHandleOrientation()
+ const {
mohsen 2015/11/19 21:35:36 Can you add this logic directly in |TouchSelection
AviD 2015/12/11 11:25:53 Done.
+ if (active_status_ != SELECTION_ACTIVE)
+ return TouchHandleOrientation::UNDEFINED;
+ return start_selection_handle_->orientation();
+}
+
+TouchHandleOrientation TouchSelectionController::GetEndHandleOrientation()
+ const {
+ if (active_status_ != SELECTION_ACTIVE)
+ return TouchHandleOrientation::UNDEFINED;
+ return end_selection_handle_->orientation();
+}
+
TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle(
bool was_active) const {
return was_active && client_->SupportsAnimation()

Powered by Google App Engine
This is Rietveld 408576698