void LoopDisplay_MouseMove(MouseEvent e) { if (clicking) { int closestEdge; int closestCell; var bounds = displayHost.GetBoundingClientRect(); FindClosest(e.ClientX - bounds.Left, e.ClientY - bounds.Top, out closestEdge, out closestCell, 8.0f / (float)scaleFactor); if (closestEdge != -1 || closestCell != -1) { if (lastClosestCell != closestCell || lastClosestEdge != closestEdge) { lastClosestEdge = closestEdge; lastClosestCell = closestCell; PerformAction(null, closestEdge, closestCell); } } } }