Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Attaching a block is causing the layout of the other block to change

15 views
Skip to first unread message

Chris Rowan

unread,
Nov 27, 2024, 5:15:50 AM11/27/24
to Blockly
Two blocks, one with custom formatted fields, both with extensions of the dropdown field.

The block on the left has custom field formatting because I couldn't get the fields to line up after adding a custom field with word wrap (feel like this should be standard in Blockly)

When I attach a block with text content, it pushes the original block's text content down by the height of the text content in the connected block. No reason this should be causal, but it FEELS causal.

Anyway, how do I make this stop?!

Here's a video that shows the behavior.



Christopher Allen

unread,
Nov 27, 2024, 9:01:47 AM11/27/24
to blo...@googlegroups.com
Hi Chris,

When I attach a block with text content, it pushes the original block's text content down by the height of the text content in the connected block. No reason this should be causal, but it FEELS causal.

Everything in your video appears to be working as intended: when the Source Field block grows in height, the corresponding row of the Create Target Node from block, containing the input to which the Source Field block is attached, also grows in height in order to accommodate it.  Here's a comparable example from the playground, using a text_indexOf block with a text_join block attached, with the rows marked in red:
Screenshot 2024-11-27 at 13.45.10.png

Anyway, how do I make this stop?!

You would probably need to make considerable adjustments to how the renderer works.  This may be a non-trivial undertaking, as the basic layout of blocks being organised into rows each containing a number of elements is baked fairly deeply into the existing renderers, but in principle a new custom renderer should be able to lay out blocks in any way you like.  If you've not already done so I'd suggest you begin by reviewing our documentation about Renderers and How to create a new renderer and also work through the Build Custom Renderers codelab.


Best wishes,

Christopher
Reply all
Reply to author
Forward
0 new messages