Fixed variable scope error that prevented correct dragging handling

The variable ```moving``` was declared in an incorrect place. That broke the correct handling of the dragging (i.e.: when the handler is dragged for less than the half of the whole switch the state should not change)