xaukael / card-tokens

Drag cards to the canvas
MIT License
0 stars 2 forks source link

Card Not Appearing on Canvas #4

Open brunocalado opened 1 year ago

brunocalado commented 1 year ago

Description: When dragging a card to the canvas with the Card Tokens module enabled, the module appears to work correctly, but the card does not get placed on the canvas. Additionally, when attempting to drag actors created with the cards from the actor folder to the canvas, an error occurs, as shown in the attached image.

Steps to Reproduce:

  1. Enable the Card Tokens module.
  2. Drag a card from the module to the canvas.
  3. Observe that the card does not appear on the canvas.
  4. Attempt to drag an actor created with the card from the actor folder to the canvas.
  5. Encounter the error shown in the attached image.

Expected Behavior: When dragging a card to the canvas, it should be placed on the canvas. Dragging actors created with the cards should not result in an error.

Actual Behavior: The card is not placed on the canvas, and dragging actors created with the cards triggers an error.

Environment:

Screenshots/Error Message: image

https://github.com/xaukael/card-tokens/assets/4999783/8205a602-bcd0-4319-a7fe-542251a1debd

xaukael commented 1 year ago

appears to be a SWADE related issue. I will need to install the system to investigate.

xaukael commented 1 year ago

To create the actor, I grab the first actor type from Object.keys(game.system.model.Actor). The first listed in SWADE is base, which has none of the structure SWADE is expecting of it's actors. I will look for a workaround.

xaukael commented 1 year ago

and the tokens for those cards' tokens are being created with no dimensions because there are no dimensions set on the cards. So they are being created, you just cannot see them.

xaukael commented 1 year ago

Macro to fix SWADE's Action deck

let deck = game.cards.getName('Action Deck')
deck.updateEmbeddedDocuments('Card', deck.cards.map(c=>{return {_id: c.id, width: 2, height: 3}}))
xaukael commented 1 year ago

and 0.4.7 fixes the SWADE base actor problem

brunocalado commented 1 year ago

Macro to fix SWADE's Action deck

let deck = game.cards.getName('Action Deck')
deck.updateEmbeddedDocuments('Card', deck.cards.map(c=>{return {_id: c.id, width: 2, height: 3}}))

Thank you very much.

Is it possible to add a detection to this in the module? If there is no dimension it auto set one.

xaukael commented 1 year ago

Technically, yes. I considered it, but I feel it is better just to give the cards the dimensions they should have.

brunocalado commented 1 year ago

Technically, yes. I considered it, but I feel it is better just to give the cards the dimensions they should have.

I think this would be a safer solution. So, the module will not have to rely on systems, modules or user created content.

It can prevent future issues.