swimlane / ngx-graph

Graph visualization library for angular
https://swimlane.github.io/ngx-graph
MIT License
932 stars 285 forks source link

Clusters have wrong position since version 8.2.3 (simple calculation issue) #538

Open adhed opened 9 months ago

adhed commented 9 months ago

Describe the bug Clusters have wrong position on the screen.

To Reproduce Steps to reproduce the behavior:

  1. Use clusters in the latest versions.
  2. You will see that clusters have wrong position (translate / transform properties) and depending how many nodes are in a cluster - it will be going worse and worse.
  3. It's a simple issue with the latest code.

Expected behavior Clusters have proper width to wrap all the nodes inside.

Screenshots

Screenshot 2024-01-04 at 14 34 42

Demo https://stackblitz.com/edit/angular-kfufe3?file=src%2Fapp%2Fapp.component.ts

ngx-graph version 8.2.3 - only here, because it has been introduced in this PR: https://github.com/swimlane/ngx-graph/pull/528

Additional context

The issue is a simple wrong calculation here done for clusters: https://github.com/swimlane/ngx-graph/pull/528/files#diff-e500ec710d86f32d459d34a450582fe79dcb541617240d848fa6319a389fa46aR454

Please take a look that dividing by 2 is now done twice which causes the issue. The flag has been handled wrongly here.

steveblue commented 9 months ago

This issue should be resolved in 8.2.4 @adhed. Thanks for reporting.