Mouse interaction - method to avoid moving component pivot to mouse trace hit?

Here is the code that made it worked.