public override void StartSelectionMode(SelectionMode mode) { mSavedColor = BrushColor; if (mSelectTool != null && mSelectTool.SelectedStrokes.Count > 0) { mRenderer.InvokeRedrawAllStrokes(); } ManipulationMode manipulation = (mode & SelectionMode.Whole) != 0 ? ManipulationMode.WholeStroke : ManipulationMode.PartialStroke; if ((mode & SelectionMode.Manipulate) != 0) { var manipulationTool = new VectorManipulationTool(this, manipulation); manipulationTool.OnTranslate += OnToolTranslate; manipulationTool.TranslateFinished += OnToolTranslateFinished; manipulationTool.DrawingFinished += OnManipulationSelectFinished; mSelectTool = manipulationTool; } else if ((mode & SelectionMode.Erase) != 0) { var eraseTool = new VectorEraserTool(manipulation); eraseTool.DrawingFinished += OnEraseSelectFinished; mSelectTool = eraseTool; } mSelectTool.PointsAdded += OnPointsAdded; mActiveTool = mSelectTool; BrushColor = MediaColor.FromArgb(96, 0, 0, 0); }
public override void SetBrushStyle(VectorBrushStyle value) { StopSelectionMode(); switch (mBrushStyle = value) { case VectorBrushStyle.Pen: mActiveTool = new PenTool(); break; case VectorBrushStyle.Felt: mActiveTool = new FeltTool(); break; case VectorBrushStyle.Brush: mActiveTool = new BrushTool(); break; case VectorBrushStyle.Selection: throw new InvalidOperationException(""); default: throw new Exception("Unknown brush type"); } mActiveTool.PointsAdded += OnPointsAdded; }
public override void StopSelectionMode() { if (IsSelecting) { mActiveTool = null; BrushColor = mSavedColor; mSelectTool = null; mRenderer.InvokeRedrawAllStrokes(); } }