From 55c286fd6c5323480003402382bdc89863389c93 Mon Sep 17 00:00:00 2001 From: polarboy Date: Sun, 4 Aug 2024 22:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20CheckBox=20=E5=8B=BE?= =?UTF-8?q?=E5=8B=BE=E5=9D=90=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 CheckBox 勾勾坐标,之前的坐标计算有问题 --- src/AtomUI.Controls/CheckBox/CheckBox.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/AtomUI.Controls/CheckBox/CheckBox.cs b/src/AtomUI.Controls/CheckBox/CheckBox.cs index a713562..706f382 100644 --- a/src/AtomUI.Controls/CheckBox/CheckBox.cs +++ b/src/AtomUI.Controls/CheckBox/CheckBox.cs @@ -186,14 +186,7 @@ public class CheckBox : AvaloniaCheckBox, if (_styleState.HasFlag(ControlStyleState.On)) { var checkMarkGeometry = CommonShapeBuilder.BuildCheckMark(new Size(IndicatorCheckedMarkEffectSize, IndicatorCheckedMarkEffectSize)); - var checkMarkPenWidth = 2; var checkMarkPen = new Pen(IndicatorCheckedMarkBrush, 2); - var checkMarkBounds = checkMarkGeometry.GetRenderBounds(checkMarkPen); - var deltaWidth = (CheckIndicatorSize - checkMarkBounds.Width) / 2; - var deltaHeight = (CheckIndicatorSize - checkMarkBounds.Height) / 2; - var offsetX = indicatorRect.X + deltaWidth - checkMarkPenWidth - penWidth; - var offsetY = indicatorRect.Y + deltaHeight - checkMarkPenWidth - penWidth * 3; - checkMarkGeometry.Transform = new TranslateTransform(offsetX, offsetY); context.DrawGeometry(null, checkMarkPen, checkMarkGeometry); } else if (_styleState.HasFlag(ControlStyleState.Indeterminate)) { double deltaSize = (CheckIndicatorSize - IndicatorTristateMarkSize) / 2.0; @@ -253,7 +246,6 @@ public class CheckBox : AvaloniaCheckBox, // Measure 之后才有值 private Rect IndicatorRect() { - // var offsetY = Math.Ceiling((DesiredSize.Height - Margin.Top - Margin.Bottom - CheckIndicatorSize) / 2); return new Rect(0d, 0d, CheckIndicatorSize, CheckIndicatorSize); }