Adapting Zelos Renderer

74 views
Skip to first unread message

Joshua Lowe

unread,
Feb 25, 2021, 7:10:38 PM2/25/21
to Blockly
Hi everyone,

I've adapted the Zelos renderer so that inputs aren't bumped to the right when there's a notch in the way for the connectors.

I was wondering what I need to change to increase the margin at the top of the value input or decrease the height of the input (margin is the preferred option).

Hopefully, somebody can help here, thanks! :) 

input.png

Beka Westberg

unread,
Feb 26, 2021, 3:07:08 PM2/26/21
to blo...@googlegroups.com
Hello,

So with the new rendering system (which zelos is built on) creates blocks out of rows. Rows can either contain elements (like fields, connects, etc) or they can be spacer rows. Here is a debug picture that shows element rows outlined in red, and spacer rows filled with blue:
rows-and-spacers.png
This debug view can be turned out via the advanced playground, here are my settings:
rendering-debug.png
Technically every element row has a spacer row in between it and the next row, but sometimes the height of the space row is set to 0. I believe what you want to do is set it to be not-zero, if the spacer row is in between a TopRow (which contains the notch) and another row. From looking at the source, I think the correct area to do this is around here. But I'm not exactly sure what changes need to be made, because that logic looks a bit complex hehe.

I hope that helps! If you have any other questions I can try to help, but I'm not super familiar with this system haha.

Best of luck!
--Beka

--
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/c51e0534-a32d-4f48-a2ae-6bda7abce701n%40googlegroups.com.

Joshua Lowe

unread,
Feb 26, 2021, 5:27:19 PM2/26/21
to Blockly
That looks exactly like what i'm looking for. If anyone knows how to add an additional spacer above the value input that would be great :)

Joshua Lowe

unread,
Feb 26, 2021, 5:44:37 PM2/26/21
to Blockly
Looks like i've fixed it by tweaking some numbers, thanks Beka! 

Beka Westberg

unread,
Feb 27, 2021, 10:25:18 AM2/27/21
to blo...@googlegroups.com
Yay congrats! I'm glad it's working for you :D What code did you end up having to change? I'm still trying to learn more about this stuff hehe.

Best,
Beka

Reply all
Reply to author
Forward
0 new messages