b310-digital / teammapper

Mindmapping made simple: Host and create your own mindmaps. Share your mindmap sessions with your team and collaborate on mindmaps.
https://teammapper.org
MIT License
202 stars 16 forks source link

iPad image download bug for huge maps #274

Open JannikStreek opened 2 months ago

JannikStreek commented 2 months ago

Describe the bug When exporting a big map (meaning not many nodes but just nodes with huge distances), image download on the iPad adds a txt ending which makes image usage difficult.

To Reproduce Steps to reproduce the behavior:

  1. Create a big mind map
  2. Download as image on the iPad
  3. See txt ending of file

Expected behavior No txt ending of the file

sorenjohanson commented 1 week ago

So the reason why Safari adds .txt at the end is that the image exported is actually 0KB. Chrome downloads it correctly, but it still doesn't show anything. Seems to be a general export bug.

sorenjohanson commented 1 week ago

Can be reproduced on Desktop as well.

sorenjohanson commented 1 week ago

This is caused by canvas.toDataUrl() in the export handler: https://github.com/b310-digital/teammapper/blob/main/teammapper-frontend/mmp/src/map/handlers/export.ts#L86

I'm assuming there's a practical character limit to the base64 string and we're just exceeding it.

sorenjohanson commented 1 week ago

We're hitting the practical limits of canvasses when exporting images:

Maximum height/width: 32,767 pixels Maximum area: 268,435,456 pixels (e.g., 16,384 x 16,384)

I think the only feasible solution would be to simply limit the working area to 16,000 x 16,000 px (leaving a bit of buffer) and displaying the rest of the area in grey.