zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.27k stars 233 forks source link

BUG: Cursor/tools break if pen leaves drawing tablet mid-task #2106

Open UdderNonsense opened 2 weeks ago

UdderNonsense commented 2 weeks ago

Have you searched for existing issues (including closed ones)?

Does this bug persist in a new vault with only Excalidraw installed?

Your environment

SYSTEM INFO: Obsidian version: v1.7.4 Installer version: v1.6.7 Operating system: Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:46 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8103 23.6.0 Login status: not logged in Language: en Insider build toggle: off Live preview: on Base theme: dark Community theme: none Snippets enabled: 0 Restricted mode: off Plugins installed: 11 Plugins enabled: 7 1: Latex Suite v1.9.7 2: Git v2.28.2 3: Terminal v3.15.1 4: Excalidraw v2.6.5 5: Quick Latex v2.6.5 6: PDF++ v0.40.13 7: PDF break page v1.0.0

Describe the bug

What I am doing

Using a Wacom Intuos S (plugged in with a USB-A to USB-C, Fem to Male), I have the smaller button on the pen set to middle-click, and I use this to pan over the Excalidraw window. I use the trackpad to pinch/scroll to zoom.

What is happening

The pen can middle-click and pan over the window while hovering over the tablet, which is normal. If the pen leaves this range above the tablet, while panning/middle-clicking, the tools can break in a couple of ways. The different ways appear to depend on what happens immediately after the bug occurs, but I have not tracked this specific cause-and-effect.

After the pen loses connection with the tablet:

  1. All of Excalidraw's tools break or bug out. I can not draw, highlight, select, or erase, but I can select each tool still.
  2. The cursor can end up doing a handful of things. Here is a couple: a. Simultaneously zoom the view in and out (dragging up or down), while panning b. Do nothing: right click behaviour doesn't change, but no tools work, no panning.
  3. This can only be resolved by fully reloading the plugin somehow. I do this by restarting Obsidian with "reload the app..." through the command palette. Disabling and enabling the plugin is the most direct fix I have found.

This does not seem to be an issue in the webapp.

Steps to reproduce

  1. Enable a Wacom Intuos S tablet (or a similarly functioning drawing tablet)
  2. Open a new Excalidraw drawing in Obsidian via the plugin
  3. Ensure the pen behaves normally
  4. Using the pen to middle click, pan across the Excalidraw drawing
  5. While panning and holding middle click, remove the pen from the tablet
  6. Attempt to draw again.

Expected behavior

I expect the pen/app/plugin to continue to work after the pen leaves the tablet, no matter what.

It does NOT break on the regular Excalidraw website, and in every other drawing program I have used, including Xournal++ and Krita.

Hence why I am blaming this Obsidian Plugin.

Additional context

The Wacom model itself is a bit old, and while it does work consistently, I don't know if it has the latest firmware. It is the non-bluetooth version.

I suspect it may be an issue with the mobile-app/touchscreen compatibility in the plugin, but I am not at all sure of that.

Pen-mode always turns on, though I don't need it with this drawing tablet specifically.

This has persisted across multiple versions.

UdderNonsense commented 2 weeks ago

Hence why I am blaming this Obsidian Plugin.

I mean "blame" in a very literal, impersonal way.

I love using the app, and it was easy to train myself to just not leave the tablet while panning. If it does break, I made a hotkey for reloading the app.

I'm reporting because it is persisting, and I thought I should mention it.

zsviczian commented 2 weeks ago

I've also noticed this recently not just with a pen, but with a mouse. I ran into this multiple times with ExcaliBrain opening in a popout window.

zsviczian commented 2 weeks ago

does this happen if you have double-tap eraser and single finger panning turned off?

image
zsviczian commented 2 weeks ago

Please save this script in your Excalidraw/Scripts folder. I recommend assigning a hotkey to this. I assigned shift+cmd+d but of course any hotkey will do Open the Developer console: CMD+OPT+i Switch to console view Press CMD+OPT+i to store an initial state Reproduce the error Press CMD+OPT+i Copy the object to clipboard and share the results here.

Debug AppState.md

https://github.com/user-attachments/assets/6f2943eb-8cfa-4ebc-bb31-ff3141d4a830