Browse Source

Merge branch 'master' into fixes/devtools-select

pull/11629/head
Max Katz 3 years ago
committed by GitHub
parent
commit
1bddc13c67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs
  2. 10
      src/Avalonia.Base/Rendering/Composition/Server/ServerRenderResource.cs
  3. 40
      src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs
  4. 18
      src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs
  5. 10
      src/Avalonia.Controls.DataGrid/DataGridColumn.cs

5
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs

@ -14,7 +14,7 @@ namespace Avalonia.Rendering.Composition.Server;
/// <summary>
/// Server-side counterpart of <see cref="CompositionDrawListVisual"/>
/// </summary>
internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisual
internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisual, IServerRenderResourceObserver
{
#if DEBUG
// This is needed for debugging purposes so we could see inspect the associated visual from debugger
@ -37,6 +37,7 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua
{
_renderCommands?.Dispose();
_renderCommands = reader.ReadObject<ServerCompositionRenderData?>();
_renderCommands?.AddObserver(this);
}
base.DeserializeChangesCore(reader, committedAt);
}
@ -50,6 +51,8 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua
base.RenderCore(canvas, currentTransformedClip);
}
public void DependencyQueuedInvalidate(IServerRenderResource sender) => ValuesInvalidated();
#if DEBUG
public override string ToString()
{

10
src/Avalonia.Base/Rendering/Composition/Server/ServerRenderResource.cs

@ -13,8 +13,8 @@ internal interface IServerRenderResourceObserver
internal interface IServerRenderResource : IServerRenderResourceObserver
{
void AddObserver(IServerRenderResource observer);
void RemoveObserver(IServerRenderResource observer);
void AddObserver(IServerRenderResourceObserver observer);
void RemoveObserver(IServerRenderResourceObserver observer);
void QueuedInvalidate();
}
@ -23,7 +23,7 @@ internal class SimpleServerRenderResource : SimpleServerObject, IServerRenderRes
private bool _pendingInvalidation;
private bool _disposed;
public bool IsDisposed => _disposed;
private RefCountingSmallDictionary<IServerRenderResource> _observers;
private RefCountingSmallDictionary<IServerRenderResourceObserver> _observers;
public SimpleServerRenderResource(ServerCompositor compositor) : base(compositor)
{
@ -97,7 +97,7 @@ internal class SimpleServerRenderResource : SimpleServerObject, IServerRenderRes
}
public void AddObserver(IServerRenderResource observer)
public void AddObserver(IServerRenderResourceObserver observer)
{
Debug.Assert(!_disposed);
if(_disposed)
@ -105,7 +105,7 @@ internal class SimpleServerRenderResource : SimpleServerObject, IServerRenderRes
_observers.Add(observer);
}
public void RemoveObserver(IServerRenderResource observer)
public void RemoveObserver(IServerRenderResourceObserver observer)
{
if (_disposed)
return;

40
src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs

@ -266,26 +266,26 @@ namespace Avalonia.Controls
MidnightBlue9 = 0xFF1C2833,
MidnightBlue10 = 0xFF17202A,
Pomegranate = Pomegranate3,
Alizarin = Alizarin3,
Amethyst = Amethyst3,
Wisteria = Wisteria3,
BelizeHole = BelizeHole3,
PeterRiver = PeterRiver3,
Turquoise = Turquoise3,
GreenSea = GreenSea3,
Nephritis = Nephritis3,
Emerald = Emerald3,
Sunflower = Sunflower3,
Orange = Orange3,
Carrot = Carrot3,
Pumpkin = Pumpkin3,
Clouds = Clouds3,
Silver = Silver3,
Concrete = Concrete3,
Asbestos = Asbestos3,
WetAsphalt = WetAsphalt3,
MidnightBlue = MidnightBlue3,
Pomegranate = Pomegranate6,
Alizarin = Alizarin6,
Amethyst = Amethyst6,
Wisteria = Wisteria6,
BelizeHole = BelizeHole6,
PeterRiver = PeterRiver6,
Turquoise = Turquoise6,
GreenSea = GreenSea6,
Nephritis = Nephritis6,
Emerald = Emerald6,
Sunflower = Sunflower6,
Orange = Orange6,
Carrot = Carrot6,
Pumpkin = Pumpkin6,
Clouds = Clouds6,
Silver = Silver6,
Concrete = Concrete6,
Asbestos = Asbestos6,
WetAsphalt = WetAsphalt6,
MidnightBlue = MidnightBlue6,
};
// See: https://htmlcolorcodes.com/assets/downloads/flat-design-colors/flat-design-color-chart.png

18
src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.cs

@ -45,7 +45,6 @@ namespace Avalonia.Controls.Primitives
private bool _updatingColor = false;
private bool _updatingHsvColor = false;
private bool _coercedInitialColor = false;
private bool _isPointerPressed = false;
private bool _shouldShowLargeSelection = false;
private List<Hsv> _hsvValues = new List<Hsv>();
@ -622,7 +621,7 @@ namespace Avalonia.Controls.Primitives
// that no color has been selected by the user. Note that #00000000 is different than
// #00FFFFFF (Transparent).
//
// In this situation, the first time the user clicks on the spectrum the third
// In this situation, whenever the user clicks on the spectrum, the third
// component and alpha component will remain zero. This is because the spectrum only
// controls two components at any given time.
//
@ -633,16 +632,19 @@ namespace Avalonia.Controls.Primitives
// though the desired value is simply full color.
//
// To work around this usability issue with an initial #00000000 color, the selected
// color is coerced (only the first time) into a color with maximum third component
// value and maximum alpha. This can only happen once and only if those two components
// are already zero.
// color is coerced into a color with maximum third component value and maximum alpha.
// This can only happen here in the spectrum if those two components are already zero.
//
// In the past this coercion was restricted to occur only one time. However, when
// ColorPicker controls are re-used or recycled #00000000 can be set multiple times.
// Each time needs this special logic for usability so now anytime the color is
// changed on the spectrum this logic will run.
//
// Also note this is NOT currently done for #00FFFFFF (Transparent) but based on
// further usability study that case may need to be handled here as well. Right now
// Transparent is treated as a normal color value with the alpha intentionally set
// to zero so the alpha slider must still be adjusted after the spectrum.
if (!_coercedInitialColor &&
IsLoaded)
if (IsLoaded)
{
bool isAlphaComponentZero = (alpha == 0.0);
bool isThirdComponentZero = false;
@ -691,8 +693,6 @@ namespace Avalonia.Controls.Primitives
newHsv.H = 360.0;
break;
}
_coercedInitialColor = true;
}
}

10
src/Avalonia.Controls.DataGrid/DataGridColumn.cs

@ -1103,6 +1103,16 @@ namespace Avalonia.Controls
get;
set;
}
/// <summary>
/// Gets or sets an object associated with this column.
/// </summary>
public object Tag
{
get;
set;
}
/// <summary>
/// Holds a Comparer to use for sorting, if not using the default.
/// </summary>

Loading…
Cancel
Save