Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BorderForMouseOver of Line control is not displayed at correct position #115

Closed
YuuukiA opened this issue Sep 12, 2024 · 2 comments
Closed

Comments

@YuuukiA
Copy link
Contributor

YuuukiA commented Sep 12, 2024

For Line control, BorderForMouseOver is not displayed at correct position.
Would you please tell me how to fix it?

When I draw Line control from the top left to the bottom right, the border is displayed at correct position.
image

When I draw Line control from the top right to the bottom left, the border is not displayed at correct position.
image

@YuuukiA
Copy link
Contributor Author

YuuukiA commented Oct 1, 2024

I have avoided it by modifying BorderForMouseOver.cs as the following.

public class BorderForMouseOver : AdornerProvider
{
  readonly AdornerPanel adornerPanel;
  private readonly Border _border = new Border();

  public BorderForMouseOver()
  {
    adornerPanel = new AdornerPanel();
    adornerPanel.Order = AdornerOrder.Background;
    this.Adorners.Add(adornerPanel);
    _border.BorderThickness = new Thickness(1);
    _border.BorderBrush = Brushes.DodgerBlue;
    _border.Margin = new Thickness(-2);
    AdornerPanel.SetPlacement(_border, AdornerPlacement.FillContent);
    adornerPanel.Children.Add(_border);
  }

  protected override void OnInitialized()
  {
      base.OnInitialized();

      if (ExtendedItem.Component is Line line)
      {
          // To display border of Line in correct position.
          _border.Margin = new Thickness
          {
              Left = line.X2 < 0 ? line.X2 : 0,
              Top = line.Y2 < 0 ? line.Y2 : 0
          };
      }
  }
}

@jogibear9988
Copy link
Member

Could you create a pull req?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants