Skip to content

Commit

Permalink
Merge pull request #81 from taublast/2-A
Browse files Browse the repository at this point in the history
1.2.3.4
  • Loading branch information
taublast authored Jul 4, 2024
2 parents f0c8fd4 + 357651a commit b3b2db2
Show file tree
Hide file tree
Showing 63 changed files with 2,314 additions and 1,007 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ https://github.com/taublast/DrawnUi.Maui/assets/25801194/3b360229-ce3b-4d33-a85b

## What's new

* `SkiaLayout` Column/Row uses 2 layout passes when needed, can now use full alignement options inside.
* Critical fixes for Release builds.
* `SkiaScroll` fixed scrolling vertically + horizontally at the same time (`Orientation="Both"`).
* `SkiaShell` Navigated and Navigating events now report popups too.
* `SkiaMediaImage` a subclassed `SkiaImage` for displaying any kind of images (image/animated gif/more..)
* `SkiaGif` a dedicated lightweight GIF-player with playback control properties. See Sandbox project.
* Fixed gestures inside `ImageCacheComposite` cache.
* Fixed bug `SkiaShell` navigation gets locked when spamming popups.
* Layout optimizations.
* Nuget 1.2.3.4

## Demo Apps

Expand Down Expand Up @@ -68,7 +74,8 @@ ___Please star ⭐ if you like it!___
* __SkiaTabsSelector__ create top and bottom tabs
* __SkiaViewSwitcher__ switch your views, pop, push and slide
* __SkiaLottie__ with tint customization
* __SkiaGif__ _soon_
* __SkiaGif__ a dedicated lightweight GIF-player with playback properties
* __SkiaMediaImage__ a subclassed `SkiaImage` for displaying any kind of images (image/animated gif/more..)
* __SkiaRive__ (actually Windows only)
* __SkiaButton__ include anything inside, text, images etc
* __SkiaSlider__ incuding range selction capability
Expand Down Expand Up @@ -588,6 +595,9 @@ It will render a mask over its children when hovered, think of it as an inverted

## Previously

* `SkiaLayout` Column/Row uses 2 layout passes when needed, can now use full alignment options inside.
* Critical fixes for Release builds.

* New: SvgSpan for SkiaLabel.
* Critical fix for Release builds native crash while using ImageDoubleBuffered cache.
* Fixes for: gestures, SkiaMarkdownLabel, SkiaDrawer, SkiaLayout, Canvas and more.
Expand Down
4 changes: 2 additions & 2 deletions dev/uploadnugets.bat → dev/github_uploadnugets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ REM Define the source directory for the packages
set "source_dir=E:\Nugets"

REM Define the file mask for the packages
set "file_mask=DrawnUi.Maui*.1.2.3.3*.nupkg"
REM set "file_mask=AppoMobi.Maui.DrawnUi.1.2.3.3*.*nupkg"
REM set "file_mask=DrawnUi.Maui*.1.2.3.3*.nupkg"
set "file_mask=AppoMobi.Maui.DrawnUi.1.2.3.3*.*nupkg"

REM Loop through each package file in the source directory
for %%f in ("%source_dir%\%file_mask%") do (
Expand Down
33 changes: 33 additions & 0 deletions dev/nuget_uploadnugets.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@echo off
setlocal enabledelayedexpansion

REM Check if API key is provided as a parameter
if "%~1"=="" (
REM Ask for API key
set /p "APIKEY=Please enter your GitHub API key: "
) else (
set "APIKEY=%~1"
)

REM Define the source directory for the packages
set "source_dir=E:\Nugets"

REM Define the file mask for the packages
set "file_mask=DrawnUi.Maui*.1.2.3.4*.nupkg"
REM set "file_mask=AppoMobi.Maui.DrawnUi.1.2.3.4*.*nupkg"

REM Loop through each package file in the source directory
for %%f in ("%source_dir%\%file_mask%") do (
echo Uploading %%f to NUGET.ORG with API key.
nuget push %%f -Source https://api.nuget.org/v3/index.json -ApiKey %APIKEY%
if errorlevel 1 (
echo An error occurred while uploading %%f.
) else (
echo %%f uploaded successfully.
)
)

pause
endlocal


4 changes: 3 additions & 1 deletion src/Addons/DrawnUi.Maui.Camera/DrawnUi.Maui.Camera.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
</PropertyGroup>

<PropertyGroup>

<UseNuget>false</UseNuget>

<PackageReleaseNotes>Using SkiaSharp 2.xx. Checkout the DrawnUi demo repository for usage example. Currently only Android is implemented, iOS will be too when i have time.</PackageReleaseNotes>
<Title>Camera addon to DrawnUI for .NET MAUI</Title>
<PackageId>DrawnUi.Maui.Camera</PackageId>
Expand Down Expand Up @@ -41,7 +43,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.2.7" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.3.4" />
</ItemGroup>

</Project>
8 changes: 0 additions & 8 deletions src/Addons/DrawnUi.Maui.Camera/SkiaCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,6 @@ protected override void Paint(SkiaDrawingContext ctx, SKRect destination, float
FrameAquired = true;
OnNewFrameSet(Display.SetImageInternal(image.Image));
}
else
{
Debug.WriteLine("[SkiaCamera] No image");
// just display the previous frame if any
// commented out below, left for reference
//if (Display.LoadedSource != null)
// Display.SetImageInternal(null);
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/Addons/DrawnUi.Maui.Game/DrawnUi.Maui.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.2.7" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.3.4" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.2.7" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.3.4" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Addons/DrawnUi.Maui.Rive/DrawnUi.Maui.Rive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.2.7" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.3.4" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.2.7" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.3.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup Condition="'$(UseSkiaSharp3)' != 'true'">
<PackageReleaseNotes>Using SkiaSharp 2.xx. Checkout the DrawnUi Sandbox project for usage example.</PackageReleaseNotes>
<Version>1.2.3.3</Version>
<Version>1.2.3.4</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(UseSkiaSharp3)' == 'true'">
Expand Down
4 changes: 3 additions & 1 deletion src/DrawnUi.Maui-dev.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EEA7F62-9878-451E-A506-28AB7C5DEEB8}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
..\dev\github_uploadnugets.bat = ..\dev\github_uploadnugets.bat
..\dev\movenugets.bat = ..\dev\movenugets.bat
..\dev\nuget_uploadnugets.bat = ..\dev\nuget_uploadnugets.bat
..\README.md = ..\README.md
ToDo.txt = ToDo.txt
..\dev\uploadnugets.bat = ..\dev\uploadnugets.bat
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawnUi.Maui", "Engine\DrawnUi.Maui.csproj", "{D76B6239-94A0-482C-A0FF-A764017B7393}"
Expand Down
10 changes: 5 additions & 5 deletions src/Engine/Controls/Carousel/SkiaCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ protected override bool ScrollToOffset(Vector2 targetOffset, Vector2 velocity, b
if (Bounces)
{
var spring = new Spring((float)(1 * (1 + RubberDamping)), 200, (float)(0.5f * (1 + RubberDamping)));
_animatorSpring.Initialize(end, displacement, velocity, spring, 0.5f);
_animatorSpring.Start();
VectorAnimatorSpring.Initialize(end, displacement, velocity, spring, 0.5f);
VectorAnimatorSpring.Start();
}
else
{
Expand Down Expand Up @@ -578,9 +578,9 @@ void Init()
{


if (_animatorSpring == null)
if (VectorAnimatorSpring == null)
{
_animatorSpring = new(this)
VectorAnimatorSpring = new(this)
{
OnStart = () =>
{
Expand Down Expand Up @@ -1118,7 +1118,7 @@ void ResetPan()
IsUserFocused = true;
IsUserPanning = false;

_animatorSpring?.Stop();
VectorAnimatorSpring?.Stop();

VelocityAccumulator.Clear();

Expand Down
6 changes: 3 additions & 3 deletions src/Engine/Controls/Drawer/SkiaDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ void Init()
{
CurrentSnap = new(-1, -1);

if (_animatorSpring == null)
if (VectorAnimatorSpring == null)
{
_animatorSpring = new(this)
VectorAnimatorSpring = new(this)
{
OnStart = () =>
{
Expand Down Expand Up @@ -613,7 +613,7 @@ void ResetPan()
IsUserFocused = true;
IsUserPanning = false;

_animatorSpring.Stop();
VectorAnimatorSpring.Stop();
VelocityAccumulator.Clear();

_panningOffset = new((float)TranslationX, (float)TranslationY);
Expand Down
10 changes: 8 additions & 2 deletions src/Engine/Controls/Labels/SkiaMarkdownLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,12 @@ protected virtual void AddTextSpan(string text, Action<TextSpan> modifySpan = nu
var currentIndex = 0;
var spanStart = 0;
var spanData = new List<(string Text, SKTypeface Typeface, int Symbol, bool shape)>();
SKTypeface originalTypeFace = TypeFace;
var originalTypeFace = TypeFace;
if (originalTypeFace == null)
{
originalTypeFace = SKTypeface.Default;
}

SKTypeface currentTypeFace = originalTypeFace;
bool needShape = false;

Expand Down Expand Up @@ -429,7 +434,8 @@ void BreakSpanAndSwitchTypeface(SKTypeface newTypeface)
}
}
//maybe switch back to original font if possible
else if (!isStandardSymbol && currentTypeFace != originalTypeFace)
else
if (!isStandardSymbol && currentTypeFace != originalTypeFace)
{
var glyphInOriginal = SkiaLabel.GetGlyphs(glyphText, originalTypeFace).First();
if (glyphInOriginal.IsAvailable)
Expand Down
8 changes: 8 additions & 0 deletions src/Engine/Controls/Navigation/NavigationSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace DrawnUi.Maui.Controls;

public enum NavigationSource
{
Unknown,
Push,
Pop
}
29 changes: 25 additions & 4 deletions src/Engine/Controls/Navigation/SkiaShell.PopupWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,33 @@ public async Task CloseAsync()
{
if (Content != null && _animated && IsVisibleInViewTree())
{
await Task.WhenAll(
Content.FadeToAsync(0, PopupsAnimationSpeed),
Content.ScaleToAsync(0, 0, PopupsAnimationSpeed));
var cts = new CancellationTokenSource();
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(3), cts.Token);

try
{
var animate = Task.WhenAll(
Content.FadeToAsync(0, PopupsAnimationSpeed, null, cts),
Content.ScaleToAsync(0, 0, PopupsAnimationSpeed, null, cts));

var completedTask = await Task.WhenAny(animate, timeoutTask);
if (completedTask == timeoutTask)
{
await cts.CancelAsync();
}
}
catch (Exception e)
{
Super.Log(e);
}
finally
{
cts.Dispose();
}

await _shell.Popups.Close(this, _animated);
}

await _shell.Popups.Close(this, _animated);
}

protected override void OnLayoutReady()
Expand Down
Loading

0 comments on commit b3b2db2

Please sign in to comment.