зеркало из https://github.com/DeGsoft/maui-linux.git
Merge branch '4.2.0' into 4.3.0
This commit is contained in:
Коммит
5d1ef547f0
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 5395, "[macOs] Image Rotation issue", PlatformAffected.macOS)]
|
||||
public class Issue5395 : ContentPage
|
||||
{
|
||||
public Issue5395()
|
||||
{
|
||||
var sl = new StackLayout() { Orientation = StackOrientation.Vertical };
|
||||
|
||||
sl.Children.Add(new Label() { Text = "Image should rotate clockwise around its center" });
|
||||
sl.Children.Add(new TestImage(0.5, 0.5, true, false));
|
||||
|
||||
sl.Children.Add(new Label() { Text = "Image should rotate clockwise around its top left corner" });
|
||||
sl.Children.Add(new TestImage(0, 0, true, false));
|
||||
|
||||
sl.Children.Add(new Label() { Text = "Image should rotate clockwise around its top right corner" });
|
||||
sl.Children.Add(new TestImage(1, 0, true, false));
|
||||
|
||||
sl.Children.Add(new Label() { Text = "Image should rotate clockwise around its bottom right corner" });
|
||||
sl.Children.Add(new TestImage(1, 1, true, false));
|
||||
|
||||
sl.Children.Add(new Label() { Text = "Image should scale on its center" });
|
||||
sl.Children.Add(new TestImage(0.5, 0.5, false, true));
|
||||
|
||||
Content = sl;
|
||||
}
|
||||
class TestImage : Image
|
||||
{
|
||||
public TestImage(double anchorx, double anchory, bool rotate, bool scale)
|
||||
{
|
||||
VerticalOptions = HorizontalOptions = LayoutOptions.Center;
|
||||
Aspect = Aspect.AspectFit;
|
||||
Source = "bank.png";
|
||||
WidthRequest = 30;
|
||||
HeightRequest = 30;
|
||||
BackgroundColor = Color.Red;
|
||||
AnchorX = anchorx;
|
||||
AnchorY = anchory;
|
||||
//TranslationX = -50;
|
||||
//TranslationY = 25;
|
||||
if (rotate)
|
||||
{
|
||||
this.RotateTo(3600, 10000);
|
||||
}
|
||||
if (scale)
|
||||
{
|
||||
this.ScaleTo(2, 4000);
|
||||
}
|
||||
Margin = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 7283, "[Android] Crash changing the Application MainPage",
|
||||
PlatformAffected.Android)]
|
||||
#if UITEST
|
||||
[NUnit.Framework.Category(UITestCategories.ManualReview)]
|
||||
#endif
|
||||
public class Issue7283 : TestContentPage
|
||||
{
|
||||
public Issue7283()
|
||||
{
|
||||
Title = "Issue 7283";
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
var layout = new StackLayout
|
||||
{
|
||||
Padding = new Thickness(12)
|
||||
};
|
||||
|
||||
var instructions = new Label
|
||||
{
|
||||
Text = "Press the Button below. If navigate without any errors, the test has passed."
|
||||
};
|
||||
|
||||
var navigateButton = new Button
|
||||
{
|
||||
Text = "Navigate"
|
||||
};
|
||||
|
||||
navigateButton.Clicked += async (sender, e) =>
|
||||
{
|
||||
navigateButton.IsEnabled = false;
|
||||
|
||||
await Task.Delay(2000);
|
||||
var navigation = new NavigationPage();
|
||||
Application.Current.MainPage = navigation;
|
||||
await Application.Current.MainPage.Navigation.PushAsync(new ContentPage { Title = "Did I crash?" });
|
||||
};
|
||||
|
||||
layout.Children.Add(instructions);
|
||||
layout.Children.Add(navigateButton);
|
||||
|
||||
Content = layout;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1084,6 +1084,8 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue7678.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue6491.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue6127.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7283.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue5395.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
|
||||
|
|
|
@ -643,7 +643,9 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
|
||||
if (_masterDetailPage == null)
|
||||
{
|
||||
_masterDetailPage = PageController.InternalChildren[0] as MasterDetailPage;
|
||||
if (PageController.InternalChildren.Count > 0)
|
||||
_masterDetailPage = PageController.InternalChildren[0] as MasterDetailPage;
|
||||
|
||||
if (_masterDetailPage == null)
|
||||
return;
|
||||
}
|
||||
|
@ -1025,7 +1027,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
if (!textColor.IsDefault)
|
||||
bar.SetTitleTextColor(textColor.ToAndroid().ToArgb());
|
||||
|
||||
bar.Title = currentPage.Title ?? "";
|
||||
bar.Title = currentPage?.Title ?? string.Empty;
|
||||
|
||||
UpdateTitleIcon();
|
||||
|
||||
|
@ -1035,6 +1037,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
void UpdateTitleIcon()
|
||||
{
|
||||
Page currentPage = Element.CurrentPage;
|
||||
|
||||
if (currentPage == null)
|
||||
return;
|
||||
|
||||
ImageSource source = NavigationPage.GetTitleIconImageSource(currentPage);
|
||||
|
||||
if (source == null || source.IsEmpty)
|
||||
|
@ -1072,6 +1078,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
return;
|
||||
|
||||
Page currentPage = Element.CurrentPage;
|
||||
|
||||
if (currentPage == null)
|
||||
return;
|
||||
|
||||
VisualElement titleView = NavigationPage.GetTitleView(currentPage);
|
||||
if (_titleViewRenderer != null)
|
||||
{
|
||||
|
|
|
@ -259,19 +259,35 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
#if __MOBILE__
|
||||
caLayer.AnchorPoint = new PointF(anchorX, anchorY);
|
||||
#else
|
||||
caLayer.AnchorPoint = new PointF(anchorX - 0.5f, anchorY - 0.5f);
|
||||
#if !__MOBILE__
|
||||
// Y-axe on macos is inverted
|
||||
translationY = -translationY;
|
||||
anchorY = 1 - anchorY;
|
||||
|
||||
// rotation direction on macos also inverted
|
||||
rotationX = -rotationX;
|
||||
rotationY = -rotationY;
|
||||
rotation = -rotation;
|
||||
|
||||
//otherwise scaled/rotated image clipped by parent bounds
|
||||
caLayer.MasksToBounds = false;
|
||||
#endif
|
||||
caLayer.AnchorPoint = new PointF(anchorX, anchorY);
|
||||
caLayer.Opacity = opacity;
|
||||
const double epsilon = 0.001;
|
||||
|
||||
#if !__MOBILE__
|
||||
// fix position, position in macos is aslo relative to anchor point
|
||||
// but it's (0,0) by default, so we don't need to substract 0.5
|
||||
transform = transform.Translate(anchorX * width, 0, 0);
|
||||
transform = transform.Translate(0, anchorY * height, 0);
|
||||
#else
|
||||
// position is relative to anchor point
|
||||
if (Math.Abs(anchorX - .5) > epsilon)
|
||||
transform = transform.Translate((anchorX - .5f) * width, 0, 0);
|
||||
if (Math.Abs(anchorY - .5) > epsilon)
|
||||
transform = transform.Translate(0, (anchorY - .5f) * height, 0);
|
||||
#endif
|
||||
|
||||
if (Math.Abs(translationX) > epsilon || Math.Abs(translationY) > epsilon)
|
||||
transform = transform.Translate(translationX, translationY, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче