I assume, you'd have to reset the position to left + width and not just left.
For such math-y things, I suggest to either set a break point and check the values with a debugger, or print the values to the console, so you can understand what's going on.
Additionally, it can help to draw things out on paper.