Optimized event.dx and event.dy evaluation.