private void OnUndoLastFogAction_Click(object sender, EventArgs e) { var lastFogAction = this.ctlDnDMap.TryUndoLastFogAction(); undoLastFogAction.Enabled = this.ctlDnDMap.AnyUndoFogUpdates; redoLastFogAction.Enabled = this.ctlDnDMap.AnyRedoFogUpdates; if (lastFogAction != null && this.ctlControlPanel.RealTimeFogUpdates) { connection.WriteFogUpdate(lastFogAction); } }
private void pbxMap_MouseUp(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left && e.Button != System.Windows.Forms.MouseButtons.Right) { return; } pbxMap.MouseMove -= new MouseEventHandler(pbxMap_MouseMove); pbxMap.MouseUp -= new MouseEventHandler(pbxMap_MouseUp); var toBeDisposedFog = newFog; newFog = null; if (toBeDisposedFog != null) { toBeDisposedFog.Dispose(); } // Commit the last point onto the main Fog Image then clear out the 'New Fog' temporary image altogether. Note that if we don't have // at least 3 points, then we don't have a shape that can be used. currentFogUpdate.Add(ConvertPointToStretchedImage(e.Location)); if (currentFogUpdate.Length >= 3) { UpdateFogImage(currentFogUpdate); undoFogUpdates.AddLast(currentFogUpdate); undoLastFogAction.Enabled = true; redoFogUpdates.Clear(); redoLastFogAction.Enabled = false; pbxMap.Refresh(); if (realTimeFogUpdates) { connection.WriteFogUpdate(currentFogUpdate); } currentFogUpdate = null; } }