Esempio n. 1
0
		private void ButtonPressEventCb (object obj, ButtonPressEventArgs args)
		{
			_canvas.WindowToWorld(args.Event.X, args.Event.Y, out _pointer_x, out _pointer_y);
			//this prevents bad behavior caused by double clicking and right or middle click
			if (args.Event.Type == EventType.ButtonPress && args.Event.Button == 1) 
			{
				//System.Console.WriteLine ("UMLCanvas> ButtonPressEventCb");
				if (!_association && !_element_selected && !_selector.Empty)
				{
					//System.Console.WriteLine ("Current {0} Selected: {1}", _current_element, _element_selected);
					if (_selector.FirstElement != null && !_selector.FirstElement.UMLControlPoint)
					{
						_selector.CleanSelection();
					}
				}
				else if (_queueAction != null)
				{
					CreateNodeAction action = _queueAction as CreateNodeAction;
					if (action != null)
					{ 
						action.Position.X = _pointer_x;
						action.Position.Y = _pointer_y;
						action.Execute ();
						_element_selected = true;
					}
					else
					{
						System.Console.WriteLine ("Queued action is not a node action");
					}
					_queueAction = null;
				} 
									
				if (!_element_selected)
				{
					System.Console.WriteLine ("Should start creating the rectangle!");
					//this prevents bad behavior when window is resized
					_selector.StartSelection (_pointer_x, _pointer_y);
				}
				_element_selected = false;
				_association = false;
			}
			else if (args.Event.Button == 3) 
			{
				MakeMenu ();
			}
		}
Esempio n. 2
0
		internal void StartActionExecution (ActionBase action)
		{
			CreateNodeAction createNode;
			CreateEdgeAction createEdge;
			if ((createNode = action as CreateNodeAction) != null)
			{
				createNode.Position.X = _pointer_x;
				createNode.Position.Y = _pointer_y;
				createNode.Execute ();
			}
			else if ((createEdge = action as CreateEdgeAction) != null)
			{
				_currentAction = createEdge;
				_association = true;
				_association_start = GetHoverElement (null);
			}
		}