Very similar issue to what https://github.com/google/blockly/commit/a67f841671dd5d61647ea4f159350e5823b69e69 solved. Extra considerations for the flyout: - Flyout also contains labels and buttons which need to be added to the bounding box calculations. - Gaps as specified by the toolbox/flyout xml.