Commit b6e1e1f2 authored by Richard Chui's avatar Richard Chui Committed by Commit Bot

Capture Mode: Update logic for hiding drag affordances

Drag affordances (drawn circles) are now hidden when the user clicks to
start resizing on a corner or when they begin moving the selected
capture region.

Test: manual
Change-Id: I20c701cc6deb894ff8803294ee28e783558fb163
Fixed: 1140787
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500450Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Richard Chui <richui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821586}
parent 280acf30
......@@ -507,8 +507,7 @@ void CaptureModeSession::PaintCaptureRegion(gfx::Canvas* canvas) {
if (is_selecting_region_)
return;
// Do not show affordance circles when repositioning the whole region.
if (fine_tune_position_ == FineTunePosition::kCenter)
if (capture_mode_util::ShouldHideDragAffordance(fine_tune_position_))
return;
// Draw the drag affordance circles.
......@@ -711,6 +710,14 @@ void CaptureModeSession::OnLocatedEventPressed(
return;
}
// In order to hide the drag affordance circles on click, we need to repaint
// the capture region.
if (capture_mode_util::ShouldHideDragAffordance(fine_tune_position_)) {
gfx::Rect damage_region = controller_->user_capture_region();
damage_region.Inset(gfx::Insets(-kDamageInsetDp));
layer()->SchedulePaint(damage_region);
}
if (fine_tune_position_ != FineTunePosition::kCenter &&
fine_tune_position_ != FineTunePosition::kNone) {
anchor_points_ = GetAnchorPointsForPosition(fine_tune_position_);
......
......@@ -52,6 +52,13 @@ bool IsCornerFineTunePosition(FineTunePosition position) {
return false;
}
bool ShouldHideDragAffordance(FineTunePosition position) {
// Do not show affordance circles when repositioning the whole region or if
// resizing on a corner.
return position == FineTunePosition::kCenter ||
IsCornerFineTunePosition(position);
}
} // namespace capture_mode_util
} // namespace ash
......@@ -24,6 +24,9 @@ ASH_EXPORT gfx::Point GetLocationForFineTunePosition(const gfx::Rect& rect,
// Return whether |position| is a corner.
ASH_EXPORT bool IsCornerFineTunePosition(FineTunePosition position);
// Return whether drag affordance circles should be hidden.
ASH_EXPORT bool ShouldHideDragAffordance(FineTunePosition position);
} // namespace capture_mode_util
} // namespace ash
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment