manuelVo/foundryvtt-drag-ruler

Drag Ruler is currently not working with a part of Walled Templates

YenBenGrey opened this issue · 3 comments

Hello,

When you choose to attach a template to a token via Walled Templates Drag Ruler locks the ability to move the token anymore.

I have also raised this with the Walled Templates Dev as I wasn't sure who to go to, so I have gone to both, I have added a screen shot of the console error.
Screenshot 2023-08-25 at 10 50 20

caewok commented

To replicate the problem, with Walled Templates and Drag Ruler installed:

  1. Select a token
  2. Create a template.
  3. In the template config, in the Walled Template portion, click the person to attach the last selected token. This should cause the token name to appear in the setting, and a notification should say that the token is attached.
  4. Close the config.
  5. Drag the token.

For me, in Walled Templates v0.6.7, Drag Ruler 1.13.8, Foundry v11.308, and dnd5e 2.3.0, I can drag the token. But it throws an error and instead of displaying the Drag Ruler highlighting, nothing is displayed. Instead, dragging the token causes the template to appear to move as if one were dragging the template alone, and then when you release the token it causes the token and template to revert back to their original position.

The issue seems to be that Walled Templates causes the templates to move along with the token in code here: https://github.com/caewok/fvtt-walled-templates/blob/71c3aea105c88f6990f0710c26026e2fc2805095/scripts/Token.js#L303.

(By wrapping Token.prototype._onDragLeftStart, _onDragLeftMove, _onDragLeftDrop, _onDragLeftCancel)

Drag Ruler seems to get confused about what is moving. The Token still moves as normal, I think, and so if Drag Ruler could move the Token and ignore the Template movement, I think it would work fine. I don't see anything that I could fix in Walled Templates, but let me know if you see something.

Drag Ruler is also doing something to how templates are dragged. This is causing the "snap-to-grid" option in Walled Templates to fail. I suspect this is the same underlying issue and Drag Ruler should ignore template dragging, but if this is a distinct issue, let me know and I will open a new issue.

caewok commented

Added a PR to address the movement issue. I can address the snap-to-grid issue with a Walled Templates update.

Just added Issue #323 believing this might be a conflit with Gambit's Premades, but it seems to be with Walled Templates then.