Felix Zedén Yverås e4e22dee20 fix: rewrite coordinate management
After some initial smaller fixes, it turned out that I had broken
the red line used when linking fields. Fixing this was not trivial
as I found myself battling a lot of small bugs relating to scale
and translation in the existing code. This was made extra difficult
as a lot of coordinates were calculated when necessary in
Canvas.jsx.

This commit attempts to simplify the coordinate management in a few
different ways:
* There are now two distinct coordinate systems in use, typically
  referred to as "spaces". Screen space and diagram space.
* Diagram space is no longer measured in pixels (though the
  dimension-less measure used instead still maps to pixels at 100%
  zoom).
* The canvas now exposes helper methods for transforming between
  spaces.
* Zoom and translation is now managed via the svg viewBox property.
  * This makes moving items in diagram space much easier as the
    coordinates remain constant regardless of zoom level.
* The canvas now wraps the current mouse position in a context
  object, making mouse movement much easier to work with.
* The transform.pan property now refers to the center of the screen.

A new feature in this commit is that scroll wheel zoom is now based
on the current cursor location, making the diagram more convenient
to move around in.

I have tried to focus on Canvas.jsx and avoid changes that might be
desctructive on existing save files. I also believe more refactors
and abstractions could be introduced based on these changes to make
the diagram even easier to work with. However, I deem that out of
scope for now.
2024-07-17 22:22:52 +02:00
2024-07-02 13:18:38 +03:00
2024-04-06 05:19:13 +03:00
2024-07-17 22:22:52 +02:00
2024-05-22 15:17:07 +03:00
2024-03-15 21:09:50 +02:00
2024-04-06 11:11:12 +03:00
2023-12-16 05:39:13 +02:00
2024-04-06 11:11:12 +03:00
2024-06-01 20:53:07 +03:00
2024-05-22 14:59:41 +03:00
2024-04-14 10:20:14 +03:00
2024-04-06 12:39:13 +03:00
2024-04-06 10:55:54 +03:00
2023-12-16 05:39:13 +02:00
2024-01-03 21:37:44 +02:00
2024-02-27 15:16:14 +02:00
2023-12-16 05:39:13 +02:00

drawdb logo

Free, simple, and intuitive database design tool and SQL generator.

drawDB · Discord · X

demo

drawDB

DrawDB is a robust and user-friendly database entity relationship (DBER) editor right in your browser. Build diagrams with a few clicks, export sql scripts, customize your editor, and more without creating an account. See the full set of features here.

Getting Started

Local Development

git clone https://github.com/drawdb-io/drawdb
cd drawdb
npm install
npm run dev

Build

git clone https://github.com/drawdb-io/drawdb
cd drawdb
npm install
npm run build

Docker Build

docker build -t drawdb .
docker run -p 3000:80 drawdb

Set up the server and environment variables according to .env.sample for the survey and bug report forms.

S
Description
Free, simple, and intuitive online database diagram editor and SQL generator.
Readme AGPL-3.0 12 MiB
Languages
JavaScript 99.1%
CSS 0.8%
HTML 0.1%