Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/blockly/core/workspace_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1987,8 +1987,9 @@ export class WorkspaceSvg
*
* @param id ID of block center on.
* @param blockOnly True to center only on the block itself, not its stack.
* @param centerOnBlockStart It is correct to center only on the block itself at its beginning.
*/
centerOnBlock(id: string | null, blockOnly?: boolean) {
centerOnBlock(id: string | null, blockOnly?: boolean, centerOnBlockStart?: boolean) {
if (!this.isMovable()) {
console.warn(
'Tried to move a non-movable workspace. This could result' +
Expand All @@ -2010,7 +2011,9 @@ export class WorkspaceSvg
: block.getHeightWidth();

// Find the enter of the block in workspace units.
const blockCenterY = xy.y + heightWidth.height / 2;
const blockCenterY = centerOnBlockStart
? xy.y
: xy.y + heightWidth.height / 2;

// In RTL the block's position is the top right of the block, not top left.
const multiplier = this.RTL ? -1 : 1;
Expand Down
Loading