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

Deleting the selected edge is not working #95

Open
chethan1095 opened this issue Oct 17, 2024 · 4 comments
Open

Deleting the selected edge is not working #95

chethan1095 opened this issue Oct 17, 2024 · 4 comments

Comments

@chethan1095
Copy link

chethan1095 commented Oct 17, 2024

Hi I have been trying to delete the connected edge between two nodes but using default backspace delete its not working.
Hers's the code for the same:-

component.html

` ```

```
          <div class="inline-row">
            <i class="bi bi-usb-symbol custom-icon"></i>
            &nbsp;&nbsp;&nbsp;
          </div>
          <p class="node-ip">{{ ctx.node.data.ip ? ctx.node.data.ip : ''}}</p>

          <span *ngIf="!ctx.node.data.ip" class="node-span">{{ ctx.node.data.text }}</span>
          <span *ngIf="ctx.node.data.ip" class="node-ip-span">{{ ctx.node.data.text }}</span>

          <handle type="source" position="right" />
          <handle type="target" position="left" />

        </div>
        <div class="inline-row" style="margin-left: 8rem;">
          <i class="bi bi-pencil" (click)="onNodeSelected(ctx.node.data)"></i>&nbsp;
          <i class="bi bi-trash" (click)="onDeleteNode(ctx.node.data)"></i>
        </div>

      </ng-template>

      <ng-template edge let-ctx>
        <svg:path selectable class="without-tab-index" [attr.d]="ctx.path()"
          [attr.stroke]="ctx.selected() ? '#0f4c75' : '#bbe1fa'" fill="none" stroke-width="4" tabindex="0"
          (keydown.backspace)="ctx.selected() && deleteEdge(ctx.edge)" />
      </ng-template>
    </vflow>

    <span *ngIf="nodes.length == 0">Drag and drop device here</span>

  </div>`

component.ts

deleteEdge(edge: Edge) { console.log(edge); this.edges = this.edges.filter(e => e.id !== edge.id) }

@artem-mangilev
Copy link
Owner

Hi! I would like to debug this thing, could you please create a stackblitz example for me?

I see the console.log(edge) in deleteEdge() method, does it called?

@chethan1095
Copy link
Author

No it's not triggering deleteEdge()

@artem-mangilev
Copy link
Owner

So the next guess would be that ctx.selected() returns false

@artem-mangilev
Copy link
Owner

@chethan1095 it seem your issue might duplicate this one. Could you please confirm?
@rcambeirooreiro discovered that edge selection does not work within groups.

@artem-mangilev artem-mangilev moved this from 0.16.0 to Done in ngx-vflow Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants