ArnoldSmith86 / virtualtabletop

a virtual surface in the browser on which you can play board, dice and card games
https://virtualtabletop.io
GNU General Public License v3.0
166 stars 30 forks source link

inheritFrom faces text is weird #1330

Open ArnoldSmith86 opened 2 years ago

ArnoldSmith86 commented 2 years ago

While overhauling Fireworks I stumbled upon this:

image

Happens immediately for me when loading this (2-3 players variant):

Fireworks.vtt.zip

I would not expect the bottom flash to be so low. It's basically the same as the others.

robartsd commented 2 years ago

For some reason there appears to be a line feed character before the lighting bolt character in that element's text node. The default white space styling for widgets is pre-wrap, so the browser is presenting the HTML correctly, but the HTML is being generated incorrectly.

robartsd commented 2 years ago

The newline is in the JSON of the vtt file for some reason.

  "y4gf": {
    "width": 73.5,
    "height": 73.5,
    "x": 1455,
    "y": 435,
    "id": "y4gf",
    "movable": false,
    "borderRadius": "50%",
    "css": "background:#805685; text-align:center;font-size:20px",
    "activeFace": 1,
    "movableInEdit": true,
    "image": "",
    "inheritFrom": {
      "cemn": [
        "faces",
        "css"
      ]
    },
    "text": "\n⚡",
    "layer": 0
  }

Perhaps this was text in the widget before you added the inherited faces?

Not sure why the JSON editor is not showing the same value for the text property:

{
  "id": "y4gf",

  "x": 1455,
  "y": 435,
  "width": 73.5,
  "height": 73.5,
  "borderRadius": "50%",

  "layer": 0,

  "movable": false,
  "movableInEdit": true,

  "activeFace": 1,
  "css": "background:#805685; text-align:center;padding:20px;box-sizing:border-box;font-size:20px",
  "image": "",
  "inheritFrom": {
    "cemn": [
      "faces",
      "css"
    ]
  },
  "text": "⚡"
}

Of course changing the face of the widget overwrites the text property and fixes the issue.