feat(module: overlay): add offset parameter (#210)

* feat(module: overlay): add offset parameter

* feat: optimize
This commit is contained in:
笨木头 2020-06-11 12:28:38 +08:00 committed by GitHub
parent 4e490fdd26
commit 759c73e0aa

View File

@ -30,9 +30,22 @@ namespace AntDesign.Internal
[Parameter]
public int HideMillisecondsDelay { get; set; } = 100;
[Parameter]
public int WaitForHideAnimMilliseconds { get; set; } = 200;
/// <summary>
/// vertical offset between Trigger and Overlay, default is 4
/// </summary>
[Parameter]
public int VerticalOffset { get; set; } = 4;
/// <summary>
/// horizontal offset between Trigger and Overlay, default is 4
/// </summary>
[Parameter]
public int HorizontalOffset { get; set; } = 4;
private bool _hasAddOverlayToBody = false;
private bool _isPreventHide = false;
private bool _isChildOverlayShow = false;
@ -51,7 +64,6 @@ namespace AntDesign.Internal
private string _overlayStyle = "";
private string _overlayCls = "";
private const int OVERLAY_OFFSET = 4;
private const int ARROW_SIZE = 13;
private const int HORIZONTAL_ARROW_SHIFT = 13;
@ -266,11 +278,11 @@ namespace AntDesign.Internal
}
else if (Trigger.Placement.IsIn(PlacementType.BottomLeft, PlacementType.BottomCenter, PlacementType.Bottom, PlacementType.BottomRight))
{
top = triggerTop + triggerHeight + OVERLAY_OFFSET;
top = triggerTop + triggerHeight + VerticalOffset;
}
else if (Trigger.Placement.IsIn(PlacementType.TopLeft, PlacementType.TopCenter, PlacementType.Top, PlacementType.TopRight))
{
top = triggerTop - overlay.clientHeight - OVERLAY_OFFSET;
top = triggerTop - overlay.clientHeight - VerticalOffset;
}
return top;
@ -291,11 +303,11 @@ namespace AntDesign.Internal
if (Trigger.Placement.IsIn(PlacementType.Left, PlacementType.LeftTop, PlacementType.LeftBottom))
{
left = triggerLeft - overlay.clientWidth - OVERLAY_OFFSET;
left = triggerLeft - overlay.clientWidth - HorizontalOffset;
}
else if (Trigger.Placement.IsIn(PlacementType.Right, PlacementType.RightTop, PlacementType.RightBottom))
{
left = triggerLeft + triggerWidth + OVERLAY_OFFSET;
left = triggerLeft + triggerWidth + HorizontalOffset;
}
else if (Trigger.Placement.IsIn(PlacementType.BottomLeft, PlacementType.TopLeft))
{