Example #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            this.Focus();

            if (e.Button.HasFlag(MouseButtons.Left))
            {
                // call left down-method in the current tool
                var mousep = e.Location.ToPoint();
                var oo = ObjectAtCursor;
                TEMouseArgs ee = e.ToTEMouseArgs();
                TheOverlayModel.CurrentTool.OnLeftMouseButtonDown(oo, new System.Windows.Point(mousep.X, Height - mousep.Y), ee);
                //e.Handled = ee.Handled;
            }
            else if (e.Button.HasFlag(MouseButtons.Right))
            {
                // call right down-method in the current tool
                var mousep = e.Location.ToPoint();
                var oo = ObjectAtCursor;
                TEMouseArgs ee = e.ToTEMouseArgs();
                TheOverlayModel.CurrentTool.OnRightMouseButtonDown(oo, new System.Windows.Point(mousep.X, Height - mousep.Y), ee);
                //e.Handled = ee.Handled;

                // if the tool didn't use the click-> proceed with standard handling
                if (!ee.Handled)
                {
                    if (Tool == OverlayToolType.move)
                    {
                        //canvas1.ContextMenu.IsEnabled = true;
                        if (TheOverlayModel.CurEditing != null)
                        {
                            TheOverlayModel.CurEditing = null;
                            //PreventContextMenuOpening = true;
                        }
                        else
                        {
                            // right click not consumed yet -> open context menu
                            TheContextMenu.Show(this, e.Location);
                        }
                    }
                    else
                    {
                        Tool = OverlayToolType.move;
                        //PreventContextMenuOpening = true;
                    }
                }
            }

        }
Example #2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (e.Button.HasFlag(MouseButtons.Left))
            {
                if (MouseCaptured)
                    MouseCaptured = false;  // release mouse capture here to make sure the tools cannot forget
                var mousep = e.Location.ToPoint();
                TEMouseArgs ee = e.ToTEMouseArgs();
                TheOverlayModel.CurrentTool.OnLeftMouseButtonUp(new System.Windows.Point(mousep.X, Height - mousep.Y), ee);
                //e.Handled = ee.Handled;

            }
            else if (e.Button.HasFlag(MouseButtons.Right))
            {

            }

        }
Example #3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            var mousep = e.Location.ToPoint();
            // convert to bottom left coordinates
            var p = new System.Windows.Point(mousep.X, Height - mousep.Y);

            TEMouseArgs ee = e.ToTEMouseArgs();
            TheOverlayModel.CurrentTool.OnMouseMove(p, ee);
            //GlobalUI.UI.AddStatusLine(this, "mm " + mousep+" " + CursorPosition);
            //e.Handled = ee.Handled;
        }