Skip to content

Commit

Permalink
fix: correctly align extension block icons (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored Sep 17, 2024
1 parent 303611a commit e3dbad1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/renderer/render_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export class RenderInfo extends Blockly.zelos.RenderInfo {
getElemCenterline_(row, elem) {
if (this.isBowlerHatBlock() && Blockly.blockRendering.Types.isField(elem)) {
return row.yPos + elem.height;
} else if (
this.block_.isScratchExtension &&
Blockly.blockRendering.Types.isField(elem) &&
elem.field instanceof Blockly.FieldImage &&
elem.field === this.block_.inputList[0].fieldRow[0] &&
this.block_.previousConnection
) {
// Vertically center the icon on extension blocks.
return super.getElemCenterline_(row, elem) + this.constants_.GRID_UNIT;
}
return super.getElemCenterline_(row, elem);
}
Expand Down

0 comments on commit e3dbad1

Please # to comment.