f5 / unovis

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript
https://unovis.dev
Apache License 2.0
2.23k stars 43 forks source link

Issue with Multidrag Callbacks #416

Open mossy426 opened 3 months ago

mossy426 commented 3 months ago

Hey guys, thanks for implementing the multidrag feature! It's very helpful :)

I'm not sure if we're doing this right, but I'm trying to trigger the callbacks for the selection brush and dragging as mentioned in the documentation.

I have this example in stackblitz: https://stackblitz.com/edit/angular-pxlb2c?file=src%2Fforce-graph%2Fforce-graph.component.html

Using Unovis v1.4.3, Angular 16

HTML

<vis-single-container [data]="data" height="60vh">
  <vis-graph
    [layoutType]="layoutType"
    [forceLayoutSettings]="forceLayoutSettings"
    [linkLabel]="linkLabel"
    [nodeFill]="nodeFill"
    [nodeLabel]="nodeLabel"
    [nodeSize]="40"
    (onNodeSelectionBrush)="onSelectionBrush($event.selectedNodes, $event.event)"
    (onNodeSelectionDrag)="onSelectionDrag($event.selectedNodes, $event.event)"
  ></vis-graph>
</vis-single-container>

TS

 onSelectionBrush(selectedNodes: any[], event: any): void {
    console.log('Brushed Nodes:', selectedNodes);
    // Implement additional logic for brushed nodes here
  }

  onSelectionDrag(selectedNodes: any[], event: any): void {
    console.log('Dragged Nodes:', selectedNodes);
    // Implement additional logic for dragged nodes here
  }
reb-dev commented 3 months ago

@mossy426 thanks for reporting! I just realized these callbacks didn't make it into @unovis/angular, will publish a new version with the changes soon.

mossy426 commented 2 months ago

@reb-dev Awesome, thanks!