Move object based on mouse delta and camera view

I can move object in X Y or Z direction based on mouse delta (X or Y), no problem there.
But when I

  1. rotate an object, I need to check forward vector of object and do a lot of BRANCH check in which direction is object facing to move in proper X Y or Z direction
  2. rotate a camera, again much more BRANCH check in which direction camera is facing

Is there any simpler solution to make an object let’s say only moves (with mouse) in his LOCAL +X and -X direction, regardless of camera rotation?
Best example is Gizmo handle in Editor and you move X handle always in correct direction no matter how you rotate viewport.

Thanks for any info.