forked from CommunityToolkit/Labs-Windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial port of code from TransitionHelper PR CommunityToolkit/Window…
…sCommunityToolkit#4338 (Still not compiling)
- Loading branch information
1 parent
4b607d7
commit a65b8b3
Showing
37 changed files
with
2,434 additions
and
682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
labs/TransitionHelper/samples/TransitionHelper.Samples/CustomTextScalingCalculator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Numerics; | ||
using Microsoft.Toolkit.Uwp.UI; | ||
using Microsoft.Toolkit.Uwp.UI.Animations.Helpers; | ||
|
||
namespace TransitionHelperExperiment.Samples; | ||
|
||
public sealed class CustomTextScalingCalculator : IScalingCalculator | ||
{ | ||
/// <inheritdoc/> | ||
public Vector2 GetScaling(UIElement source, UIElement target) | ||
{ | ||
var sourceTextElement = source?.FindDescendantOrSelf<TextBlock>(); | ||
var targetTextElement = target?.FindDescendantOrSelf<TextBlock>(); | ||
if (sourceTextElement is not null && targetTextElement is not null) | ||
{ | ||
var scale = targetTextElement.FontSize / sourceTextElement.FontSize; | ||
return new Vector2((float)scale); | ||
} | ||
|
||
return new Vector2(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
labs/TransitionHelper/samples/TransitionHelper.Samples/TransitionHelperCustomSample.xaml
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
labs/TransitionHelper/samples/TransitionHelper.Samples/TransitionHelperCustomSample.xaml.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.