fixing weirdness if panning and rotating