@@ -112,16 +112,16 @@ public override void Render(DrawingContext context)
112
112
113
113
// Palette picker
114
114
{
115
- var y = 6 * 32 + 8 ;
116
- var x = 0 ;
117
-
118
- context . DrawRectangle ( new SolidColorBrush ( _darkestColor ) , null , new RoundedRect ( new Rect ( x , y , 32 , 32 ) , new CornerRadius ( 4 , 0 , 0 , 4 ) ) ) ; x += 32 ;
119
- context . FillRectangle ( new SolidColorBrush ( _darkerColor ) , new Rect ( x , y , 32 , 32 ) ) ; x += 32 ;
120
- context . FillRectangle ( new SolidColorBrush ( _darkColor ) , new Rect ( x , y , 32 , 32 ) ) ; x += 32 ;
121
- context . FillRectangle ( new SolidColorBrush ( _color ) , new Rect ( x , y - 4 , 64 , 40 ) , 4 ) ; x += 64 ;
122
- context . FillRectangle ( new SolidColorBrush ( _lightColor ) , new Rect ( x , y , 32 , 32 ) ) ; x += 32 ;
123
- context . FillRectangle ( new SolidColorBrush ( _lighterColor ) , new Rect ( x , y , 32 , 32 ) ) ; x += 32 ;
124
- context . DrawRectangle ( new SolidColorBrush ( _lightestColor ) , null , new RoundedRect ( new Rect ( x , y , 32 , 32 ) , new CornerRadius ( 0 , 4 , 4 , 0 ) ) ) ;
115
+ context . DrawRectangle ( Brushes . Transparent , null , new Rect ( 0 , 200 , 256 , 32 ) , 4 , 4 , _shadow ) ;
116
+
117
+ context . DrawRectangle ( new SolidColorBrush ( _darkestColor ) , null , _darkestRect ) ;
118
+ context . FillRectangle ( new SolidColorBrush ( _darkerColor ) , _darkerRect ) ;
119
+ context . FillRectangle ( new SolidColorBrush ( _darkColor ) , _darkRect ) ;
120
+ context . FillRectangle ( new SolidColorBrush ( _lightColor ) , _lightRect ) ;
121
+ context . FillRectangle ( new SolidColorBrush ( _lighterColor ) , _lighterRect ) ;
122
+ context . DrawRectangle ( new SolidColorBrush ( _lightestColor ) , null , _lightestRect ) ;
123
+
124
+ context . DrawRectangle ( new SolidColorBrush ( _color ) , null , new Rect ( 96 , 200 - 4 , 64 , 40 ) , 4 , 4 , _shadow ) ;
125
125
}
126
126
}
127
127
@@ -138,9 +138,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
138
138
139
139
protected override Size MeasureOverride ( Size availableSize )
140
140
{
141
- var w = 32 * 8 ;
142
- var h = 32 * 6 + 16 + 36 ;
143
- return new Size ( w , h ) ;
141
+ return new Size ( 256 , 256 ) ;
144
142
}
145
143
146
144
protected override void OnPointerPressed ( PointerPressedEventArgs e )
@@ -162,7 +160,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
162
160
return ;
163
161
}
164
162
165
- if ( _darkestRect . Contains ( p ) )
163
+ if ( _darkestRect . Rect . Contains ( p ) )
166
164
{
167
165
_hightlightedTableElement = - 1 ;
168
166
SetCurrentValue ( ValueProperty , _darkestColor . ToUInt32 ( ) ) ;
@@ -187,7 +185,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
187
185
_hightlightedTableElement = - 1 ;
188
186
SetCurrentValue ( ValueProperty , _lighterColor . ToUInt32 ( ) ) ;
189
187
}
190
- else if ( _lightestRect . Contains ( p ) )
188
+ else if ( _lightestRect . Rect . Contains ( p ) )
191
189
{
192
190
_hightlightedTableElement = - 1 ;
193
191
SetCurrentValue ( ValueProperty , _lightestColor . ToUInt32 ( ) ) ;
@@ -217,13 +215,15 @@ private Color GetNextColor(HsvColor c, double step)
217
215
return newColor . ToRgb ( ) ;
218
216
}
219
217
218
+ private BoxShadows _shadow = BoxShadows . Parse ( "0 0 6 0 #A9000000" ) ;
219
+
220
220
private Rect _colorTableRect = new Rect ( 0 , 0 , 32 * 8 , 32 * 6 ) ;
221
- private Rect _darkestRect = new Rect ( 0 , 200 , 32 , 32 ) ;
221
+ private RoundedRect _darkestRect = new RoundedRect ( new Rect ( 0 , 200 , 32 , 32 ) , new CornerRadius ( 4 , 0 , 0 , 4 ) ) ;
222
222
private Rect _darkerRect = new Rect ( 32 , 200 , 32 , 32 ) ;
223
223
private Rect _darkRect = new Rect ( 64 , 200 , 32 , 32 ) ;
224
224
private Rect _lightRect = new Rect ( 160 , 200 , 32 , 32 ) ;
225
225
private Rect _lighterRect = new Rect ( 192 , 200 , 32 , 32 ) ;
226
- private Rect _lightestRect = new Rect ( 224 , 200 , 32 , 32 ) ;
226
+ private RoundedRect _lightestRect = new RoundedRect ( new Rect ( 224 , 200 , 32 , 32 ) , new CornerRadius ( 0 , 4 , 4 , 0 ) ) ;
227
227
228
228
private int _hightlightedTableElement = - 1 ;
229
229
0 commit comments