Skip to content

Preserve block comment positions when (de)serializing #8230

@gonfunko

Description

@gonfunko

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

Currently, the location of block comments in the workspace are not preserved/restored when (de)serializing them, unlike workspace comments.

Request

To do this, we should:

  • Extend ICommentIcon and its implementation with setBubbleLocation(location: Coordinate): void and getBubbleLocation(): Coordinate methods.
  • Update blockToDom() to call getBubbleLocation() and persist the coordinate under x and y attributes in the block comment XML, and update applyCommentTagNodes() to move the comment to the specified location when deserializing. I realize we're not adding new functionality to XML serialization in general, but this particular change makes work on upgrading Scratch easier and is quite small/contained.
  • Update saveState() and loadState() in CommentIcon to persist and restore the comment coordinates when using JSON serialization.
  • Update the tests to exercise moving the comment and (de)serialization

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

issue: feature requestDescribes a new feature and why it should be added

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions