-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Blocks replacement #191
Comments
It would be great if the replacement works also with code blocks: It brings the question... if the blocks have different names for their outputs, how should the replacement proceed? This is something that we should solve by using it. We will discover the rules as we test it One rule might be:
This rule will cover the above case |
Hi! I have created a PR for this: #198. Now you can replace Generic, Code and Input blocks. When the block is replaced, the wires are replaced for each side (left, right and top). First: it tries to match the same name & size connections. Second: if there are ports with the same name, they are replaced by position. The algorithms has also two steps: create a portsMap between the lowerBlock and the upperBlock, and try to replace the connected wires using this portsMap. It also preserves the wire's vertices and Undo/Redo works for move&replace and create&replace blocks. The only thing missing is the match between ports with different name. I need to figure out how to define this behavior to be consistent with the current algorithm. |
That's awesome! Thanks! :-) |
I think that this issue can be closed. We all can test it and create a new issue when a bug is found |
Currently, if you want to change one block for another (for example an updated block), you have to delete that block and insert the new one. The problem is that you lost all the connections. This is a little bit painful when your design is complex.
In addition, the replacement feature makes the exploration process of newbies much easier. Here are some examples, starting from the simplest one
This is the circuit for turning a led on:
With the replacement feature, you pick a new block, for example a bit 0:
put it over the block you want to change
click the mouse button and the block is replaced
If you replace a block by error, you can use ctr-z (undo) to move back to the previous state
Now imagine you want to make the led blinks. You just replace the bit by a heart. Pick the heart and put it over the block and click the button
I really think that this feature will make a difference in the educational project. I can image an icestudio sheet, with a simple circuit (like the hello world before) and different blocks on the left that change the behaviour on the led. The student just drag the blocks to test what they do with the led
There are many details that should be cover. Let's use this issue to document them
The text was updated successfully, but these errors were encountered: