Triplanar mapping from Local Space - problem when scaling. How to make it work?

If you only rotate them on certain axis, you can get away with bounds, maybe…