Skip to content

Commit

Permalink
Merge pull request #69 from rhyskoedijk/feature/menu-anchor-type-loca…
Browse files Browse the repository at this point in the history
…tion

Allow location based Menu anchoring
  • Loading branch information
skclusive authored Nov 4, 2020
2 parents a3b8d58 + 15d3bf6 commit ffc4553
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Menu/src/Menu/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Components.Web;
using Skclusive.Core.Component;
using Skclusive.Material.Core;
using Skclusive.Material.Popover;

namespace Skclusive.Material.Menu
{
Expand Down Expand Up @@ -157,6 +158,42 @@ public MenuComponent() : base("Menu")
[Parameter]
public VerticalOrigin TransformVerticalOrigin { set; get; } = VerticalOrigin.Top;

/// <summary>
/// This is the point on the menu which will attach to the anchor's horizontal origin.
/// </summary>
[Parameter]
public double? TransformHorizontalOriginValue { set; get; }

/// <summary>
/// This is the point on the menu which will attach to the anchor's vertical origin.
/// </summary>
[Parameter]
public double? TransformVerticalOriginValue { set; get; }

/// <summary>
/// This is the position that may be used
/// to set the left position of the menu.
/// The coordinates are relative to
/// the application's client area.
/// </summary>
[Parameter]
public double AnchorLeft { set; get; }

/// <summary>
/// This is the position that may be used
/// to set the top position of the menu.
/// The coordinates are relative to
/// the application's client area.
/// </summary>
[Parameter]
public double AnchorTop { set; get; }

/// <summary>
/// This determines which anchor prop to refer to when setting the position of the menu.
/// </summary>
[Parameter]
public AnchorType AnchorType { set; get; } = AnchorType.Element;

/// <summary>
/// Callback fired before the Menu enters.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Menu/src/Menu/Menu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
AnchorHorizontalOrigin="@AnchorHorizontalOrigin"
TransformVerticalOrigin="@TransformVerticalOrigin"
TransformHorizontalOrigin="@TransformHorizontalOrigin"
TransformHorizontalOriginValue="@TransformHorizontalOriginValue"
TransformVerticalOriginValue="@TransformVerticalOriginValue"
AnchorLeft="@AnchorLeft"
AnchorTop="@AnchorTop"
AnchorType="@AnchorType"
TransitionDuration="@TransitionDuration"
AppearTimeout="@AppearTimeout"
EnterTimeout="@EnterTimeout"
Expand Down
2 changes: 1 addition & 1 deletion Popover/src/Popover/Popover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public PopoverComponent() : base("Popover")
public double AnchorTop { set; get; }

/// <summary>
/// This determines which anchor prop to refer to to setvthe position of the popover.
/// This determines which anchor prop to refer to when setting the position of the popover.
/// </summary>
[Parameter]
public AnchorType AnchorType { set; get; } = AnchorType.Element;
Expand Down

0 comments on commit ffc4553

Please sign in to comment.