From 167713719819648fc32ddb17513ae10b727c0481 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 4 Aug 2025 13:20:09 -0700 Subject: [PATCH 1/2] fix: fix positioning of block comments in RTL mode --- src/scratch_comment_bubble.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scratch_comment_bubble.ts b/src/scratch_comment_bubble.ts index ec39234630..817be1cf11 100644 --- a/src/scratch_comment_bubble.ts +++ b/src/scratch_comment_bubble.ts @@ -129,14 +129,17 @@ export class ScratchCommentBubble } dropAnchor() { - this.moveTo(this.anchor.x + 40, this.anchor.y - 16); + this.moveTo( + this.anchor.x + 40 * (this.workspace.RTL ? -1 : 1), + this.anchor.y - 16 + ); const location = this.getRelativeToSurfaceXY(); this.anchorChain = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.LINE, { x1: this.anchor.x - location.x, y1: this.anchor.y - location.y, - x2: this.getSize().width / 2, + x2: (this.getSize().width / 2) * (this.workspace.RTL ? -1 : 1), y2: 16, style: `stroke: ${this.sourceBlock.getColourTertiary()}; stroke-width: 1`, }, From bb29bad369bfb3ca3167ac516721c9642feae5b3 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 4 Aug 2025 13:45:19 -0700 Subject: [PATCH 2/2] chore: factor out shared constant --- src/scratch_comment_bubble.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scratch_comment_bubble.ts b/src/scratch_comment_bubble.ts index 817be1cf11..d89cfb3fee 100644 --- a/src/scratch_comment_bubble.ts +++ b/src/scratch_comment_bubble.ts @@ -129,9 +129,10 @@ export class ScratchCommentBubble } dropAnchor() { + const verticalOffset = 16; this.moveTo( this.anchor.x + 40 * (this.workspace.RTL ? -1 : 1), - this.anchor.y - 16 + this.anchor.y - verticalOffset ); const location = this.getRelativeToSurfaceXY(); this.anchorChain = Blockly.utils.dom.createSvgElement( @@ -140,7 +141,7 @@ export class ScratchCommentBubble x1: this.anchor.x - location.x, y1: this.anchor.y - location.y, x2: (this.getSize().width / 2) * (this.workspace.RTL ? -1 : 1), - y2: 16, + y2: verticalOffset, style: `stroke: ${this.sourceBlock.getColourTertiary()}; stroke-width: 1`, }, this.getSvgRoot()