private void pnlRenderBitmap_MouseMove(object sender, MouseEventArgs e) { MapperMap map = EditorData.CurrentMap; if (map == null) { return; } if (mouseSelection.isDown) { mouseSelection.mouseRectPos.X = (int)((float)e.X / scaleFactor); mouseSelection.mouseRectPos.Y = (int)((float)e.Y / scaleFactor); mouseSelection.CalculateSelectionArea(); int padding = 70; mouseSelection.UpdateMaxRect(); int x1 = mouseSelection.clickedPos.X - padding; int y1 = mouseSelection.clickedPos.Y - padding; int x2 = mouseSelection.maxMouseRectPos.X + padding; int y2 = mouseSelection.maxMouseRectPos.Y + padding; DrawMap.InvalidateCache(); pnlRenderBitmap.Invalidate(new Rectangle(x1, y1, x2 - x1, y2 - y1)); } if (mouseSelection.isRightClickDown) { if (EditorData.CurrentMap.Selection.Count > 0) { dynamic offset = EditorData.CurrentMap.Selection.First().GetOffset(currentMouseHex.X, currentMouseHex.Y); var X = offset.X; var Y = offset.Y; foreach (var obj in EditorData.CurrentMap.Selection) { obj.MoveObject(X, Y); } } else if (EditorData.CurrentMap.MapSelection.hasAny()) { dynamic offset = EditorData.CurrentMap.MapSelection.GetOffset(currentMouseHex.X, currentMouseHex.Y); int X = offset.X; int Y = offset.Y; EditorData.CurrentMap.MapSelection.MoveObject(X, Y); } RefreshViewport(); } var hex = map.HexMap.GetHex(new PointF(e.X / scaleFactor, e.Y / scaleFactor + 6.0f)); if (currentMouseHex != null && (currentMouseHex.X != hex.X && currentMouseHex.Y != hex.Y)) { MouseHexChanged(map, hex); } currentMouseHex = hex; toolStripStatusHex.Text = string.Format("Mouse Coords: {0},{1} - Hex: {2},{3}", e.X, e.Y, hex.X, hex.Y); }