/// <summary> /// this funtion initialize the drag and drop movement /// </summary> /// <param name="sender">the grip area</param> /// <param name="e">the arguments</param> private void BeginDragAction(object sender, MouseEventArgs e) { this.mouseSituationFromLastMove = new mathematics.Vector3D(); // we get the new situation of the mouse before any movement this.SetVectorFromCanvasCoodonate(this.mouseSituationFromLastMove, e.GetPosition(this.graphCanvas)); }
/// <summary> /// this funtion use the grip area to move the center of the graph /// </summary> /// <param name="sender">the grip area</param> /// <param name="e">the arguments</param> private void MoveFromMouseMovement(object sender, MouseEventArgs e) { mathematics.Vector3D currentMousePosition = new mathematics.Vector3D(); this.SetVectorFromCanvasCoodonate(currentMousePosition, e.GetPosition(this.graphCanvas)); // we create an opposit vector of the mouse movement by making the substraction between the two vector this.mouseSituationFromLastMove.Subtract(currentMousePosition); // we add the move vector to the center of the view this.center.Add(this.mouseSituationFromLastMove); // we get the new situation of the mouse after moving the center this.SetVectorFromCanvasCoodonate(this.mouseSituationFromLastMove, e.GetPosition(this.graphCanvas)); }
/// <summary> /// Initializes a new instance of the ViewManager class. /// </summary> /// <param name="model">the model to observe</param> public ViewManager(model.ModelManager model) { this.InitializeComponent(); this.modelManager = model; this.modelManager.NodeTypesChanged += new EventHandler(this.ModelManager_NodeTypesChanged); this.modelManager.LinkTypesChanged += new EventHandler(this.ModelManager_LinkTypesChanged); this.center = new mathematics.Vector3D(0, 0, 0); this.visualEffectList = new List<ICE.view.visualEffect.IVisualEffect>(); this.Settings = new setting.Settings(); this.splachScreen = new SplashScreen(); this.mouseManager = new MouseManager(this.gripArea); this.mouseManager.DragOnLeftButtonDown += new MouseEventHandler(this.BeginDragAction); this.mouseManager.MouseMovedOnLeftButtonDown += new MouseEventHandler(this.MoveFromMouseMovement); this.mouseManager.WheelMouseDown += new MouseEventHandler(this.WheelMouseDown); this.mouseManager.WheelMouseUp += new MouseEventHandler(this.WheelMouseUp); this.gripArea.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs arg) { if (this.currentActionMenu != null) { this.currentActionMenu.Close(); this.currentActionMenu = null; } }; // create the timer this.timer = new DispatcherTimer(); }