Skip to content

fix: Fix overlap issue when creating multiple tables#22

Merged
AHS12 merged 8 commits intoAHS12:mainfrom
HassanBahati:fix-overlapping-cards-on-table-creation
Nov 6, 2025
Merged

fix: Fix overlap issue when creating multiple tables#22
AHS12 merged 8 commits intoAHS12:mainfrom
HassanBahati:fix-overlapping-cards-on-table-creation

Conversation

@HassanBahati
Copy link
Copy Markdown
Contributor

Description

When creating multiple tables in the diagram editor, new tables would overlap with existing ones because they were all positioned at the same fixed coordinates relative to the viewport center.
image

Brief summary of changes and motivation.
Implemented a smart positioning algorithm that automatically finds non-overlapping positions for new tables:

  • Added utility function findNonOverlappingPosition that checks if the default position overlaps with existing nodes and uses a spiral positioning algorithm to find alternative non-overlapping positions. Falls back to placing tables far from existing nodes if needed.
image

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • [] Tests added/updated
  • All tests pass locally
  • Tested on multiple browsers (Chrome, Firefox, Safari, Edge)

Test Environment:

  • Browser:
  • OS:

Checklist

  • Code follows project style
  • Self-reviewed code
  • Updated documentation
  • Backward compatible (or breaking change documented)
  • No new warnings/errors

Additional Notes

Any extra context or screenshots.

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 22, 2025

@HassanBahati is attempting to deploy a commit to the Md Azizul Hakim's projects Team on Vercel.

A member of the Team first needs to authorize it.

@HassanBahati HassanBahati changed the title fix: Fix table overlap issue when creating multiple tables fix: Fix overlap issue when creating multiple tables Sep 22, 2025
@AHS12
Copy link
Copy Markdown
Owner

AHS12 commented Sep 23, 2025

@HassanBahati Thanks, and Great job! This is indeed an issue, and your PR looks good, just some things to confirm before I approve this PR

  1. I've created Issue [Bug]: Creating a new table form dialog/menu/shortcut overlap with each other and not showing in editor #23 to track this.
  2. We have another feature allowing users to create a table from the right-click context menu. It uses a separate function, but please ensure your change doesn't impact that feature.
  3. Since users can work on any part of the diagram, can you confirm that new tables are being created within the viewport area?
  4. If the viewport area is crowded, will it default to overlap?

Again, thank you for your contribution. I really appreciate it

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thoth-blueprint Canceled Canceled Comment Mar 22, 2026 6:17pm

@AHS12
Copy link
Copy Markdown
Owner

AHS12 commented Oct 5, 2025

@HassanBahati Hi, any updates from your side? I’m working on #11 and will need this feature. If I don’t hear back from you, I’ll close the PR and use your logic as a base for my fix. Thanks!

Copy link
Copy Markdown
Contributor Author

@HassanBahati HassanBahati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AHS12 , sorry been caught up late. Will resolve on here by tomorrow. Thanks!

Copy link
Copy Markdown
Contributor Author

@HassanBahati HassanBahati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AHS12 checkout the latest changes on here when you get a chance.

@AHS12
Copy link
Copy Markdown
Owner

AHS12 commented Nov 6, 2025

@HassanBahati Great job and thank you so much for paitently addressing my comments, I am merging your pr

@AHS12 AHS12 merged commit 52090f2 into AHS12:main Nov 6, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants