RC3
This commit is contained in:
James Clancey 2022-05-11 14:31:07 -08:00 коммит произвёл GitHub
Родитель e90448f89f 68e91860a7
Коммит ea8b0b5af1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 66 добавлений и 50 удалений

27
.github/workflows/dev.yml поставляемый
Просмотреть файл

@ -28,17 +28,17 @@ jobs:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
# - name: install .NET
# shell: pwsh
# run: |
# $ProgressPreference = 'SilentlyContinue'
# Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
# & .\dotnet-install.ps1 -Quality daily -Channel 6.0.3xx -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
# & dotnet --list-sdks
- name: Install Visual Studio Preview
- name: install .NET
shell: pwsh
run: powershell .\build\install-vs.ps1
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -Quality daily -Channel 6.0.3xx -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& dotnet --list-sdks
# - name: Install Visual Studio Preview
# shell: pwsh
# run: powershell .\build\install-vs.ps1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
@ -50,11 +50,8 @@ jobs:
run: |
& dotnet workload install maui `
--skip-sign-check `
--from-rollback-file https://aka.ms/dotnet/maui/6.0.300/rc.2.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-323bf2dd/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-572aeedc/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a21b9a2d/nuget/v3/index.json `
--from-rollback-file https://aka.ms/dotnet/maui/6.0.300/rc.3.json `
--source https://aka.ms/dotnet6/nuget/index.json `
--source https://api.nuget.org/v3/index.json

15
.github/workflows/main.yml поставляемый
Просмотреть файл

@ -36,27 +36,26 @@ jobs:
& .\dotnet-install.ps1 -Quality daily -Channel 6.0.3xx -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& dotnet --list-sdks
- name: Install Visual Studio Preview
shell: pwsh
run: powershell .\build\install-vs.ps1
# - name: Install Visual Studio Preview
# shell: pwsh
# run: powershell .\build\install-vs.ps1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true
- name: Install Maui Workload
shell: pwsh
run: |
& dotnet workload install maui `
--skip-sign-check `
--from-rollback-file https://aka.ms/dotnet/maui/6.0.300/rc.2.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-323bf2dd/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-572aeedc/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a21b9a2d/nuget/v3/index.json `
--from-rollback-file https://aka.ms/dotnet/maui/6.0.300/rc.3.json `
--source https://aka.ms/dotnet6/nuget/index.json `
--source https://api.nuget.org/v3/index.json
- name: Set Maui Version
run: dotnet run --project build/MauiVersionUpdater/MauiVersionUpdater.csproj -- https://aka.ms/dotnet/maui/6.0.300/rc.2.json

2
External/Maui поставляемый

@ -1 +1 @@
Subproject commit acf9a61ae05fa0ca0d1f6554507e5957006a1af2
Subproject commit bb116a4a908174c33a1d62de3dee833c8a125372

Просмотреть файл

@ -38,10 +38,5 @@
<ProjectReference Include="..\..\external\Maui\src\Core\src\Core.csproj" />
<ProjectReference Include="..\..\external\Maui\src\Essentials\src\Essentials.csproj" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<WindowsPackageType>MSIX</WindowsPackageType>
</PropertyGroup>
<ProjectExtensions><VisualStudio><UserProperties XamarinHotReloadDebuggerTimeoutExceptionCometSingleProjectSampleHideInfoBar="True" /></VisualStudio></ProjectExtensions>
</Project>

Просмотреть файл

@ -5,6 +5,4 @@
</PropertyGroup>
<Import Project="../../External/Maui/Directory.Build.props" />
<Import Project="../../External/Maui/src/Maui.InTree.props"/>
</Project>

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<Import Project="../../External/Maui/src/Maui.InTree.targets"/>
<Import Project="../../External/Maui/Directory.Build.targets" />
</Project>

Просмотреть файл

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<Import Project="..\External\Maui\eng\AndroidX.targets" />
<Import Project="..\External\Maui\eng\Versions.props" />
<Import Project="..\External\Maui\eng\Microsoft.Extensions.targets" />
<Import Project="..\Directory.Build.targets" />
</Project>

Просмотреть файл

@ -7,7 +7,11 @@ namespace Comet
{
public static class AnimationExtensions
{
public static FrameConstraints Lerp(this FrameConstraints start, FrameConstraints end, double progress)
=> new FrameConstraints(
start.Width.Lerp(end.Width, progress),
start.Height.Lerp(end.Height, progress)
);
public static T Animate<T>(this T view, Action<T> action, Action completed = null, double duration = .2, double delay = 0, bool repeats = false, bool autoReverses = false, string id = null, Lerp lerp = null)
where T : View => view.Animate(Easing.Default, action, completed, duration, delay, repeats, autoReverses, id, lerp);

Просмотреть файл

@ -4,6 +4,7 @@ using Comet.Handlers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Maui;
using Microsoft.Maui.Animations;
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Devices;
using Microsoft.Maui.Handlers;
@ -37,6 +38,14 @@ namespace Comet
ViewHandler.ViewMapper.AppendToMapping(nameof(IGestureView.Gestures), CometViewHandler.AddGestures);
ViewHandler.ViewCommandMapper.AppendToMapping(Gesture.AddGestureProperty, CometViewHandler.AddGesture);
ViewHandler.ViewCommandMapper.AppendToMapping(Gesture.AddGestureProperty, CometViewHandler.RemoveGesture);
Lerp.Lerps[typeof(FrameConstraints)] = new Lerp
{
Calculate = (s, e, progress) => {
var start = (FrameConstraints)s;
var end = (FrameConstraints)(e);
return start.Lerp(end, progress);
}
};
builder.ConfigureMauiHandlers((handlersCollection) => handlersCollection.AddHandlers(new Dictionary<Type, Type>
{
{ typeof(AbstractLayout), typeof(LayoutHandler) },

Просмотреть файл

@ -47,7 +47,7 @@ namespace Comet
Size lastMeasureSize;
public override Size GetDesiredSize(Size availableSize)
{
if (this.IsMeasureValid && availableSize == lastMeasureSize)
if (MeasurementValid && availableSize == lastMeasureSize)
return MeasuredSize;
lastMeasureSize = availableSize;
var frameConstraints = this.GetFrameConstraints();

Просмотреть файл

@ -21,7 +21,7 @@ using Microsoft.Maui.Primitives;
namespace Comet
{
public class View : ContextualObject, IDisposable, IView, IHotReloadableView,ISafeAreaView, IContentTypeHash, IAnimator, ITitledElement, IGestureView, IBorder, IVisualTreeElement
public class View : ContextualObject, IDisposable, IView, IHotReloadableView, ISafeAreaView, IContentTypeHash, IAnimator, ITitledElement, IGestureView, IBorder, IVisualTreeElement
{
static internal readonly WeakList<IView> ActiveViews = new WeakList<IView>();
HashSet<(string Field, string Key)> usedEnvironmentData = new HashSet<(string Field, string Key)>();
@ -34,6 +34,17 @@ namespace Comet
[EnvironmentKeys.Fonts.Weight] = nameof(IText.Font),
};
protected static HashSet<string> PropertiesThatTriggerLayout = new()
{
nameof(IText.Font),
nameof(IText.Text),
nameof(IView.MinimumHeight),
nameof(IView.MaximumHeight),
nameof(IView.MinimumWidth),
nameof(IView.MaximumWidth),
nameof(IImageSourcePart.Source),
};
IReloadHandler reloadHandler;
public IReloadHandler ReloadHandler
{
@ -313,7 +324,7 @@ namespace Comet
else
ViewPropertyChanged(prop, value);
}
catch(Exception ex)
catch (Exception ex)
{
Logger.Error(ex);
}
@ -339,11 +350,18 @@ namespace Comet
var newPropName = GetHandlerPropertyName(property);
ViewHandler?.UpdateValue(newPropName);
builtView?.ViewPropertyChanged(property, value);
if (measurementValid && PropertyChangeShouldTriggerLayout(newPropName))
{
this.InvalidateMeasurement();
}
}
protected virtual string GetHandlerPropertyName(string property) =>
HandlerPropertyMapper.TryGetValue(property, out var value) ? value : property;
protected virtual bool PropertyChangeShouldTriggerLayout(string property) =>
PropertiesThatTriggerLayout.Contains(property);
internal override void ContextPropertyChanged(string property, object value, bool cascades)
{
@ -530,6 +548,7 @@ namespace Comet
public void InvalidateMeasurement()
{
lastAvailableSize = Size.Zero;
MeasurementValid = false;
(Parent as IView)?.InvalidateMeasure();
}
@ -549,7 +568,7 @@ namespace Comet
{
if (BuiltView != null)
return BuiltView.GetDesiredSize(availableSize);
if (!IsMeasureValid || lastAvailableSize != availableSize)
if (!MeasurementValid || lastAvailableSize != availableSize)
{
var frameConstraints = this.GetFrameConstraints();
var margins = this.GetMargin();
@ -557,7 +576,7 @@ namespace Comet
if (frameConstraints?.Height > 0 && frameConstraints?.Width > 0)
return new Size(frameConstraints.Width.Value, frameConstraints.Height.Value);
var ms = this.ComputeDesiredSize(availableSize.Width, availableSize.Height);
if(frameConstraints?.Width > 0)
if (frameConstraints?.Width > 0)
ms.Width = frameConstraints.Width.Value;
if (frameConstraints?.Height > 0)
ms.Height = frameConstraints.Height.Value;
@ -566,7 +585,7 @@ namespace Comet
ms.Height += margins.HorizontalThickness;
MeasuredSize = ms;
}
IsMeasureValid = this.ViewHandler != null;
MeasurementValid = this.ViewHandler != null;
return MeasuredSize;
}
@ -579,7 +598,7 @@ namespace Comet
return MeasuredSize = BuiltView.Measure(widthConstraint, heightConstraint);
var availableSize = new Size(widthConstraint, heightConstraint);
if (!IsMeasureValid || availableSize != lastAvailableSize)
if (!MeasurementValid || availableSize != lastAvailableSize)
{
MeasuredSize = GetDesiredSize(new Size(widthConstraint, heightConstraint));
if (ViewHandler != null)
@ -590,7 +609,7 @@ namespace Comet
}
}
IsMeasureValid = ViewHandler != null;
MeasurementValid = ViewHandler != null;
return MeasuredSize;
}
@ -698,11 +717,6 @@ namespace Comet
Size IView.DesiredSize => MeasuredSize;
protected bool IsMeasureValid;
//bool IView.IsMeasureValid => IsMeasureValid;
protected bool IsArrangeValid;
//bool IView.IsArrangeValid => IsArrangeValid;
double IView.Width => this.GetFrameConstraints()?.Width ?? Dimension.Unset;
double IView.Height => this.GetFrameConstraints()?.Height ?? Dimension.Unset;
@ -779,7 +793,7 @@ namespace Comet
//Measure(new Size(widthConstraint, heightConstraint));
Measure(widthConstraint, heightConstraint);
void IView.InvalidateMeasure() => InvalidateMeasurement();
void IView.InvalidateArrange() => IsArrangeValid = false;
void IView.InvalidateArrange() {}
void IHotReloadableView.TransferState(IView newView) {
var oldState = this.GetState();
if (oldState == null)