pdfme / pdfme

A TypeScript based PDF generator library, made with React.
https://pdfme.com
MIT License
2.16k stars 192 forks source link

Left sidebar schema drop placement fix #454

Closed peteward closed 1 month ago

peteward commented 1 month ago

fixes #453

This increases the accuracy of the drop placement.

There is one minor issue that I have compensated for, which is the canvas scale and how that impacts the initial drag position of the schema from it's icon. At a scale of 1 this is perfectly aligned with the top-left corner of the icon position. Any other scale shifts this position left or right based on how big the scale change is.

I have written a function to compensate for this. It is crude but it works quite well, although not 100% perfect. There is a tiny jump at some scales but I don't think this is a problem.

You can see below that when you first click on the icon to drag the schema it's starting position changes based on the scale:

https://github.com/pdfme/pdfme/assets/7068515/fae5daf5-d621-4e13-ba0b-75308f6c5470

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **add-dynamic-table-schema-332** | ⬜️ Ignored ([Inspect](https://vercel.com/labelmake/add-dynamic-table-schema-332/9hS1yH3S7B3jXZm4NwvRwYk2H5qv)) | | | Mar 24, 2024 8:35am | | **pdfme-playground** | ⬜️ Ignored ([Inspect](https://vercel.com/labelmake/pdfme-playground/HAsd1EmvAW6pgzd1xdHsSDvCxt6x)) | [Visit Preview](https://pdfme-playground-git-leftsidebar-placement-fix-labelmake.vercel.app) | | Mar 24, 2024 8:35am | | **pdfme-playground-v4** | ⬜️ Ignored ([Inspect](https://vercel.com/labelmake/pdfme-playground-v4/66nsbw3T7PzHnwfopjeRB3uPCjMv)) | [Visit Preview](https://pdfme-playground-v4-git-leftsidebar-placement-fix-labelmake.vercel.app) | | Mar 24, 2024 8:35am |