UI issue when blocks are dragged near or beyond Left Toolbox pane in blockly workspace area

69 views
Skip to first unread message

Harsh Chaturvedi

unread,
Jul 28, 2022, 5:34:20 AM7/28/22
to Blockly
Hi,

The non deletable blocks go beyond the left toolbox pane when they are dragged  over the toolbox area.

blockl_toolbox_drag.png

How can we restrict the movement of blocks on the toolbox.

Note - The parent block ("modify form") is not deletable, the other blocks can be deleted.

Regards,
Harsh Chaturvedi

Maribeth Bottorff

unread,
Jul 29, 2022, 6:53:10 PM7/29/22
to Blockly
Hi, this is because blocks can go "behind" the toolbox by default. I don't think this is specific to nondeletable blocks, you can also see this by just having any block on your workspace and drag the workspace so that the block and the toolbox overlap.

Normally this isn't a problem because the toolbox is "on top" of the workspace visually, so the block will go behind it. So you could change your toolbox to not be transparent and you'd have the same behavior as in the default toolbox.

Maribeth

Harsh Chaturvedi

unread,
Jul 30, 2022, 2:45:14 PM7/30/22
to blo...@googlegroups.com
Hi Maribeth,

The current UI guidelines of our application mandates us to use the transparent background approach, would it be possible at all to stop blocks from being dragged behind the toolbox. I'm using the code in this post as reference https://groups.google.com/g/blockly/c/sCqDSz_N5DA/m/VomZ6mhFBgAJ 
However the blockly api/behavior has changed significantly since then.
Any input would be appreciated, so that we can stop the blocks from being dragged behind the toolbox.

Regards,
Harsh 

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/14bcce51-85aa-4b8a-9f0c-6fdf5918057dn%40googlegroups.com.

Maribeth Bottorff

unread,
Aug 2, 2022, 2:35:47 PM8/2/22
to Blockly
Hello,

It might be possible to reposition the toolbox to be next to the workspace instead of on top of it, but you'll have to register your own metrics manager and figure out how to change the coordinates and size of the workspace. You can have a look at the continuous toolbox as an example, but it doesn't do exactly the same thing as you're asking here so you'd have to make other changes to it as well. https://github.com/google/blockly-samples/blob/master/plugins/continuous-toolbox/src/ContinuousMetrics.js#L24

The problem is that the workspace is injected to be the same size as the injection div given, and the toolbox is also inside that div. So I am actually not sure how feasible it is to prevent the blocks from appearing in that space, but you are welcome to experiment and try.

But the simplest solution is to just change the appearance of the toolbox so I just want to double check on that solution - do you ever plan to have something else "behind" the toolbox? If not, then what is the visual difference between having a white toolbox and a transparent one? A white one would look identical to your current screenshot except the blocks would not appear on top of it.

Maribeth

Reply all
Reply to author
Forward
0 new messages