Browse Source
* Property support StaticWebAssets SDK when it's available
* Fix browser issue with dispatcher used before initialization
* Use RequestAnimationFrame instead of WebEmbeddableControlRoot hack
* Always include both types of assets by default, as I couldn't find a reliable way to detect project capabilities properly
* Remove "WasmRuntimeAssetsLocation" override, instead let users use default value set by .NET SDK
* Revert "Fix browser issue with dispatcher used before initialization"
This reverts commit fc43c7e3d5.
* Add AvaloniaAllowWebGl2 prop
* What
scroll_transition_repro
committed by
GitHub
17 changed files with 68 additions and 156 deletions
@ -1,7 +0,0 @@ |
|||||
<linker> |
|
||||
<assembly fullname="MobileSandbox" preserve="All" /> |
|
||||
<assembly fullname="MobileSandbox.Browser" preserve="All" /> |
|
||||
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" /> |
|
||||
<assembly fullname="Avalonia.Themes.Simple" preserve="All" /> |
|
||||
<assembly fullname="Avalonia.Controls.ColorPicker" preserve="All" /> |
|
||||
</linker> |
|
||||
@ -1,10 +0,0 @@ |
|||||
<Project> |
|
||||
<PropertyGroup> |
|
||||
<ShouldIncludeAvaloniaJavaScript Condition=" '$(ShouldIncludeAvaloniaJavaScript)' == '' ">True</ShouldIncludeAvaloniaJavaScript> |
|
||||
<ShouldIncludeNativeSkiaSharp Condition=" '$(ShouldIncludeNativeSkiaSharp)' == '' ">True</ShouldIncludeNativeSkiaSharp> |
|
||||
<ShouldIncludeNativeHarfBuzzSharp Condition=" '$(ShouldIncludeNativeHarfBuzzSharp)' == '' ">True</ShouldIncludeNativeHarfBuzzSharp> |
|
||||
<!-- .NET 8 changes default location for dotnet script to the "_framework" subfolder, --> |
|
||||
<!-- But this change would introduce a breaking change to Avalonia users, so we revert it back to the .NET 7 state. --> |
|
||||
<WasmRuntimeAssetsLocation Condition="'$(WasmRuntimeAssetsLocation)' == ''">./</WasmRuntimeAssetsLocation> |
|
||||
</PropertyGroup> |
|
||||
</Project> |
|
||||
@ -1,68 +0,0 @@ |
|||||
using System; |
|
||||
using Avalonia.Controls.Embedding; |
|
||||
using Avalonia.Media; |
|
||||
using Avalonia.Platform; |
|
||||
using Avalonia.Rendering.SceneGraph; |
|
||||
|
|
||||
namespace Avalonia.Browser |
|
||||
{ |
|
||||
internal class WebEmbeddableControlRoot : EmbeddableControlRoot |
|
||||
{ |
|
||||
class SplashScreenCloseCustomDrawingOperation : ICustomDrawOperation |
|
||||
{ |
|
||||
private bool _hasRendered; |
|
||||
private Action _onFirstRender; |
|
||||
|
|
||||
public SplashScreenCloseCustomDrawingOperation(Action onFirstRender) |
|
||||
{ |
|
||||
_onFirstRender = onFirstRender; |
|
||||
} |
|
||||
|
|
||||
public Rect Bounds => default; |
|
||||
|
|
||||
public bool HasRendered => _hasRendered; |
|
||||
|
|
||||
public void Dispose() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public bool Equals(ICustomDrawOperation? other) |
|
||||
{ |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
public bool HitTest(Point p) |
|
||||
{ |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
public void Render(ImmediateDrawingContext context) |
|
||||
{ |
|
||||
_hasRendered = true; |
|
||||
_onFirstRender(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public WebEmbeddableControlRoot(ITopLevelImpl impl, Action onFirstRender) : base(impl) |
|
||||
{ |
|
||||
_splashCloseOp = new SplashScreenCloseCustomDrawingOperation(() => |
|
||||
{ |
|
||||
_splashCloseOp = null; |
|
||||
onFirstRender(); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
private SplashScreenCloseCustomDrawingOperation? _splashCloseOp; |
|
||||
|
|
||||
public override void Render(DrawingContext context) |
|
||||
{ |
|
||||
base.Render(context); |
|
||||
|
|
||||
if (_splashCloseOp != null) |
|
||||
{ |
|
||||
context.Custom(_splashCloseOp); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,13 @@ |
|||||
|
<Project> |
||||
|
<PropertyGroup> |
||||
|
<AvaloniaAllowWebGl2 Condition="'$(AvaloniaAllowWebGl2)' == ''">true</AvaloniaAllowWebGl2> |
||||
|
<ShouldIncludeAvaloniaAssets Condition=" '$(ShouldIncludeAvaloniaAssets)' == '' ">True</ShouldIncludeAvaloniaAssets> |
||||
|
<ShouldIncludeAvaloniaLegacyAssets Condition=" '$(ShouldIncludeAvaloniaLegacyAssets)' == '' AND '$(ShouldIncludeAvaloniaAssets)' == 'True'">True</ShouldIncludeAvaloniaLegacyAssets> |
||||
|
<ShouldIncludeAvaloniaStaticAssets Condition=" '$(ShouldIncludeAvaloniaStaticAssets)' == '' AND '$(ShouldIncludeAvaloniaAssets)' == 'True'">True</ShouldIncludeAvaloniaStaticAssets> |
||||
|
|
||||
|
<ShouldIncludeNativeSkiaSharp Condition=" '$(ShouldIncludeNativeSkiaSharp)' == '' ">True</ShouldIncludeNativeSkiaSharp> |
||||
|
<ShouldIncludeNativeHarfBuzzSharp Condition=" '$(ShouldIncludeNativeHarfBuzzSharp)' == '' ">True</ShouldIncludeNativeHarfBuzzSharp> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<Import Project="$(MSBuildThisFileDirectory)/../build/Microsoft.AspNetCore.StaticWebAssets.props" /> |
||||
|
</Project> |
||||
@ -1,12 +1,14 @@ |
|||||
<Project> |
<Project> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<EmccExtraLDFlags>$(EmccExtraLDFlags) --js-library="$(MSBuildThisFileDirectory)/interop.js"</EmccExtraLDFlags> |
<EmccExtraLDFlags>$(EmccExtraLDFlags) --js-library="$(MSBuildThisFileDirectory)/interop.js"</EmccExtraLDFlags> |
||||
<EmccFlags>$(EmccExtraLDFlags) -sERROR_ON_UNDEFINED_SYMBOLS=0</EmccFlags> |
<EmccFlags>$(EmccFlags) -sERROR_ON_UNDEFINED_SYMBOLS=0</EmccFlags> |
||||
|
<EmccFlags Condition="'$(AvaloniaAllowWebGl2)' == 'true'">$(EmccFlags) -sUSE_WEBGL2=1 -sMAX_WEBGL_VERSION=2 -lGL </EmccFlags> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
|
|
||||
<ItemGroup> |
<!-- Fallback for applications without StaticWebAssetsEnabled (legacy WASM SDK) --> |
||||
<WasmExtraFilesToDeploy Condition="'$(WasmRuntimeAssetsLocation)' == ''" Include="$(MSBuildThisFileDirectory)/wwwroot/**/*.*" /> |
<ItemGroup Condition="'$(ShouldIncludeAvaloniaLegacyAssets)' == 'True'"> |
||||
<WasmExtraFilesToDeploy Condition="'$(WasmRuntimeAssetsLocation)' != ''" Include="$(MSBuildThisFileDirectory)/wwwroot/**/*.*" TargetPath="$(WasmRuntimeAssetsLocation)/%(FileName)%(Extension)" /> |
<WasmExtraFilesToDeploy Condition="'$(WasmRuntimeAssetsLocation)' == ''" Include="$(MSBuildThisFileDirectory)/../staticwebassets/**/*.*" /> |
||||
|
<WasmExtraFilesToDeploy Condition="'$(WasmRuntimeAssetsLocation)' != ''" Include="$(MSBuildThisFileDirectory)/../staticwebassets/**/*.*" TargetPath="$(WasmRuntimeAssetsLocation)/%(FileName)%(Extension)" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
<PropertyGroup Condition="'$(ShouldIncludeNativeSkiaSharp)' == 'True' or '$(ShouldIncludeNativeHarfBuzzSharp)' == 'True'"> |
<PropertyGroup Condition="'$(ShouldIncludeNativeSkiaSharp)' == 'True' or '$(ShouldIncludeNativeHarfBuzzSharp)' == 'True'"> |
||||
@ -0,0 +1,22 @@ |
|||||
|
<Project> |
||||
|
<PropertyGroup> |
||||
|
<_AvaloniaWebAssetsFolder>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../staticwebassets/))</_AvaloniaWebAssetsFolder> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup Condition="'$(ShouldIncludeAvaloniaStaticAssets)' == 'True'"> |
||||
|
<!-- This file repricates how StaticWebAsset SDK generates static web assets for Blazor nuget packages, which we don't use here. --> |
||||
|
<_AvaloniaWebAssets Include="$(_AvaloniaWebAssetsFolder)**/*.*" /> |
||||
|
<StaticWebAsset Include="@(_AvaloniaWebAssets)"> |
||||
|
<SourceType>Package</SourceType> |
||||
|
<SourceId>Avalonia.Browser</SourceId> |
||||
|
<ContentRoot>$(_AvaloniaWebAssetsFolder)</ContentRoot> |
||||
|
<BasePath>/</BasePath> |
||||
|
<RelativePath>$(WasmRuntimeAssetsLocation)/%(FileName)%(Extension)</RelativePath> |
||||
|
<AssetKind>All</AssetKind> |
||||
|
<AssetMode>All</AssetMode> |
||||
|
<AssetRole>Primary</AssetRole> |
||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
||||
|
<OriginalItemSpec>$(_AvaloniaWebAssetsFolder)%(FileName)%(Extension)</OriginalItemSpec> |
||||
|
</StaticWebAsset> |
||||
|
</ItemGroup> |
||||
|
</Project> |
||||
Loading…
Reference in new issue