Commit fba6372d authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS shelf: indicator tweaks to match spec

* Reduce space to edge of screen.
* Draw the indicators as strokes, not rects, to be able to use "softer"
  flags (stroke cap, etc.).

Bug: 880578
Change-Id: Ic4268766561d2d038589f5216d22084463f551d4
Reviewed-on: https://chromium-review.googlesource.com/c/1288505Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600923}
parent 18040c0c
...@@ -214,25 +214,28 @@ class ShelfButton::AppStatusIndicatorView ...@@ -214,25 +214,28 @@ class ShelfButton::AppStatusIndicatorView
cc::PaintFlags flags; cc::PaintFlags flags;
// Active and running indicators look a little different in the new UI. // Active and running indicators look a little different in the new UI.
flags.setColor(active_ ? kIndicatorColorActive : kIndicatorColorRunning); flags.setColor(active_ ? kIndicatorColorActive : kIndicatorColorRunning);
float indicator_width; flags.setAntiAlias(true);
float indicator_height; flags.setStrokeCap(cc::PaintFlags::Cap::kRound_Cap);
gfx::PointF origin; flags.setStrokeJoin(cc::PaintFlags::Join::kRound_Join);
flags.setStrokeWidth(kStatusIndicatorThickness);
flags.setStyle(cc::PaintFlags::kStroke_Style);
float stroke_length =
active_ ? kStatusIndicatorActiveSize : kStatusIndicatorRunningSize;
gfx::PointF start;
gfx::PointF end;
if (horizontal_shelf_) { if (horizontal_shelf_) {
indicator_width = start = gfx::PointF(center.x() - stroke_length / 2, center.y());
active_ ? kStatusIndicatorActiveSize : kStatusIndicatorRunningSize; end = start;
indicator_height = kStatusIndicatorThickness; end.Offset(stroke_length, 0);
} else { } else {
indicator_width = kStatusIndicatorThickness; start = gfx::PointF(center.x(), center.y() - stroke_length / 2);
indicator_height = end = start;
active_ ? kStatusIndicatorActiveSize : kStatusIndicatorRunningSize; end.Offset(0, stroke_length);
} }
origin = gfx::PointF(center.x() - indicator_width / 2, gfx::Path path;
center.y() - indicator_height / 2); path.moveTo(start.x() * dsf, start.y() * dsf);
canvas->DrawRect( path.lineTo(end.x() * dsf, end.y() * dsf);
gfx::ScaleRect( canvas->DrawPath(path, flags);
gfx::RectF(origin, gfx::SizeF(indicator_width, indicator_height)),
dsf),
flags);
} }
// ShelfButtonAnimation::Observer // ShelfButtonAnimation::Observer
......
...@@ -85,7 +85,7 @@ constexpr int kOverflowButtonSize = 32; ...@@ -85,7 +85,7 @@ constexpr int kOverflowButtonSize = 32;
constexpr int kOverflowButtonCornerRadiusOldUi = 2; constexpr int kOverflowButtonCornerRadiusOldUi = 2;
// The distance between the edge of the shelf and the status indicators. // The distance between the edge of the shelf and the status indicators.
constexpr int kStatusIndicatorOffsetFromShelfEdge = 2; constexpr int kStatusIndicatorOffsetFromShelfEdge = 1;
// The direction of the focus cycling. // The direction of the focus cycling.
enum CycleDirection { CYCLE_FORWARD, CYCLE_BACKWARD }; enum CycleDirection { CYCLE_FORWARD, CYCLE_BACKWARD };
......
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