mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-05 11:09:55 -06:00
The PDF layout editor was displaying the canvas at actual page dimensions (595x842px for A4) without scaling to fit the container, causing the canvas to appear compressed and making it difficult to position elements accurately. When generating PDFs, fields would appear compressed in a small space instead of utilizing the full page width. Changes: - Add auto-fit scaling function that calculates optimal scale to fit canvas within container while maintaining aspect ratio - Center canvas in container using flexbox CSS - Update zoom controls to work with base fit scale (zoom applies on top of auto-fit) - Ensure saved designs are properly refitted when loaded - Add window resize handler to refit canvas on container size changes The coordinate system remains in actual page dimensions (72 DPI), ensuring that elements positioned in the editor match their positions in generated PDFs. The visual representation is now properly scaled to fit the container, making the editor more user-friendly while maintaining accurate PDF generation. Fixes issue where canvas appeared smaller than actual page size, causing compression when generating invoices.