Wrong indentation.
You got strange flickering if localMouse.y or localMouse.x are < 0. You can test it if you grab left-bottom control and move your mouse only in y-direction (localMouse.y gets < 0 while localMouse.x is >= 0).