Hi Amber,
This sounds like an interesting problem, and I have a few tips! Also I think you may be more interested in the bubble than the flyout (please correct me if I'm wrong). The flyout is the grey rect that holds the component blocks, and the bubble is what holds the whole mutator workspace.
If you want to find the width of the parent workspace you're going to want to look at getMetrics (which is apparently undocumented, but I believe is supposed to be public). This returns an object with a whole bunch of information about the workspace, the useful bits for you being viewWidth and viewHeight. These tell you the width and height of the visible portion of the workspace in css/pixel units.
Then I think these functions are going to be interesting to you:
- setBubbleSize in bubble.js If you added a max-size clamp here you could probably make it so no bubbles get larger than the size of the workspace.
- and resizeBubble_ in mutator.js. The inline docs say that it's called when the bubble is resized, but it also looks like it's used to resize the bubble. You could probably add your clamping here if you only want it to be applied to mutators.
I'm sorry there's no actual code to show you :/ but I hope that gives you a place to start! I hope you can get your problem fixed and if you have any more questions please reply!
Beka