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

Node sticks to cursor bug. #310

Closed TZBlockBuster closed 1 year ago

TZBlockBuster commented 1 year ago

When you have a <Select> Dropdown Menu inside a node and you open the dropdown and select something. Then the node is stuck to your Cursor and you have to reload the page in order to continue. While you are dragging there must be a check if you are still holding the mouse key. I guess... Would be awesome if this can be fixed.

zHaytam commented 1 year ago

Do you mean that if you select an item from the dropdown and you start moving your mouse, it will move the node? As if you clicked the node?

TZBlockBuster commented 1 year ago

Yes, it acts like you are constantly holding the mouse button and you can't click to deselect because the node follows your cursor and you are always over the drop-down menu, so you can just open it again, but it won't let you deselect it.

zHaytam commented 1 year ago

What version are you using?

TZBlockBuster commented 1 year ago

2.1.6 Is this issue solved in later version?

zHaytam commented 1 year ago

Can you show me the code of your node (html)?

TZBlockBuster commented 1 year ago
<div class="card VariableNode @(Node.Selected ? " selected" : "")">
    <div style="display: flex; flex-direction: row; align-items: center; margin-right: -11px;">
        <div class="card-body">
            <h5 class="card-title">Variable</h5>
            <div class="form-group">
                <input type="text" class="form-control" placeholder="Variable Ident" @bind="Node.VarName"/>
                <select class="form-select" style="margin-top: 5px; margin-bottom: 5px;" @bind="Node.VarType">
                    <option value="@VariableType.Static">Static</option>
                    <option value="@VariableType.Dynamic">Dynamic</option>
                </select>
                @if (Node.VarType == VariableType.Static)
                {
                    <input type="text" class="form-control" placeholder="Value" @bind="Node.VarValue"/>
                }
            </div>
        </div>
        <TextPortComponent Node="Node" Alignment="PortAlignment.Right"></TextPortComponent>
    </div>
</div>
zHaytam commented 1 year ago

Can you try:

<div class="card VariableNode @(Node.Selected ? " selected" : "")">
    <div style="display: flex; flex-direction: row; align-items: center; margin-right: -11px;">
        <div class="card-body">
            <h5 class="card-title">Variable</h5>
            <div class="form-group" @onmousedown:stopPropagation @onmousemove:stopPropagation>
                <input type="text" class="form-control" placeholder="Variable Ident" @bind="Node.VarName"/>
                <select class="form-select" style="margin-top: 5px; margin-bottom: 5px;" @bind="Node.VarType">
                    <option value="@VariableType.Static">Static</option>
                    <option value="@VariableType.Dynamic">Dynamic</option>
                </select>
                @if (Node.VarType == VariableType.Static)
                {
                    <input type="text" class="form-control" placeholder="Value" @bind="Node.VarValue"/>
                }
            </div>
        </div>
        <TextPortComponent Node="Node" Alignment="PortAlignment.Right"></TextPortComponent>
    </div>
</div>
TZBlockBuster commented 1 year ago

Oh thank you, it's working now!

zHaytam commented 1 year ago

Great, I will close this issue then!