From f000c68597b10f7dd85f30b3319353b1519dca52 Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Mon, 3 Jun 2024 17:39:50 +0800
Subject: [PATCH] feat: optimize.
---
src/Ursa.Themes.Semi/Controls/Rating.axaml | 33 ++++++++-----------
src/Ursa.Themes.Semi/Themes/Dark/Rating.axaml | 6 ++--
.../Themes/Light/Rating.axaml | 6 ++--
.../Themes/Shared/Rating.axaml | 8 ++---
src/Ursa/Controls/Rating/RatingCharacter.cs | 10 +-----
5 files changed, 24 insertions(+), 39 deletions(-)
diff --git a/src/Ursa.Themes.Semi/Controls/Rating.axaml b/src/Ursa.Themes.Semi/Controls/Rating.axaml
index d643eca..39390c4 100644
--- a/src/Ursa.Themes.Semi/Controls/Rating.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Rating.axaml
@@ -2,29 +2,24 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
+
+
-
-
-
-
-
-
-
-
-
+
-
+
@@ -32,7 +27,7 @@
-
+
diff --git a/src/Ursa.Themes.Semi/Themes/Dark/Rating.axaml b/src/Ursa.Themes.Semi/Themes/Dark/Rating.axaml
index 196c29f..d522d56 100644
--- a/src/Ursa.Themes.Semi/Themes/Dark/Rating.axaml
+++ b/src/Ursa.Themes.Semi/Themes/Dark/Rating.axaml
@@ -1,4 +1,4 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Themes/Light/Rating.axaml b/src/Ursa.Themes.Semi/Themes/Light/Rating.axaml
index 0aa4d07..0b233f6 100644
--- a/src/Ursa.Themes.Semi/Themes/Light/Rating.axaml
+++ b/src/Ursa.Themes.Semi/Themes/Light/Rating.axaml
@@ -1,4 +1,4 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Themes/Shared/Rating.axaml b/src/Ursa.Themes.Semi/Themes/Shared/Rating.axaml
index da8d010..37ceecd 100644
--- a/src/Ursa.Themes.Semi/Themes/Shared/Rating.axaml
+++ b/src/Ursa.Themes.Semi/Themes/Shared/Rating.axaml
@@ -1,5 +1,3 @@
-
- M12 5.02863L9.56867 9.10197C9.39633 9.39072 9.10801 9.59094 8.77762 9.65133L4.47932 10.4369L7.47279 13.9041C7.69195 14.158 7.79145 14.494 7.74589 14.8265L7.13481 19.2864L11.5403 17.3919C11.8338 17.2657 12.1662 17.2657 12.4597 17.3919L16.8652 19.2864L16.2541 14.8265C16.2086 14.494 16.308 14.158 16.5272 13.9041L19.5207 10.4369L15.2224 9.65133C14.892 9.59095 14.6037 9.39072 14.4313 9.10198L12 5.02863ZM10.9998 2.56831C11.4521 1.81056 12.5479 1.81057 13.0002 2.56831L16.028 7.64098L21.5427 8.64887C22.4298 8.81101 22.8049 9.87773 22.215 10.561L18.4119 14.9659L19.1938 20.672C19.3171 21.5718 18.4126 22.2617 17.5795 21.9035L12 19.5041L6.4205 21.9035C5.58741 22.2617 4.68294 21.5718 4.80622 20.672L5.58806 14.9659L1.78503 10.561C1.19513 9.87772 1.57018 8.81101 2.45731 8.64887L7.97197 7.64098L10.9998 2.56831Z
- M10.7525 1.90411C11.1451 0.698628 12.8549 0.698631 13.2475 1.90411L15.2395 8.01946H21.6858C22.9565 8.01946 23.4848 9.64143 22.4568 10.3865L17.2417 14.1659L19.2337 20.2813C19.6263 21.4868 18.2431 22.4892 17.2151 21.7442L12 17.9647L6.78489 21.7442C5.75687 22.4892 4.37368 21.4868 4.76635 20.2813L6.75834 14.1659L1.54323 10.3865C0.515206 9.64142 1.04354 8.01946 2.31425 8.01946H8.76048L10.7525 1.90411Z
-
+
+ M10.7525 1.90411C11.1451 0.698628 12.8549 0.698631 13.2475 1.90411L15.2395 8.01946H21.6858C22.9565 8.01946 23.4848 9.64143 22.4568 10.3865L17.2417 14.1659L19.2337 20.2813C19.6263 21.4868 18.2431 22.4892 17.2151 21.7442L12 17.9647L6.78489 21.7442C5.75687 22.4892 4.37368 21.4868 4.76635 20.2813L6.75834 14.1659L1.54323 10.3865C0.515206 9.64142 1.04354 8.01946 2.31425 8.01946H8.76048L10.7525 1.90411Z
+
\ No newline at end of file
diff --git a/src/Ursa/Controls/Rating/RatingCharacter.cs b/src/Ursa/Controls/Rating/RatingCharacter.cs
index f3e2c2b..44cc6c9 100644
--- a/src/Ursa/Controls/Rating/RatingCharacter.cs
+++ b/src/Ursa/Controls/Rating/RatingCharacter.cs
@@ -8,19 +8,11 @@ namespace Ursa.Controls;
[PseudoClasses(PC_Selected)]
[TemplatePart(PART_IconGlyph, typeof(PathIcon))]
-public class RatingCharacter : ContentControl
+public class RatingCharacter : TemplatedControl
{
public const string PART_IconGlyph = "PART_IconGlyph";
protected const string PC_Selected = ":selected";
- private PathIcon? _icon;
-
- protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
- {
- base.OnApplyTemplate(e);
- _icon = e.NameScope.Find(PART_IconGlyph);
- }
-
protected override void OnPointerEntered(PointerEventArgs e)
{
var parent = this.GetLogicalAncestors().OfType().FirstOrDefault();