mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-27 06:40:28 -04:00
Position for block comments imported from 2.0 should be updated when receiving a create event from scratch-blocks.
This commit is contained in:
parent
418c3837c6
commit
5086eced15
1 changed files with 12 additions and 0 deletions
|
@ -362,6 +362,18 @@ class Blocks {
|
|||
const currTarget = optRuntime.getEditingTarget();
|
||||
currTarget.createComment(e.commentId, e.blockId, e.text,
|
||||
e.xy.x, e.xy.y, e.width, e.height, e.minimized);
|
||||
|
||||
if (currTarget.comments[e.commentId].x === null &&
|
||||
currTarget.comments[e.commentId].y === null) {
|
||||
// Block comments imported from 2.0 projects are imported with their
|
||||
// x and y coordinates set to null so that scratch-blocks can
|
||||
// auto-position them. If we are receiving a create event for these
|
||||
// comments, then the auto positioning should have taken place.
|
||||
// Update the x and y position of these comments to match the
|
||||
// one from the event.
|
||||
currTarget.comments[e.commentId].x = e.xy.x;
|
||||
currTarget.comments[e.commentId].y = e.xy.y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'comment_change':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue