However, when creating new modules, use millimeters. This is because VCV Rack will always use 128.5mm tall rows. All graphics are vector, so you shouldn’t think in pixels at all. The actual number of screen pixels in a nanovg “pixel” depends on the rack’s zoom level and the OS’s zoom level (for high-DPI screens). Use mm2px() to convert from mm to nanovg pixels in code.
I never use mm2px and only place things in terms pixels but everything looks the same no matter the zoom level. When could not using mm2px lead to wrongly sized/placed widgets?
I guess the connection to the real world makes it less weird, but for me it would be more hassle to use mm2px everywhere than how much it helps me to think in terms of “real scale”.
It doesn’t quite answer your question, but I usually go with Vec(RACK_GRID_WIDTH * w, RACK_GRID_HEIGHT)
where w is an integer to make sure the module’s width is a multiple of the rail’s grid size.
I’m guessing the intended way would be to use an SVG for the panel with the right size settings instead of setting the box manually.