zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
3.75k stars 204 forks source link

BUG: random x and y displacement of elements #1734

Open chriseckinger opened 3 months ago

chriseckinger commented 3 months ago

Your environment SYSTEM INFO: Obsidian version: v1.5.12 Installer version: v1.4.13 Operating system: Windows 10 Home 10.0.22631 Login status: logged in Catalyst license: none Insider build toggle: off Live preview: on Base theme: adapt to system Community theme: none Snippets enabled: 0 Restricted mode: off Plugins installed: 17 Plugins enabled: 16 1: Excalidraw v2.1.4 2: Auto Link Title v1.5.4 3: Book Search v0.6.3 4: Templater v2.2.3 5: Sequence Hotkeys v0.6.0 6: Regex Find/Replace v1.2.0 7: Surfing v0.9.8 8: Convert url to preview (iframe) v0.5.0 9: Calendar v1.5.10 10: Google Photos v1.6.5 11: Dataview v0.5.66 12: Zotero Integration v3.1.7 13: Local REST API v2.3.0 14: Commander v0.5.1 15: Heading Shifter v1.5.1 16: Highlightr v1.2.2

Describe the bug For a couple versions of Excalidraw for Obsidian when opening an excalidraw file, I find that elements have been randomly displaced around their origin. This seems to appear at random and will affect only some parts of the text at a time. It feels like it affects the older elements of the file and bigger files more, but that might just be because these have more exposure. It also seems like the x-axis is affected more than the y-axis. Maybe important is that any other attributes of the elements (like font size, color, ...) seem to remain precisely the same. image image These used to be nicely formatted graphs

It is seriously annoying: On the one hand it happens infrequently enough and the contents are still roughly in the area that it doesn't completely destroy the value of excalidraw. On the other hand it creates a serious time demand, as I regularly have to go through my file just fixing the position of elements, which wastes quite the time.

To Reproduce I'm also using Obsidian Sync and the vault is part of a google drive, although I don't use it to sync

Steps to reproduce the behavior: I wish I knew.

  1. Open an Excalidraw File
  2. Find corrupted content I've attached a file that regularly gets damaged, maybe that helps 🧑🏻‍🎨Course Map.md

Expected behavior Elements should remain in the position they are.

zsviczian commented 3 months ago

Are you by any chance using Excalidraw on multiple devices? or always on the same device?

zsviczian commented 3 months ago

I've also experienced this, but couldn't quite put my finger on the issue. Excalidraw.com changed how text sizes are measured. The new solution is much more robust than the old, resulting in exactly the same measurements on different devices. Earlier a text element was slightly different in size on my iPad then on Windows or Android or Mac... this was especially bad when you had many lines of text. My assumption is that there is a logic error in how old elements are converted. Since this was not creating major disruption in my workflow I did not (yet) go after debugging what might be happening. The difficulty is that there are many changes that come to Excalidraw Obsidian that do not originate from my work, but from the core Excalidraw component. While I have become quite savvy in fixing those issue, each takes several days of net time to debug and understand... thus I haven't invested my time into this issue.

In your case this seems to be compounded with the issue of arrow binding.

chriseckinger commented 3 months ago

So something with Excalidraw?

I do use obsidian on multiple devices (Windows & Android). However, I use excalidraw almost exclusively on Windows (98% of the time). Also the displacement seems to happen somewhat frequently, like every day/every couple days. There are some parts of my file that I might have fixed a second time already.

chriseckinger commented 3 months ago

Since the file is large, I wouldn't exclude that it appears like it happens frequently because I keep discovering different parts of the same corruption

chriseckinger commented 3 months ago

I've created a debug file (Debug Drawing.md). I will keep opening it on android and desktop without (intentionally) modifying it over the next days, to see if anything happens to it

zsviczian commented 3 months ago

I'll keep doing the same...

zsviczian commented 3 months ago

I looked up a file that has displaced text. I opened my backup copy from my archive and opened it. Everything stayed in place. This is a file I frequently visit... my current assumption is that there was an update along the way that had some calculation error... which got resolved in the meantime. It is extremely hard to roll back time to find out what has happened. I will keep my eyes open to see if there are new errors popping up. I haven't seen any lately.

chriseckinger commented 3 months ago

Thanks Zsolt! By the way I just donated on kofi and added a link to a comment to a reddit post I once saw. Keep up the good work!