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

Create custom label clickeable #279

Closed elgransan closed 1 year ago

elgransan commented 1 year ago

Hi I'm trying to create a buttom as label the button is rendered but in position 0,0 and it's not moving when I move a related node

widget image

model image

registering Diagram.RegisterModelComponent<SelectorLinkLabel, SelectorLinkLabelWidget>();

using it

       var link1 = new LinkModel(node1, node2)
            {
                TargetMarker = LinkMarker.Arrow
            };
        link1.Labels.Add(new SelectorLinkLabel(link1));
        Diagram.Links.Add(link1);

Any idea what it's wrong?

elgransan commented 1 year ago

Ok I solve more or less positioning with Invariant Culture (the positioning it's not perfect) image

but I still can't click the button

zHaytam commented 1 year ago

Hello, what version are you using please?

elgransan commented 1 year ago

Version 2.1.6

This is how it looks right now

image

zHaytam commented 1 year ago

Can you try adding pointer-events: all; to your button or maybe even the foreignObject?

elgransan commented 1 year ago

I also tried to do it with extra nodes like this image

But, It feels more natural to be a label

elgransan commented 1 year ago

It works on both, on foreignObject tag or directly on button, thanks

And It's possible to have the label over the link path instead of behind?

elgransan commented 1 year ago

image

Ok, it's solved, I need to add the translate transform and the background color couldn't be transparent

Thanks