Skip to content

Commit 5b8258c

Browse files
committed
code_style: tab renderer
Signed-off-by: leo <longshuang@msn.cn>
1 parent 742e76d commit 5b8258c

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

src/Views/LauncherTabBar.axaml.cs

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -113,54 +113,37 @@ public override void Render(DrawingContext context)
113113

114114
var geo = new StreamGeometry();
115115
const double angle = Math.PI / 2;
116-
var y = height + 0.5;
116+
var bottom = height + 0.5;
117+
var cornerSize = new Size(5, 5);
118+
117119
using (var ctx = geo.Open())
118120
{
119-
double x;
120-
121121
var drawLeftX = activeStartX - startX + LauncherTabsScroller.Bounds.X;
122-
var drawRightX = activeEndX - startX + LauncherTabsScroller.Bounds.X;
123122
if (drawLeftX < LauncherTabsScroller.Bounds.X)
124123
{
125-
x = LauncherTabsScroller.Bounds.X;
126-
ctx.BeginFigure(new Point(x, y), true);
127-
y = 1;
128-
ctx.LineTo(new Point(x, y));
124+
ctx.BeginFigure(new Point(LauncherTabsScroller.Bounds.X, bottom), true);
125+
ctx.LineTo(new Point(LauncherTabsScroller.Bounds.X, 1));
129126
}
130127
else
131128
{
132-
x = drawLeftX - 5;
133-
ctx.BeginFigure(new Point(x, y), true);
134-
x = drawLeftX;
135-
y -= 5;
136-
ctx.ArcTo(new Point(x, y), new Size(5, 5), angle, false, SweepDirection.CounterClockwise);
137-
y = 6;
138-
ctx.LineTo(new Point(x, y));
139-
x += 6;
140-
y = 1;
141-
ctx.ArcTo(new Point(x, y), new Size(6, 6), angle, false, SweepDirection.Clockwise);
129+
ctx.BeginFigure(new Point(drawLeftX - 5, bottom), true);
130+
ctx.ArcTo(new Point(drawLeftX, bottom - 5), cornerSize, angle, false, SweepDirection.CounterClockwise);
131+
ctx.LineTo(new Point(drawLeftX, 6));
132+
ctx.ArcTo(new Point(drawLeftX + 5, 1), cornerSize, angle, false, SweepDirection.Clockwise);
142133
}
143134

144-
x = drawRightX - 6;
145-
135+
var drawRightX = activeEndX - startX + LauncherTabsScroller.Bounds.X;
146136
if (drawRightX <= LauncherTabsScroller.Bounds.Right)
147137
{
148-
ctx.LineTo(new Point(x, y));
149-
x = drawRightX;
150-
y = 6;
151-
ctx.ArcTo(new Point(x, y), new Size(6, 6), angle, false, SweepDirection.Clockwise);
152-
y = height + 0.5 - 5;
153-
ctx.LineTo(new Point(x, y));
154-
x += 5;
155-
y = height + 0.5;
156-
ctx.ArcTo(new Point(x, y), new Size(5, 5), angle, false, SweepDirection.CounterClockwise);
138+
ctx.LineTo(new Point(drawRightX - 5, 1));
139+
ctx.ArcTo(new Point(drawRightX, 6), cornerSize, angle, false, SweepDirection.Clockwise);
140+
ctx.LineTo(new Point(drawRightX, bottom - 5));
141+
ctx.ArcTo(new Point(drawRightX + 5, bottom), cornerSize, angle, false, SweepDirection.CounterClockwise);
157142
}
158143
else
159144
{
160-
x = LauncherTabsScroller.Bounds.Right;
161-
ctx.LineTo(new Point(x, y));
162-
y = height + 0.5;
163-
ctx.LineTo(new Point(x, y));
145+
ctx.LineTo(new Point(LauncherTabsScroller.Bounds.Right, 1));
146+
ctx.LineTo(new Point(LauncherTabsScroller.Bounds.Right, bottom));
164147
}
165148
}
166149

0 commit comments

Comments
 (0)