Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
919 stars 176 forks source link

The MudBlazor menu appears in the top left corner of the container when right clicking on a node component (2) #323

Open mrakgr opened 1 year ago

mrakgr commented 1 year ago

I have a MudBlazor menu that is using DiagramCanvas as an activation context which gets triggered on a right click. This works fine when I click on an empty space on a canvas and I've even made it so that I can add nodes using that opened menu. But when I right click on a node, the menu doesn't appear at cursor, but in top left corner instead. Maybe it is getting passed null as the position? Would it be possible to fix that?

https://github.com/Blazor-Diagrams/Blazor.Diagrams/assets/6266635/37f3fd9b-64bc-456f-8ff9-fe8bf704c2a1

mrakgr commented 1 year ago

Repo: https://github.com/mrakgr/helix/tree/zoom-error

zHaytam commented 1 year ago

For some reason the video doesn't work for me. I will try the repository later

mrakgr commented 1 year ago

Strange, it does for me. Maybe you could try a different browser?

mrakgr commented 1 year ago

You can see it in this Youtube video at the specified mark. I'll be using Blazor.Diagrams for the project I am doing so check it out!

zHaytam commented 1 year ago

Where is the part where you configure the context menu in MudBlazor?

mrakgr commented 1 year ago

I only used Blazor for the last third of the video, so a minute or two before the mark I linked to you. During the first 2/3rds I've been trying out Bolero before switching to Blazor and redoing the whole project from scratch as it was too difficult to do UI work in Bolero.

Link: https://github.com/mrakgr/helix/blob/zoom-error/Pages/DiagramTrial.razor

Everything related to Blazor.Diagrams is in this page, the rest are still just the template code.

314159265meow commented 1 year ago

Hi, looking at the MudMenu Component they're using OffsetX/OffsetY from the mouse event to position their menu. That means when you click on a node, the relative coordinates to that node are used. You can see that when you click on different positions of the node.
I'm not sure what you can do about it, it doesn't look like there is a way you can change that easily.

mrakgr commented 1 year ago

I'll open an issue on the MudBlazor repo and ask them what they think.

zHaytam commented 1 year ago

I'll investigate this in the evening, thanks for all the information

pfh59 commented 9 months ago

hi @mrakgr same issue with Blazor Menu. Have you got a workaround or a fix?

mrakgr commented 9 months ago

@pfh59 I think what I did was not have it open when clicking on the node. I forgot how I did that by this point though.