To do this had to move Animatable to the bottom of the class hierarchy
to allow Transform to inherit from it.
This commit is contained in:
Steven Kirk 2014-12-16 03:29:28 +01:00
Родитель fc49f1588b
Коммит 2f7981f1cb
12 изменённых файлов: 36 добавлений и 27 удалений

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

@ -8,9 +8,8 @@ namespace Perspex.Animation
{
using System.Linq;
using System.Reactive.Linq;
using Perspex.Input;
public class Animatable : InputElement
public class Animatable : PerspexObject
{
private PropertyTransitions propertyTransitions;

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

@ -9,7 +9,6 @@ namespace Perspex.Animation
using System;
using System.Linq;
using System.Reactive.Linq;
using Perspex.Input;
using Perspex.Threading;
public static class Animate

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

@ -39,26 +39,6 @@
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Input\Perspex.Input.csproj">
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
<Name>Perspex.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Interactivity\Perspex.Interactivity.csproj">
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
<Name>Perspex.Interactivity</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Layout\Perspex.Layout.csproj">
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Perspex.Layout</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.SceneGraph\Perspex.SceneGraph.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Perspex.SceneGraph</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Styling\Perspex.Styling.csproj">
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
<Name>Perspex.Styling</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Animate.cs" />

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

@ -16,7 +16,7 @@ namespace Perspex.Controls
using Perspex.Styling;
using Splat;
public class Control : Animatable, IStyleable, IStyleHost
public class Control : InputElement, IStyleable, IStyleHost
{
public static readonly PerspexProperty<Brush> BackgroundProperty =
PerspexProperty.Register<Control, Brush>("Background");

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

@ -35,6 +35,10 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Perspex.Animation\Perspex.Animation.csproj">
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
<Name>Perspex.Animation</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
<Name>Perspex.Base</Name>

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

@ -35,6 +35,10 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Perspex.Animation\Perspex.Animation.csproj">
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
<Name>Perspex.Animation</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
<Name>Perspex.Base</Name>

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

@ -39,6 +39,10 @@
<Project>{415e048e-4611-4815-9cf2-d774e29079ac}</Project>
<Name>NGenerics</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Animation\Perspex.Animation.csproj">
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
<Name>Perspex.Animation</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
<Name>Perspex.Base</Name>

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

@ -60,6 +60,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Perspex.Animation\Perspex.Animation.csproj">
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
<Name>Perspex.Animation</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
<Name>Perspex.Base</Name>

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

@ -7,8 +7,9 @@
namespace Perspex.Media
{
using System;
using Perspex.Animation;
public abstract class Transform : PerspexObject, ITransform
public abstract class Transform : Animatable, ITransform
{
public event EventHandler Changed;

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

@ -35,6 +35,10 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Perspex.Animation\Perspex.Animation.csproj">
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
<Name>Perspex.Animation</Name>
</ProjectReference>
<ProjectReference Include="..\Perspex.Base\Perspex.Base.csproj">
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
<Name>Perspex.Base</Name>

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

@ -11,11 +11,12 @@ namespace Perspex
using System.Collections.Specialized;
using System.Linq;
using System.Reactive.Linq;
using Perspex.Animation;
using Perspex.Media;
using Perspex.Rendering;
using Splat;
public class Visual : PerspexObject, IVisual
public class Visual : Animatable, IVisual
{
public static readonly PerspexProperty<bool> ClipToBoundsProperty =
PerspexProperty.Register<Visual, bool>("ClipToBounds");

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

@ -466,6 +466,7 @@ namespace TestApplication
{
Rectangle rect1;
Rectangle rect2;
RotateTransform rotate;
Button button1;
var result = new TabItem
@ -501,7 +502,13 @@ namespace TestApplication
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Fill = Brushes.Coral,
RenderTransform = new RotateTransform(),
RenderTransform = (rotate = new RotateTransform
{
PropertyTransitions = new PropertyTransitions
{
RotateTransform.AngleProperty.Transition(500),
}
}),
PropertyTransitions = new PropertyTransitions
{
Rectangle.WidthProperty.Transition(300),
@ -525,10 +532,12 @@ namespace TestApplication
if (rect2.Width == 100)
{
rect2.Width = rect2.Height = 400;
rotate.Angle = 180;
}
else
{
rect2.Width = rect2.Height = 100;
rotate.Angle = 0;
}
};