Exemplo n.º 1
0
        private void Editor_CursorClick(object sender, CursorEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                var args = new InputArgs <Point2D, TValue>(Editor.SnapPoints.IsEmpty ? e.Location : Editor.SnapPoints.Current().Location);
                AcceptCoordsInput(args);
                if (args.InputValid)
                {
                    Editor.DoPrompt("");
                    var result = InputResult <TValue> .AcceptResult(args.Value, AcceptReason.Coords);

                    if (args.InputCompleted)
                    {
                        Completion.SetResult(result);
                    }
                }
                else
                {
                    CurrentText = "";
                    Editor.DoPrompt(Options.GetFullPrompt() + args.ErrorMessage);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                // Right click equals return key
                Editor_KeyDown(sender, new KeyEventArgs(Keys.Return));
            }
        }
Exemplo n.º 2
0
        private void Editor_CursorMove(object sender, CursorEventArgs e)
        {
            // check snap mode
            Editor.SnapPoints.Clear();
            if (Editor.Document.Settings.Snap)
            {
                SnapPointType snapMode = Editor.SnapMode;
                float         snapDist = Editor.Document.ActiveView.ScreenToWorld(new Vector2D(Editor.Document.Settings.SnapDistance, 0)).X;
                foreach (Drawable item in Editor.Document.Model)
                {
                    if (item.Visible && (item.Layer == null || item.Layer.Visible))
                    {
                        Editor.SnapPoints.AddFromDrawable(item, e.Location, snapMode, snapDist);
                    }
                }
            }

            CoordsChanged(e.Location);
        }