blockly-samples
blockly-samples copied to clipboard
Connecting blocks by tapping on inputs
Category
Plugins
Component
new component
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
A plugin that allows for connecting blocks by tapping on inputs/outputs.
Describe alternatives you've considered
Additional context
(I think this is the issue for tracking grasshopper-like coding)
I just got a chance to read the grasshopper paper yesterday, and I think I thought of a way you can do this only using hooks that already exist in core. My understanding is that the trickiest part is allowing people to select where they want to add new code. So my throught was: blockly already allows users to select blocks, so you could probably use that behavior here.
Possible steps to create this system:
-
(Optional) Build a custom renderer that makes blocks look like text-based code.
-
Fill in all of the "slots" on all of your blocks with "filler blocks" Filler blocks are blocks that are colored to match the background of the workspace, so that they are basically invisible. Below is a simple mock-up. (You'd probably want to use your custom renderer to make these shorter as well.)
-
Make all of the blocks on the workspace immovable, ineditable, and non-deletable. But do not make the workspace readonly. This allows blocks to be selected, but the user isn't able to modify them using Blockly's traditional input system.
-
Add an event listener that looks for select or click events (not sure which is better). Once the user can select filler blocks, you should be able to create a tapping-based interface.
To actually close this issue it may be better to create something more generalized, but I would love to see someone try to build a tapping-based interface with only the current hooks :D