I am working on a node-based editor and want to allow users to zoom in/out. I decided to modify GUI.matrix to let Unity take care of the scaling. The math is straight forward, it is easy to define a custom Matrix4x4 to render the scaled UI. The scaling works correctly.
But I have trouble making sure the scaled UI still fits inside the original bounding rectangle. It seems the bounding rectangle also get scaled! I tried using the original rectangle, scaled, inverse-scaled in the GUI.BeginGroup, GUI.BeginArea, GUI.BeginClip before resetting GUI.matrix. They all fail. It seems Unity recalculate the clipping rectangle when it render scaled UI.
Any suggestions? Or should I use a different approach? Thanks.