zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.07k stars 221 forks source link

BUG: copying and moving a rectangle with text, moves the text unexpectedly #1867

Closed HafiTheCat closed 2 months ago

HafiTheCat commented 3 months ago

Describe the bug

When copying a rectangle with inner text, there is a small time frame where nudging the copied rectangle detaches the inner text and moves it out along the direction the box was moved to.

To Reproduce

Steps to reproduce the behavior:

  1. Create a rectangle
  2. insert inner text into it
  3. Create a copy of the rectangle with text
  4. try to nudge the rectangle in any direction within the small time frame.
  5. Observe how the inner text moves further away the more you nudge the cursor.

Expected behavior

My expectation is that the inner text moves with the rectangle at all times.

I have checked...

review recent release notes

I checked the release notes, and I am using the newest version as stated below and it still occurs.

  1. search issues (including closed ones) to see if there is anything similar.

These issues (#538 , #1400 ) report very similar issues, however for me this occurs already by using a rectangle with inner text.


Please run Command Palette/Show Debug info in Obsidian and paste the result here.

The debug info for my system is the following:

SYSTEM INFO:
    Obsidian version: v1.6.5
    Installer version: v1.4.13
    Operating system: Windows 10 Pro 10.0.19045
    Login status: not logged in
    Insider build toggle: off
    Live preview: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 21
    Plugins enabled: 13
        1: Diagrams.net v1.0.4
        2: Editor Syntax Highlight v0.1.3
        3: Math+ v0.7.0
        4: Advanced Slides v1.20.0
        5: Completr v3.2.0
        6: Latex Suite v1.9.4
        7: Discord Rich Presence v1.5.1
        8: Paste URL into selection v1.7.0
        9: Unicode Search v0.6.1
        10: Diagrams v1.5.0
        11: Admonition v10.3.2
        12: Highlightr v1.2.2
        13: Excalidraw v2.2.8

RECOMMENDATIONS:
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Screenshots

https://github.com/zsviczian/obsidian-excalidraw-plugin/assets/58081895/0f0d3380-9fca-48ec-8288-785fdd850c23

Additional context

The debug info of the sandbox:

SYSTEM INFO:
    Obsidian version: v1.6.5
    Installer version: v1.4.13
    Operating system: Windows 10 Pro 10.0.19045
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Base theme: adapt to system
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 1
    Plugins enabled: 1
        1: Excalidraw v2.2.8

RECOMMENDATIONS:
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
zsviczian commented 3 months ago

Does it still happen if you press Ctrl+s to save before moving the copied object? Are you copying with Ctrl+c Ctrl+v or duplicating with alt+drag?

HafiTheCat commented 3 months ago

Above (https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1867#issue-2392352379) I use Ctrl+c, Ctrl+v.

When I paste the object, the save-on-change occurs. When moving the object after this save has finished, the above-mentioned issue does not appear. However, if I move the object before this save has completed, it moves the text, thus causing the issue. I cannot force-save (Ctrl+s), as a pop-up appears that says "Force save aborted because saving is in progress", which is reasonable. So once I paste the object and let the save-on-change finish, this issue does not appear, and I can freely drag around the rectangle without its inner text moving.

With alt+drag I could not get this issue to appear.

zsviczian commented 2 months ago

There is indeed an automatic save after a paste operation. I reduced the delay when this save happens from 300ms to 30ms in 2.2.9. Based on my testing that has resolved this issue.

I will release 2.2.9 later today, once released, please test and let me know if it has resolved the issue for you.

HafiTheCat commented 2 months ago

Indeed, the smaller delay fixed this issue now.

Thank you!