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

Is it possible to disable the function that lets you click on an object and link it to another? #82

Closed
Clive321A opened this issue Apr 27, 2021 · 5 comments

Comments

@Clive321A
Copy link

Clive321A commented Apr 27, 2021

basically im trying to stop the user from accidently clicking the Diagram and drawing a line, in our use case adding new connectors shouldnt be possible, but I cant see how to disable that functionality?

image

@stefanloerwald
Copy link
Member

Hi @CliveBennett,

yes, this is possible! Just disable AllowFreeFloatingLinks on Links:

<Diagram>
   <Nodes>
      ...
   </Nodes>
   <Links AllowFreeFloatingLinks="false">
      ...
   </Links>
</Diagram>

Hope that helps,
Stefan

@Clive321A
Copy link
Author

Clive321A commented Apr 27, 2021

Thanks, yes I did try that option before, but it still lets me click and draw lines,

    My whole Diagram is this
    
    <Diagram @ref="masterDiagram">
    <Nodes>
        @{double nodex = 0;}
        @{double nodey = 0;}


        @foreach (var node in FamilyDiagramNode.RectangleNodes)
        {
           
            <RectangleNode Id="@node.NodeId" >
                @foreach (var q in node.Data)
                {
                    <div>@((MarkupString)q)</div>
                }
            </RectangleNode>

        }

    </Nodes>

    <Links AllowFreeFloatingLinks="false">
        @foreach (var lnk in FamilyDiagramNode.DiagramLinks)
        {
            <Link Source="lnk.Source" Target="lnk.Target" Arrow="Arrow.Target" Type="link_type" />

        }
    </Links>
    <NavigationSettings DisableZooming="false" />
    <AutoLayoutSettings Algorithm="SelectAutoScale.AutoScaleAlgorithm" @ref="autoLayout" />
    <OverviewSettings Position="Position.BottomRight" />

</Diagram>

@stefanloerwald
Copy link
Member

I'm surprised it wouldn't disallow free-floating links, because the code looks fine to me:

if (node == null && !link.Links.AllowFreeFloatingLinks)

Could you please clarify which clicks are performed by the user and where your expectation of the behavior differs from the observed behavior?

@stefanloerwald
Copy link
Member

Not sure whether I understood your question right in the first place. If you want to disable user-generated links entirely, see here: #79 (comment)

@Clive321A
Copy link
Author

Ah perfect, yes thats the exactly what I was after, thanks for your help.

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