mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Add reverse support for canonical instances
This commit is contained in:
@@ -8,7 +8,7 @@ using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
public class RelativeTo
|
||||
public class RelativeTo : IHasCanonicalInstances
|
||||
{
|
||||
private IAnimatable _sourceObject;
|
||||
private int _sourceId;
|
||||
@@ -125,6 +125,12 @@ namespace Microsoft.Iris.Animations
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return GetCanonicalName()
|
||||
?? $"[Object = {_sourceObject ?? (object)_sourceId}, Property = {_sourceProperty}]";
|
||||
}
|
||||
|
||||
public string GetCanonicalName()
|
||||
{
|
||||
if (this == s_absolute)
|
||||
return "Absolute";
|
||||
@@ -132,7 +138,10 @@ namespace Microsoft.Iris.Animations
|
||||
return "Current";
|
||||
if (this == s_currentSnapshotOnLoop)
|
||||
return "CurrentSnapshotOnLoop";
|
||||
return this == s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", _sourceObject != null ? _sourceObject : (object)_sourceId, _sourceProperty);
|
||||
if (this == s_final)
|
||||
return "Final";
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using Microsoft.Iris.Library;
|
||||
|
||||
namespace Microsoft.Iris.Layouts
|
||||
{
|
||||
internal class DockLayoutInput : ILayoutInput, IStringEncodable
|
||||
internal class DockLayoutInput : ILayoutInput, IStringEncodable, IHasCanonicalInstances
|
||||
{
|
||||
public static readonly DockLayoutInput Left = new DockLayoutInput();
|
||||
public static readonly DockLayoutInput Top = new DockLayoutInput();
|
||||
@@ -35,12 +35,17 @@ namespace Microsoft.Iris.Layouts
|
||||
return "Top";
|
||||
if (this == Right)
|
||||
return "Right";
|
||||
return this == Bottom ? "Bottom" : "Client";
|
||||
if (this == Bottom)
|
||||
return "Bottom";
|
||||
|
||||
return "Client";
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => InvariantString.Format("{0}(Position={1})", GetType().Name, PositionString);
|
||||
|
||||
public string EncodeString() => PositionString;
|
||||
|
||||
public string GetCanonicalName() => PositionString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Microsoft.Iris.Layouts
|
||||
{
|
||||
internal class PlacementMode
|
||||
internal class PlacementMode : IHasCanonicalInstances
|
||||
{
|
||||
private PopupPosition[] _popupPositions;
|
||||
private MouseTarget _mouseTarget;
|
||||
@@ -50,7 +50,9 @@ namespace Microsoft.Iris.Layouts
|
||||
|
||||
internal bool UsesTargetSize => _usesTargetSize;
|
||||
|
||||
public override string ToString()
|
||||
public override string ToString() => GetCanonicalName() ?? base.ToString();
|
||||
|
||||
public string GetCanonicalName()
|
||||
{
|
||||
if (this == s_origin)
|
||||
return "Origin";
|
||||
@@ -70,7 +72,10 @@ namespace Microsoft.Iris.Layouts
|
||||
return "MouseBottom";
|
||||
if (this == s_followMouseOrigin)
|
||||
return "FollowMouseOrigin";
|
||||
return this == s_followMouseBottom ? "FollowMouseBottom" : base.ToString();
|
||||
if (this == s_followMouseBottom)
|
||||
return "FollowMouseBottom";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PlacementMode Origin
|
||||
|
||||
@@ -93,6 +93,8 @@ namespace Microsoft.Iris.Markup
|
||||
|
||||
public abstract bool SupportsBinaryEncoding { get; }
|
||||
|
||||
public virtual bool SupportsCanonicalInstance => false;
|
||||
|
||||
public abstract object PerformOperation(object left, object right, OperationType op);
|
||||
|
||||
public abstract bool SupportsOperation(OperationType op);
|
||||
|
||||
@@ -234,6 +234,8 @@ namespace Microsoft.Iris.Markup
|
||||
|
||||
public override bool SupportsBinaryEncoding => _encodeBinary != null;
|
||||
|
||||
public override bool SupportsCanonicalInstance => _findCanonicalInstance != null;
|
||||
|
||||
public override int FindTypeHint => _typeID;
|
||||
|
||||
public override object PerformOperation(object left, object right, OperationType op)
|
||||
|
||||
Reference in New Issue
Block a user