fix(module: tooltip): wrong popup direction (#1348)

This commit is contained in:
James Yeung 2021-04-15 12:20:48 +08:00 committed by GitHub
parent 9ff708eb31
commit f4a3b60047
2 changed files with 20 additions and 10 deletions

View File

@ -94,7 +94,7 @@ namespace AntDesign.Internal
{
get
{
return _placement;
return RTL ? _placement.GetRTLPlacement() : _placement;
}
set
{
@ -151,14 +151,6 @@ namespace AntDesign.Internal
protected Overlay _overlay = null;
private ElementReference _triggerReference;
public override Task SetParametersAsync(ParameterView parameters)
{
_paramPlacement = RTL ? PlacementType.BottomRight : PlacementType.BottomLeft;
_placement = RTL ? PlacementType.BottomRight : PlacementType.BottomLeft;
return base.SetParametersAsync(parameters);
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
@ -352,7 +344,7 @@ namespace AntDesign.Internal
protected virtual void OnMouseUp(JsonElement element)
{
if (_mouseInOverlay == false && _mouseInTrigger == false && Visible)
if (_mouseInOverlay == false && _mouseInTrigger == false)
{
if (OnMaskClick.HasDelegate)
{

View File

@ -77,5 +77,23 @@
return PlacementDirection.Bottom;
}
internal PlacementType GetRTLPlacement()
{
if (this == TopLeft) return TopRight;
if (this == TopRight) return TopLeft;
if (this == Left) return Right;
if (this == LeftTop) return RightTop;
if (this == LeftBottom) return RightBottom;
if (this == Right) return Left;
if (this == RightTop) return LeftTop;
if (this == RightBottom) return LeftBottom;
if (this == BottomLeft) return BottomRight;
if (this == BottomRight) return BottomLeft;
return this;
}
}
}