private void ViewPort_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { toolTip.IsOpen = false; //UKLONI Tooltip nakon klika ViewPort.CaptureMouse(); start = e.GetPosition(this); diffOffset.X = translacija.OffsetX; diffOffset.Y = translacija.OffsetY; }
private void ViewPort_MouseDown(object sender, MouseButtonEventArgs e) { if (e.MiddleButton == MouseButtonState.Pressed) { Grid g = sender as Grid; moving = true; start = e.GetPosition(g); } else if (e.LeftButton == MouseButtonState.Pressed) { UINodePoint.SelectOrigin = null; Grid g = sender as Grid; Point p = e.GetPosition(g); //we don't want to start selection //if we are already over a node foreach (UINode n in GraphNodes) { if (n.ContainsPoint(p)) { return; } } selectionRect.Width = 0; selectionRect.Height = 0; ViewPort.Children.Add(selectionRect); selectionRect.Margin = new Thickness(p.X, p.Y, 0, 0); start = p; ViewPort.CaptureMouse(); } }