I’m not sure I understand your question though, as that has never happened to me. (the mouse uncentering) If it is relevant I am using all the default keybindings and stuff within the actual GW2 game.
For UI mouse mode I am using a spring command to recenter the mouse.
EDIT: Actually, just take my profile and you can analyse it yourself. I am poor at explaining things.