How node sizes are calculated?

Hi everyone,

when I use a node and I name it the size changes depending on the length of the name, how is this size calculated?

Thank you in advance for your reply

Hi @riri

As i am certain you are aware, it is calculated based on the label length and the grid size setting.

Do you need to know the actual calculations / is there a technical reason?

You are free to go on a voyage of discovery and browse the source code to find the answer :smiley:

1 Like

The width makes some allowance for the width of the characters.

But if you change the font size it makes no difference


1 Like

Depends on how you changed the font. Assuming you did this in the browser directly (and not modified a CSS and refreshed the page)? I ask because I am fairly certain the calcs do a getComputedTextLength (or getBBox or similar) at draw time (in other words, layout does not reflow because a CSS value changed post drawing)

Yes, that's right.

1 Like

thank you for the answer I look for the size of the default cells because I have to create an algorithm that displays a list of nodes in the form of graph and I would like to avoid that some blocks eat part of the other blocks . I hope someone knew the name of the function that handles this but I will go explore the bowels of node-red

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.