google / blockly

The web-based visual programming editor.
https://developers.google.com/blockly/
Apache License 2.0
12.26k stars 3.64k forks source link

Comment icon bubbles are positioned incorrectly when the workspace is hidden #7855

Open BeksOmega opened 4 months ago

BeksOmega commented 4 months ago

Check for duplicates

Description

If the workspace isn't visible when you deserialize a block with an open comment into it, the comment bubble will be positioned incorrectly.

Reproduction steps

  1. Go to the playground.
  2. Hit the "hide" button to hide the workspace.
  3. Load the following state into the workspace
    {
    "blocks": {
    "languageVersion": 0,
    "blocks": [
      {
        "type": "controls_if",
        "id": "uMNrsMJ1B.[!0+04,iYu",
        "x": 12,
        "y": 13,
        "icons": {
          "comment": {
            "text": "text",
            "pinned": true,
            "height": 80,
            "width": 160
          }
        }
      }
    ]
    }
    }
  4. Hit the "show" button to show the workspace.
  5. Observe how the comment is positioned incorrectly (it overlaps the block).

Stack trace

No response

Screenshots

image

Browsers

No response

Additional Info

App Inventor ran into this, but it's not a blocker for them.

maribethb commented 4 months ago

Does this mean we need to add logic to reposition bubbles when a workspace is shown/unhidden?

BeksOmega commented 4 months ago

Does this mean we need to add logic to reposition bubbles when a workspace is shown/unhidden?

I'm not sure. It could also just be a zero value making something fail early, and rearranging some code might give us a better "default" position.

If we need to add more callbacks, it should be easy enough to do so using our existing IHasBubble interface!